From: Stefan Metzmacher Date: Fri, 27 Sep 2024 11:31:13 +0000 (+0200) Subject: s3:winbindd: let store_current_dc_in_gencache() take the dcaddr directly X-Git-Tag: tdb-1.4.13~1025 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2c91e81ce6df33b6aa8fa843447fc71183e71367;p=thirdparty%2Fsamba.git s3:winbindd: let store_current_dc_in_gencache() take the dcaddr directly We could avoid relying on smbXcli_conn_remote_sockaddr() as much as possible, because we aim to remove domain->conn.cli same day... Also note that find_dc() always filled domain->dcaddr already when cm_open_connection() calls store_current_dc_in_gencache(). Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Tue Oct 1 11:01:35 UTC 2024 on atb-devel-224 --- diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index d8a7ef7ce63..ef7b70f400f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1661,18 +1661,13 @@ static char *current_dc_key(TALLOC_CTX *mem_ctx, const char *domain_name) static void store_current_dc_in_gencache(const char *domain_name, const char *dc_name, - struct cli_state *cli) + const struct sockaddr_storage *dc_addr) { char addr[INET6_ADDRSTRLEN]; char *key = NULL; char *value = NULL; - if (!cli_state_is_connected(cli)) { - return; - } - - print_sockaddr(addr, sizeof(addr), - smbXcli_conn_remote_sockaddr(cli->conn)); + print_sockaddr(addr, sizeof(addr), dc_addr); key = current_dc_key(talloc_tos(), domain_name); if (key == NULL) { @@ -1836,8 +1831,9 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain, * once we start to connect to multiple DCs, wbcDcInfo is * already prepared for that. */ - store_current_dc_in_gencache(domain->name, domain->dcname, - new_conn->cli); + store_current_dc_in_gencache(domain->name, + domain->dcname, + &domain->dcaddr); seal_pipes = lp_winbind_sealed_pipes(); seal_pipes = lp_parm_bool(-1, "winbind sealed pipes",