diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/cli_lsarpc.c | 4 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_rpc.c | 21 | ||||
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 14 | ||||
-rw-r--r-- | source3/rpcclient/cmd_lsarpc.c | 11 | ||||
-rw-r--r-- | source3/utils/smbcacls.c | 7 |
5 files changed, 24 insertions, 33 deletions
diff --git a/source3/libsmb/cli_lsarpc.c b/source3/libsmb/cli_lsarpc.c index 66504d8355..7e0abd583c 100644 --- a/source3/libsmb/cli_lsarpc.c +++ b/source3/libsmb/cli_lsarpc.c @@ -336,7 +336,7 @@ NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx, /** Lookup a list of names */ NTSTATUS cli_lsa_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, int num_names, const char **dom_names, const char **names, + POLICY_HND *pol, int num_names, const char **names, DOM_SID **sids, uint32 **types, int *num_sids) { prs_struct qbuf, rbuf; @@ -356,7 +356,7 @@ NTSTATUS cli_lsa_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx, /* Marshall data and send request */ - init_q_lookup_names(mem_ctx, &q, pol, num_names, dom_names, names); + init_q_lookup_names(mem_ctx, &q, pol, num_names, names); if (!lsa_io_q_lookup_names("", &q, &qbuf, 0) || !rpc_api_pipe_req(cli, LSA_LOOKUPNAMES, &qbuf, &rbuf)) { diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 7d9a26f906..67fcd5de66 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -177,17 +177,28 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, DOM_SID *sids = NULL; uint32 *types = NULL; int num_sids; - const char *domain_name = domain->name; + const char *full_name; - if (!(mem_ctx = talloc_init_named("name_to_sid[rpc]"))) + if (!(mem_ctx = talloc_init_named("name_to_sid[rpc] for [%s]\\[%s]", domain->name, name))) { + DEBUG(0, ("talloc_init failed!\n")); return NT_STATUS_NO_MEMORY; + } - if (!(hnd = cm_get_lsa_handle(domain->name))) + if (!(hnd = cm_get_lsa_handle(domain->name))) { + talloc_destroy(mem_ctx); return NT_STATUS_UNSUCCESSFUL; + } + full_name = talloc_asprintf(mem_ctx, "%s\\%s", domain->name, name); + + if (!full_name) { + DEBUG(0, ("talloc_asprintf failed!\n")); + talloc_destroy(mem_ctx); + return NT_STATUS_NO_MEMORY; + } + status = cli_lsa_lookup_names(hnd->cli, mem_ctx, &hnd->pol, 1, - &domain_name, &name, - &sids, &types, &num_sids); + &full_name, &sids, &types, &num_sids); /* Return rid and type if lookup successful */ if (NT_STATUS_IS_OK(status)) { diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ae6068e3d6..a70d1e98a9 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1045,7 +1045,7 @@ makes a structure. ********************************************************************/ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, - POLICY_HND *hnd, int num_names, const char **dom_names, const char **names) + POLICY_HND *hnd, int num_names, const char **names) { int i; @@ -1071,19 +1071,11 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, } for (i = 0; i < num_names; i++) { - char *full_name; int len; - - full_name = talloc_asprintf(mem_ctx, "%s\\%s", dom_names[i], names[i]); - if (!full_name) { - DEBUG(0, ("init_q_lookup_names(): out of memory doing talloc_asprintf\n")); - return; - } - - len = strlen(full_name); + len = strlen(names[i]); init_uni_hdr(&q_l->hdr_name[i], len); - init_unistr2(&q_l->uni_name[i], full_name, len); + init_unistr2(&q_l->uni_name[i], names[i], len); } } diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 67efbb1ff7..1b733d25c3 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -80,8 +80,6 @@ static NTSTATUS cmd_lsa_lookup_names(struct cli_state *cli, DOM_SID *sids; uint32 *types; int num_names, i; - fstring name, domain; - const char *name2, *domain2; if (argc == 1) { printf("Usage: %s [name1 [name2 [...]]]\n", argv[0]); @@ -95,15 +93,8 @@ static NTSTATUS cmd_lsa_lookup_names(struct cli_state *cli, if (!NT_STATUS_IS_OK(result)) goto done; - /* Lookup the names */ - - split_domain_name(argv[1], domain, name); - - name2 = talloc_strdup(mem_ctx, name); - domain2 = talloc_strdup(mem_ctx, domain); - result = cli_lsa_lookup_names(cli, mem_ctx, &pol, argc - 1, - &domain2, &name2, &sids, + (const char**)(argv + 1), &sids, &types, &num_names); if (!NT_STATUS_IS_OK(result)) diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index d62907e14b..d2bec218fe 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -140,17 +140,14 @@ static BOOL StringToSid(DOM_SID *sid, const char *str) DOM_SID *sids = NULL; int num_sids; BOOL result = True; - fstring name, domain; - + if (strncmp(str, "S-", 2) == 0) { return string_to_sid(sid, str); } - split_domain_name(str, domain, name); - if (!cacls_open_policy_hnd() || !NT_STATUS_IS_OK(cli_lsa_lookup_names(&lsa_cli, lsa_cli.mem_ctx, &pol, 1, - (const char **)&domain, (const char **)&name, + &str, &sids, &types, &num_sids))) { result = False; goto done; |