From 77a4ff5435be5b80e96d7f85e71aac1949c5cff9 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 30 Apr 2024 09:46:33 +0200 Subject: [PATCH] s3:utils: Remove overwrite of opt_workgroup in rpc_trustdom_establish() This is not used anywhere in that functions or the functions we are calling. It was replaced by command line cli credentials stored in c->creds. This fixes a memory leak. Direct leak of 12 byte(s) in 1 object(s) allocated from: #0 0x7f17fdaf5830 in strdup ../../../../libsanitizer/asan/asan_interceptors.cpp:578 #1 0x7f17fc7e7339 in smb_xstrdup ../../lib/util/util.c:752 #2 0x55f079bf0723 in rpc_trustdom_establish ../../source3/utils/net_rpc.c:6591 #3 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464 #4 0x55f079bdbecf in rpc_trustdom ../../source3/utils/net_rpc.c:7483 #5 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464 #6 0x55f079bfe7de in net_rpc ../../source3/utils/net_rpc.c:8413 #7 0x55f079c529af in net_run_function ../../source3/utils/net_util.c:464 #8 0x55f079baa0a8 in main ../../source3/utils/net.c:1436 #9 0x7f17f8a2a1ef in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- source3/utils/net_rpc.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index c7f0126c465..85b3f24e221 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -6582,14 +6582,6 @@ static int rpc_trustdom_establish(struct net_context *c, int argc, } cli_credentials_set_username(c->creds, acct_name, CRED_SPECIFIED); - /* - * opt_workgroup will be used by connection functions further, - * hence it should be set to remote domain name instead of ours - */ - if (c->opt_workgroup) { - c->opt_workgroup = smb_xstrdup(domain_name); - }; - /* find the domain controller */ if (!net_find_pdc(&server_ss, pdc_name, domain_name)) { DEBUG(0, ("Couldn't find domain controller for domain %s\n", domain_name)); -- 2.47.3