The branch, v4-19-stable has been updated via 95474d8589e VERSION: Disable GIT_SNAPSHOT for the 4.19.4 release. via 44fe0868402 WHATSNEW: Add release notes for Samba 4.19.4. via c6c14c07d37 docs-xml: use XML_CATALOG_FILES env var if defined via a8ab61b8ab2 winbind_nss_netbsd: fix missing semicolon via 2084a27c9ab s3:utils: Fix the auth function to print correct values to the user via 98e62c70894 s3:utils: Handle the domain before username and password via 3a39e21d087 doc-xml: fix name of vfs_linux_xfs man page via f11643fee31 smbd: Fix traversing snapshot dirs that vanished in current fileset via e97ec6ffb7a shadow_copy: Add test for missing directory in "current" fileset via 50f74d04884 s3:smbd multichannel: always refresh the network information via 8c63b219a26 s3:ctdbd_conn: fix ctdbd_public_ip_foreach() for ipv6 addresses via efc1a606a27 VERSION: move COPYRIGHT_STARTUP_MESSAGE as SAMBA_COPYRIGHT_STRING into version.h via 2298b92f183 lib/util: convert DBG_STARTUP_NOTICE() to use debug_set_forced_log_priority(DBGLVL_NOTICE) via 98d79426022 lib/util: add debug_set_forced_log_priority() via 928dfe6e94d source3/nmbd/nmbd.c: use DBG_STARTUP_NOTICE via ed2806fd166 lib/util/become_daemon.c: use DBG_STARTUP_NOTICE via 51ce833dd52 logging: use DBG_STARTUP_NOTICE for startup message via fb08893cde4 debug.h: introduce DEBUG_STARTUP_NOTICE via 13748870c37 lib/util: move copyright define to copyright.h via c05330a909f s4/server.c: move some log messages from ERR to NOTICE via 8b913da8b99 profile: issues info message with lower log level via 3d3cc1bd68f s3:rpc_server: call reopen_logs before we print the copyright notice via 853efb9dd7b ctdb-server: Drop unnecessary copy of destination address via 2e93e358ef9 ctdb-daemon: Use ctdb_connection_to_buf() to simplify via 2640bae75e3 smbd: Remove callback for release_ip when "state" is free'ed via 43b7068676a s3:selftest: add samba3.blackbox.smbXsrv_client_ctdb_registered_ips via d96cb627b66 selftest: export/use CTDB related envvars in order to run the ctdb command via 8add947b212 ctdbd_conn: add ctdbd_passed_ips() via e3a4feda112 ctdbd_conn: add ctdbd_unregister_ips() via acf080817b5 ctdbd_conn: Add deregister_from_ctdbd() via d039fa07f7e ctdbd_conn: let register_with_ctdbd() call CTDB_CONTROL_REGISTER_SRVID just once via e09f92422eb ctdbd_conn: don't use uninitialized memory in ctdbd_register_ips() via 118d6c81ec9 ctdb: add/implement CTDB_CONTROL_TCP_CLIENT_PASSED via b6906f37c66 ctdb: add/implement CTDB_CONTROL_TCP_CLIENT_DISCONNECTED via 24bd10ebfc1 ctdb: add ctdb_connection_same() helper via 0d6a38604b2 ctdb: make use of ctdb_canonicalize_ip_inplace() in ctdb_control_tcp_client() via 69c4f498c84 ctdb: add ctdb_canonicalize_ip_inplace() helper via 38134f374ca ctdb: remove unused ctdb->client_ip_list and print debug on ctdb_tcp_list instead via 1b6096a1dff s3:utils: Fix auth callback with smburl via 37e24c60d82 s3:tests: Add interactive smbget test for password entry via 88c297575b6 auth:creds: Add cli_credentials_get_domain_and_obtained() via ec913897169 auth:creds: Fix cli_credentials_get_password_and_obtained() with callback via 259cc2b51d5 auth:creds:tests: Add test for password callback via 8dc5d522774 s3:tests: Fix smbget test via b2e427b48c4 s3:tests: Remove the non-working test_kerberos_upn_denied of smbget via 9fe9f02cb3b s3:tests: Fix the test_kerberos_trust in smbget testsuite via fd20e3223df s3:tests: Fix test_kerberos in smbget tests via e6d14a8560a s3:tests: Pass down a normal domain user for test_smbget.sh via 4fca26641b1 selftest: Add DOMAIN_ADMIN and DOMAIN_USER variables via 3738e0a904a selftest: Remove trailing tabs/white spaces in Samba4.pm via 7998197398a s3:tests: Fix authentication with smbget_user in smbget tests via 63969fe9ade s3:utils: Fix setting the debug level via 402042b5483 s3:tests: Add smbget test for smb://DOAMIN;user%password@server/share/file via b2d450cc697 smbd: Fix read_symlink_reparse() via fcbda8c7525 vfs_ceph: call 'ceph_fgetxattr' only if valid fd via 62c90dfa32e s3:auth: Allow 'Unix Users' and 'Unix Groups' to create a local token via 9b26a0eaae8 s3:auth: Remove trailing white spaces from auth_util.c via b3ac235ba96 selftest: Show that 'allow trusted domains = no' firewalls Unix User|Group via e4505c10a76 testprogs: Add net offlinejoin composeodj tests via 4deac6a2170 testprogs: Cleanup machine account in net offlinejoin tests via 89e830251d0 s3:net: Allow to load ODJ blob from stdin via 152d2592f0f s3:net: Load ODJ blob from file only if "loadfile" parameter is present via df294c92acb s3:net: Add "net offlinejoin composeodj" command via 4f81c780125 s3:libnetapi: Implement NetComposeOfflineDomainJoin_l() via 224b8dffe80 s3:libnetapi: Add NetComposeOfflineDomainJoin() to API. via dfa8dfaa752 s3:libnetapi: Add NetComposeOfflineDomainJoin() boilerplate via 202b817f7be s3:libnetapi: Add NetComposeOfflineDomainJoin() to IDL via 0f324795d24 s3:libnetapi: Add some comments to document ODJ blob charset conversions via 1f91db224fa s3:libnetapi: Return error from RequestOfflineJoin via f45acdafa90 VERSION: Bump version up to Samba 4.19.4... from fcd094b208f VERSION: Disable GIT_SNAPSHOT for the 4.19.3 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-19-stable - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: VERSION | 4 +- WHATSNEW.txt | 85 +++++- auth/credentials/credentials.c | 26 +- auth/credentials/credentials.h | 3 + auth/credentials/tests/test_creds.c | 38 +++ buildtools/wafsamba/samba_patterns.py | 2 +- buildtools/wafsamba/samba_version.py | 1 + buildtools/wafsamba/wafsamba.py | 2 +- ctdb/common/common.h | 1 + ctdb/common/ctdb_util.c | 7 + ctdb/include/ctdb_private.h | 7 +- ctdb/protocol/protocol.h | 2 + ctdb/protocol/protocol_control.c | 30 ++ ctdb/protocol/protocol_debug.c | 2 + ctdb/protocol/protocol_util.c | 18 ++ ctdb/protocol/protocol_util.h | 3 + ctdb/server/ctdb_control.c | 8 + ctdb/server/ctdb_takeover.c | 292 ++++++++++++------- docs-xml/manpages/vfs_linux_xfs_sgid.8.xml | 4 +- lib/param/param.h | 1 + lib/util/become_daemon.c | 2 +- lib/util/debug.c | 10 + lib/util/debug.h | 7 + nsswitch/winbind_nss_netbsd.c | 2 +- selftest/target/Samba.pm | 23 ++ selftest/target/Samba3.pm | 51 +++- selftest/target/Samba4.pm | 16 +- source3/auth/auth_util.c | 81 +++--- source3/include/ctdbd_conn.h | 32 +++ source3/include/proto.h | 1 + source3/include/smb.h | 3 - source3/lib/ctdb_dummy.c | 42 +++ source3/lib/ctdbd_conn.c | 261 ++++++++++++++++- source3/lib/netapi/joindomain.c | 206 +++++++++++++- source3/lib/netapi/libnetapi.c | 67 +++++ source3/lib/netapi/libnetapi.h | 17 ++ source3/lib/netapi/netapi.h | 43 +++ source3/lib/version.c | 5 + source3/librpc/idl/libnetapi.idl | 20 ++ source3/modules/vfs_ceph.c | 27 +- source3/nmbd/nmbd.c | 4 +- source3/profile/profile_dummy.c | 2 +- source3/rpc_server/rpc_host.c | 10 +- source3/rpc_server/rpc_worker.c | 10 +- source3/script/tests/test_shadow_copy.sh | 27 ++ .../test_smbXsrv_client_ctdb_registered_ips.sh | 159 +++++++++++ source3/script/tests/test_smbget.sh | 164 +++++++---- source3/selftest/tests.py | 10 +- source3/smbd/filename.c | 2 +- source3/smbd/files.c | 14 +- source3/smbd/server.c | 5 +- source3/smbd/smb2_ioctl_network_fs.c | 12 +- source3/smbd/smb2_negprot.c | 7 + source3/smbd/smb2_process.c | 33 +++ source3/utils/net_offlinejoin.c | 312 ++++++++++++++++++++- source3/utils/net_proto.h | 2 + source3/utils/smbget.c | 67 +++-- source3/winbindd/winbindd.c | 5 +- source3/wscript_build | 3 +- source4/samba/server.c | 13 +- testprogs/blackbox/test_net_offline.sh | 94 +++++++ 61 files changed, 2135 insertions(+), 272 deletions(-) create mode 100755 source3/script/tests/test_smbXsrv_client_ctdb_registered_ips.sh Changeset truncated at 500 lines: diff --git a/VERSION b/VERSION index 7da956b9a0f..af4c5a922e2 100644 --- a/VERSION +++ b/VERSION @@ -13,6 +13,8 @@ # # ######################################################## +SAMBA_COPYRIGHT_STRING="Copyright Andrew Tridgell and the Samba Team 1992-2023" + ######################################################## # This are the main SAMBA version numbers # # # @@ -25,7 +27,7 @@ ######################################################## SAMBA_VERSION_MAJOR=4 SAMBA_VERSION_MINOR=19 -SAMBA_VERSION_RELEASE=3 +SAMBA_VERSION_RELEASE=4 ######################################################## # If a official release has a serious bug # diff --git a/WHATSNEW.txt b/WHATSNEW.txt index 2d098c61f18..1f174e9be54 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -1,3 +1,85 @@ + ============================== + Release Notes for Samba 4.19.4 + January 08, 2024 + ============================== + + +This is the latest stable release of the Samba 4.19 release series. + + +Changes since 4.19.3 +-------------------- + +o Samuel Cabrero <scabr...@samba.org> + * BUG 13577: net changesecretpw cannot set the machine account password if + secrets.tdb is empty. + +o Björn Jacke <bja...@samba.org> + * BUG 15540: For generating doc, take, if defined, env XML_CATALOG_FILES. + * BUG 15541: Trivial C typo in nsswitch/winbind_nss_netbsd.c. + * BUG 15542: vfs_linux_xfs is incorrectly named. + +o Björn Jacke <b...@sernet.de> + * BUG 15377: systemd stumbled over copyright-message at smbd startup. + +o Volker Lendecke <v...@samba.org> + * BUG 15505: Following intermediate abolute share-local symlinks is broken. + * BUG 15523: ctdb RELEASE_IP causes a crash in release_ip if a connection to + a non-public address disconnects first. + * BUG 15544: shadow_copy2 broken when current fileset's directories are + removed. + +o Stefan Metzmacher <me...@samba.org> + * BUG 15377: systemd stumbled over copyright-message at smbd startup. + * BUG 15523: ctdb RELEASE_IP causes a crash in release_ip if a connection to + a non-public address disconnects first. + * BUG 15534: smbd does not detect ctdb public ipv6 addresses for multichannel + exclusion. + +o Andreas Schneider <a...@samba.org> + * BUG 15469: 'force user = localunixuser' doesn't work if 'allow trusted + domains = no' is set. + * BUG 15525: smbget debug logging doesn't work. + * BUG 15532: smget: username in the smburl and interactive password entry + doesn't work. + * BUG 15538: smbget auth function doesn't set values for password prompt + correctly. + +o Martin Schwenke <mschwe...@ddn.com> + * BUG 15523: ctdb RELEASE_IP causes a crash in release_ip if a connection to + a non-public address disconnects first. + +o Shachar Sharon <ssha...@redhat.com> + * BUG 15440: Unable to copy and write files from clients to Ceph cluster via + SMB Linux gateway with Ceph VFS module. + +o Jones Syue <joness...@qnap.com> + * BUG 15547: Multichannel refresh network information. + + +####################################### +Reporting bugs & Development Discussion +####################################### + +Please discuss this release on the samba-technical mailing list or by +joining the #samba-technical:matrix.org matrix room, or +#samba-technical IRC channel on irc.libera.chat. + +If you do report problems then please try to send high quality +feedback. If you don't provide vital information to help us track down +the problem then you will probably be ignored. All bug reports should +be filed under the Samba 4.1 and newer product in the project's Bugzilla +database (https://bugzilla.samba.org/). + + +====================================================================== +== Our Code, Our Bugs, Our Responsibility. +== The Samba Team +====================================================================== + + +Release notes for older releases follow: +---------------------------------------- ============================== Release Notes for Samba 4.19.3 November 27, 2023 @@ -119,8 +201,7 @@ database (https://bugzilla.samba.org/). ====================================================================== -Release notes for older releases follow: ----------------------------------------- +---------------------------------------------------------------------- ============================== Release Notes for Samba 4.19.2 October 16, 2023 diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c index 0485cc4e64e..7a00279b8b4 100644 --- a/auth/credentials/credentials.c +++ b/auth/credentials/credentials.c @@ -465,11 +465,13 @@ _PUBLIC_ const char * cli_credentials_get_password_and_obtained(struct cli_credentials *cred, enum credentials_obtained *obtained) { + const char *password = cli_credentials_get_password(cred); + if (obtained != NULL) { *obtained = cred->password_obtained; } - return cli_credentials_get_password(cred); + return password; } /* Set a password on the credentials context, including an indication @@ -736,6 +738,28 @@ _PUBLIC_ const char *cli_credentials_get_domain(struct cli_credentials *cred) return cred->domain; } +/** + * @brief Obtain the domain for this credential context. + * + * @param[in] cred The credential context. + * + * @param[out] obtained A pointer to store the obtained information. + * + * @return The domain name or NULL if an error occurred. + */ +_PUBLIC_ const char *cli_credentials_get_domain_and_obtained( + struct cli_credentials *cred, + enum credentials_obtained *obtained) +{ + const char *domain = cli_credentials_get_domain(cred); + + if (obtained != NULL) { + *obtained = cred->domain_obtained; + } + + return domain; +} + _PUBLIC_ bool cli_credentials_set_domain(struct cli_credentials *cred, const char *val, diff --git a/auth/credentials/credentials.h b/auth/credentials/credentials.h index c3a048ecc8d..c5ffe536e07 100644 --- a/auth/credentials/credentials.h +++ b/auth/credentials/credentials.h @@ -127,6 +127,9 @@ int cli_credentials_get_keytab(struct cli_credentials *cred, struct loadparm_context *lp_ctx, struct keytab_container **_ktc); const char *cli_credentials_get_domain(struct cli_credentials *cred); +const char *cli_credentials_get_domain_and_obtained( + struct cli_credentials *cred, + enum credentials_obtained *obtained); struct netlogon_creds_CredentialState *cli_credentials_get_netlogon_creds(struct cli_credentials *cred); void cli_credentials_set_machine_account_pending(struct cli_credentials *cred, struct loadparm_context *lp_ctx); diff --git a/auth/credentials/tests/test_creds.c b/auth/credentials/tests/test_creds.c index a2f9642bfe0..2cb2e6d0e34 100644 --- a/auth/credentials/tests/test_creds.c +++ b/auth/credentials/tests/test_creds.c @@ -48,6 +48,7 @@ static void torture_creds_init(void **state) const char *username = NULL; const char *domain = NULL; const char *password = NULL; + enum credentials_obtained dom_obtained = CRED_UNINITIALISED; enum credentials_obtained usr_obtained = CRED_UNINITIALISED; enum credentials_obtained pwd_obtained = CRED_UNINITIALISED; bool ok; @@ -65,6 +66,11 @@ static void torture_creds_init(void **state) domain = cli_credentials_get_domain(creds); assert_string_equal(domain, "WURST"); + domain = cli_credentials_get_domain_and_obtained(creds, + &dom_obtained); + assert_int_equal(dom_obtained, CRED_SPECIFIED); + assert_string_equal(domain, "WURST"); + username = cli_credentials_get_username(creds); assert_null(username); ok = cli_credentials_set_username(creds, "brot", CRED_SPECIFIED); @@ -285,6 +291,37 @@ static void torture_creds_gensec_feature(void **state) assert_int_equal(creds->gensec_features, GENSEC_FEATURE_SIGN); } +static const char *torture_get_password(struct cli_credentials *creds) +{ + return talloc_strdup(creds, "SECRET"); +} + +static void torture_creds_password_callback(void **state) +{ + TALLOC_CTX *mem_ctx = *state; + struct cli_credentials *creds = NULL; + const char *password = NULL; + enum credentials_obtained pwd_obtained = CRED_UNINITIALISED; + bool ok; + + creds = cli_credentials_init(mem_ctx); + assert_non_null(creds); + + ok = cli_credentials_set_domain(creds, "WURST", CRED_SPECIFIED); + assert_true(ok); + ok = cli_credentials_set_username(creds, "brot", CRED_SPECIFIED); + assert_true(ok); + + ok = cli_credentials_set_password_callback(creds, torture_get_password); + assert_true(ok); + assert_int_equal(creds->password_obtained, CRED_CALLBACK); + + password = cli_credentials_get_password_and_obtained(creds, + &pwd_obtained); + assert_int_equal(pwd_obtained, CRED_CALLBACK_RESULT); + assert_string_equal(password, "SECRET"); +} + int main(int argc, char *argv[]) { int rc; @@ -296,6 +333,7 @@ int main(int argc, char *argv[]) cmocka_unit_test(torture_creds_parse_string), cmocka_unit_test(torture_creds_krb5_state), cmocka_unit_test(torture_creds_gensec_feature), + cmocka_unit_test(torture_creds_password_callback) }; if (argc == 2) { diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py index a9c5fcc4b4c..41296810e13 100644 --- a/buildtools/wafsamba/samba_patterns.py +++ b/buildtools/wafsamba/samba_patterns.py @@ -15,7 +15,7 @@ def write_version_header(task): return 0 -def SAMBA_MKVERSION(bld, target, source='VERSION'): +def SAMBA_MKVERSION(bld, target, source='VERSION buildtools/wafsamba/samba_version.py'): '''generate the version.h header for Samba''' # We only force waf to re-generate this file if we are installing, diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 54ae62f38bd..31103e0f8c4 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -174,6 +174,7 @@ also accepted as dictionary entries here def __str__(self): string="/* Autogenerated by waf */\n" +\ + "#define SAMBA_COPYRIGHT_STRING \"%s\"\n" % self.SAMBA_COPYRIGHT_STRING +\ "#define SAMBA_VERSION_MAJOR %u\n" % self.MAJOR +\ "#define SAMBA_VERSION_MINOR %u\n" % self.MINOR +\ "#define SAMBA_VERSION_RELEASE %u\n" % self.RELEASE diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 40c7b866fba..2d20eabbc8b 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -1183,7 +1183,7 @@ def SAMBAMANPAGES(bld, manpages, extra_source=None): bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl' bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl' bld.env.SAMBA_CATALOG = bld.bldnode.abspath() + '/docs-xml/build/catalog.xml' - bld.env.SAMBA_CATALOGS = 'file:///etc/xml/catalog file:///usr/local/share/xml/catalog file://' + bld.env.SAMBA_CATALOG + bld.env.SAMBA_CATALOGS = os.getenv('XML_CATALOG_FILES', 'file:///etc/xml/catalog file:///usr/local/share/xml/catalog') + ' file://' + bld.env.SAMBA_CATALOG for m in manpages.split(): source = [m + '.xml'] diff --git a/ctdb/common/common.h b/ctdb/common/common.h index c50b52a5eb5..9a73bec1ac6 100644 --- a/ctdb/common/common.h +++ b/ctdb/common/common.h @@ -132,6 +132,7 @@ struct ctdb_rec_data_old *ctdb_marshall_loop_next( TDB_DATA *key, TDB_DATA *data); void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip); +void ctdb_canonicalize_ip_inplace(ctdb_sock_addr *ip); bool ctdb_same_ip(const ctdb_sock_addr *tip1, const ctdb_sock_addr *tip2); diff --git a/ctdb/common/ctdb_util.c b/ctdb/common/ctdb_util.c index 3f8fff925f0..5c7731c5d2a 100644 --- a/ctdb/common/ctdb_util.c +++ b/ctdb/common/ctdb_util.c @@ -388,6 +388,13 @@ void ctdb_canonicalize_ip(const ctdb_sock_addr *ip, ctdb_sock_addr *cip) } } +void ctdb_canonicalize_ip_inplace(ctdb_sock_addr *ip) +{ + ctdb_sock_addr tmp; + ctdb_canonicalize_ip(ip, &tmp); + memcpy(ip, &tmp, sizeof(tmp)); +} + bool ctdb_same_ip(const ctdb_sock_addr *tip1, const ctdb_sock_addr *tip2) { ctdb_sock_addr ip1, ip2; diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 3395f077ab9..80278123778 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -296,7 +296,6 @@ struct ctdb_context { struct ctdb_statistics statistics_history[MAX_STAT_HISTORY]; struct ctdb_vnn_map *vnn_map; uint32_t num_clients; - struct ctdb_client_ip *client_ip_list; bool do_checkpublicip; bool do_setsched; const char *event_script_dir; @@ -893,6 +892,12 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, bool check_addresses); int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id, TDB_DATA indata); +int32_t ctdb_control_tcp_client_disconnected(struct ctdb_context *ctdb, + uint32_t client_id, + TDB_DATA indata); +int32_t ctdb_control_tcp_client_passed(struct ctdb_context *ctdb, + uint32_t client_id, + TDB_DATA indata); int32_t ctdb_control_tcp_add(struct ctdb_context *ctdb, TDB_DATA indata, bool tcp_update_needed); int32_t ctdb_control_tcp_remove(struct ctdb_context *ctdb, TDB_DATA indata); diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h index fb6e39f33b5..3b66c403ab8 100644 --- a/ctdb/protocol/protocol.h +++ b/ctdb/protocol/protocol.h @@ -381,6 +381,8 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS = 0, CTDB_CONTROL_ECHO_DATA = 156, CTDB_CONTROL_DISABLE_NODE = 157, CTDB_CONTROL_ENABLE_NODE = 158, + CTDB_CONTROL_TCP_CLIENT_DISCONNECTED = 159, + CTDB_CONTROL_TCP_CLIENT_PASSED = 160, }; #define MAX_COUNT_BUCKETS 16 diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c index a7c797f5dbc..83ed6cb4ee1 100644 --- a/ctdb/protocol/protocol_control.c +++ b/ctdb/protocol/protocol_control.c @@ -410,6 +410,14 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd) case CTDB_CONTROL_ENABLE_NODE: break; + + case CTDB_CONTROL_TCP_CLIENT_DISCONNECTED: + len = ctdb_connection_len(cd->data.conn); + break; + + case CTDB_CONTROL_TCP_CLIENT_PASSED: + len = ctdb_connection_len(cd->data.conn); + break; } return len; @@ -1016,6 +1024,22 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen, &cd->data.echo_data, &np); break; + + case CTDB_CONTROL_TCP_CLIENT_DISCONNECTED: + ret = ctdb_connection_pull(buf, + buflen, + mem_ctx, + &cd->data.conn, + &np); + break; + + case CTDB_CONTROL_TCP_CLIENT_PASSED: + ret = ctdb_connection_pull(buf, + buflen, + mem_ctx, + &cd->data.conn, + &np); + break; } if (ret != 0) { @@ -1376,6 +1400,12 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd) case CTDB_CONTROL_ENABLE_NODE: break; + + case CTDB_CONTROL_TCP_CLIENT_DISCONNECTED: + break; + + case CTDB_CONTROL_TCP_CLIENT_PASSED: + break; } return len; diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c index d94cb548d68..ae091b04d32 100644 --- a/ctdb/protocol/protocol_debug.c +++ b/ctdb/protocol/protocol_debug.c @@ -245,6 +245,8 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp) { CTDB_CONTROL_ECHO_DATA, "ECHO_DATA" }, { CTDB_CONTROL_DISABLE_NODE, "DISABLE_NODE" }, { CTDB_CONTROL_ENABLE_NODE, "ENABLE_NODE" }, + { CTDB_CONTROL_TCP_CLIENT_DISCONNECTED, "TCP_CLIENT_DISCONNECTED" }, + { CTDB_CONTROL_TCP_CLIENT_PASSED, "TCP_CLIENT_PASSED" }, { MAP_END, "" }, }; diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c index fe757658f48..87ecc87ac36 100644 --- a/ctdb/protocol/protocol_util.c +++ b/ctdb/protocol/protocol_util.c @@ -497,6 +497,24 @@ bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1, return (ctdb_sock_addr_cmp(addr1, addr2) == 0); } +bool ctdb_connection_same(const struct ctdb_connection *conn1, + const struct ctdb_connection *conn2) +{ + bool same; + + same = ctdb_sock_addr_same(&conn1->src, &conn2->src); + if (!same) { + return false; + } + + same = ctdb_sock_addr_same(&conn1->dst, &conn2->dst); + if (!same) { + return false; + } + + return true; +} + int ctdb_connection_to_buf(char *buf, size_t buflen, struct ctdb_connection *conn, diff --git a/ctdb/protocol/protocol_util.h b/ctdb/protocol/protocol_util.h index 2bdbb0c2ad0..70f35d122a8 100644 --- a/ctdb/protocol/protocol_util.h +++ b/ctdb/protocol/protocol_util.h @@ -55,6 +55,9 @@ bool ctdb_sock_addr_same_ip(const ctdb_sock_addr *addr1, bool ctdb_sock_addr_same(const ctdb_sock_addr *addr1, const ctdb_sock_addr *addr2); +bool ctdb_connection_same(const struct ctdb_connection *conn1, + const struct ctdb_connection *conn2); + int ctdb_connection_to_buf(char *buf, size_t buflen, struct ctdb_connection * conn, diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index 08268512bfa..422c4cf1e58 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -868,6 +868,14 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, CHECK_CONTROL_DATA_SIZE(0); return ctdb_control_enable_node(ctdb); + case CTDB_CONTROL_TCP_CLIENT_DISCONNECTED: + CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_connection)); + return ctdb_control_tcp_client_disconnected(ctdb, client_id, indata); + + case CTDB_CONTROL_TCP_CLIENT_PASSED: + CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_connection)); + return ctdb_control_tcp_client_passed(ctdb, client_id, indata); + default: DEBUG(DEBUG_CRIT,(__location__ " Unknown CTDB control opcode %u\n", opcode)); return -1; diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 26cca1aefff..e333105e633 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -348,20 +348,10 @@ struct ctdb_takeover_arp { */ struct ctdb_tcp_list { struct ctdb_tcp_list *prev, *next; + struct ctdb_client *client; struct ctdb_connection connection; -- Samba Shared Repository