diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/util_str.c | 2 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 23 |
2 files changed, 17 insertions, 8 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 03e9306805..6ec43a963b 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -826,7 +826,7 @@ void hex_encode(const unsigned char *buff_in, size_t len, char **out_hex_buffer) Check if a string is part of a list. **/ -BOOL in_list(char *s,char *list,BOOL casesensitive) +BOOL in_list(const char *s, const char *list, BOOL casesensitive) { pstring tok; const char *p=list; diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 269a7f60af..51514596d6 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -2702,6 +2702,11 @@ rpc_share_migrate_shares_internals(const DOM_SID *domain_sid, const char *domain strequal(netname,"global")) continue; + if (opt_exclude && in_list(netname, opt_exclude, False)) { + printf("excluding [%s]\n", netname); + continue; + } + /* only work with file-shares */ if (!cli_send_tconX(cli, netname, "A:", "", 0)) { d_printf("skipping [%s]: not a file share.\n", netname); @@ -2971,7 +2976,7 @@ rpc_share_migrate_files_internals(const DOM_SID *domain_sid, const char *domain_ continue; } - if (opt_exclude && in_list(netname, (char *)opt_exclude, False)) { + if (opt_exclude && in_list(netname, opt_exclude, False)) { printf("excluding [%s]\n", netname); continue; } @@ -4472,6 +4477,7 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid, POLICY_HND connect_pol, domain_pol, user_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; char *acct_name; + const char **names; DOM_SID trust_acct_sid; uint32 *user_rids, num_rids, *name_types; uint32 flags = 0x000003e8; /* Unknown */ @@ -4484,13 +4490,17 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid, /* * Make valid trusting domain account (ie. uppercased and with '$' appended) */ - - if (asprintf(&acct_name, "%s$", argv[0]) < 0) { + acct_name = talloc_asprintf(mem_ctx, "%s$", argv[0]); + + if (acct_name == NULL) return NT_STATUS_NO_MEMORY; - } strupper_m(acct_name); + names = TALLOC_ARRAY(mem_ctx, const char *, 1); + names[0] = acct_name; + + /* Get samr policy handle */ result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, &connect_pol); @@ -4507,8 +4517,8 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid, } result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol, flags, 1, - &acct_name, &num_rids, &user_rids, - &name_types); + names, &num_rids, + &user_rids, &name_types); if (!NT_STATUS_IS_OK(result)) { goto done; @@ -4552,7 +4562,6 @@ static NTSTATUS rpc_trustdom_del_internals(const DOM_SID *domain_sid, } done: - SAFE_FREE(acct_name); return result; } |