summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-09-11 19:35:14 +0200
committerGünther Deschner <gd@samba.org>2009-09-14 06:49:58 +0200
commitff968712bab6c2635ef74723c6f52b0fdac4b424 (patch)
treef0170bded850c92bd225fa77024a7e27441b7f48 /source3
parentfde8c46855350111e94f1da7afc6c440ab746d8b (diff)
downloadsamba-ff968712bab6c2635ef74723c6f52b0fdac4b424.tar.gz
samba-ff968712bab6c2635ef74723c6f52b0fdac4b424.tar.bz2
samba-ff968712bab6c2635ef74723c6f52b0fdac4b424.zip
s3-rpc_client: add rpccli_lsa_lookup_names4 wrapper.
Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/rpc_client/cli_lsarpc.c98
2 files changed, 84 insertions, 23 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index abc76e8e02..2b9b95b1e3 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5211,6 +5211,15 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
int level,
DOM_SID **sids,
enum lsa_SidType **types);
+NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *pol, int num_names,
+ const char **names,
+ const char ***dom_names,
+ int level,
+ DOM_SID **sids,
+ enum lsa_SidType **types);
+
bool fetch_domain_sid( char *domain, char *remote_machine, DOM_SID *psid);
/* The following definitions come from rpc_client/cli_netlogon.c */
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 68fd96faa8..0c06e7b407 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -342,23 +342,26 @@ fail:
/** Lookup a list of names */
-NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- struct policy_handle *pol, int num_names,
- const char **names,
- const char ***dom_names,
- int level,
- DOM_SID **sids,
- enum lsa_SidType **types)
+static NTSTATUS rpccli_lsa_lookup_names_generic(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *pol, int num_names,
+ const char **names,
+ const char ***dom_names,
+ int level,
+ DOM_SID **sids,
+ enum lsa_SidType **types,
+ bool use_lookupnames4)
{
NTSTATUS result;
int i;
struct lsa_String *lsa_names = NULL;
struct lsa_RefDomainList *domains = NULL;
struct lsa_TransSidArray sid_array;
+ struct lsa_TransSidArray3 sid_array3;
uint32_t count = 0;
ZERO_STRUCT(sid_array);
+ ZERO_STRUCT(sid_array3);
lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names);
if (!lsa_names) {
@@ -369,14 +372,26 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
init_lsa_String(&lsa_names[i], names[i]);
}
- result = rpccli_lsa_LookupNames(cli, mem_ctx,
- pol,
- num_names,
- lsa_names,
- &domains,
- &sid_array,
- level,
- &count);
+ if (use_lookupnames4) {
+ result = rpccli_lsa_LookupNames4(cli, mem_ctx,
+ num_names,
+ lsa_names,
+ &domains,
+ &sid_array3,
+ level,
+ &count,
+ 0,
+ 0);
+ } else {
+ result = rpccli_lsa_LookupNames(cli, mem_ctx,
+ pol,
+ num_names,
+ lsa_names,
+ &domains,
+ &sid_array,
+ level,
+ &count);
+ }
if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
NT_STATUS_V(STATUS_SOME_UNMAPPED)) {
@@ -423,10 +438,17 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
}
for (i = 0; i < num_names; i++) {
- uint32_t dom_idx = sid_array.sids[i].sid_index;
- uint32_t dom_rid = sid_array.sids[i].rid;
+ uint32_t dom_idx;
DOM_SID *sid = &(*sids)[i];
+ if (use_lookupnames4) {
+ dom_idx = sid_array3.sids[i].sid_index;
+ (*types)[i] = sid_array3.sids[i].sid_type;
+ } else {
+ dom_idx = sid_array.sids[i].sid_index;
+ (*types)[i] = sid_array.sids[i].sid_type;
+ }
+
/* Translate optimised sid through domain index array */
if (dom_idx == 0xffffffff) {
@@ -436,14 +458,16 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
continue;
}
- sid_copy(sid, domains->domains[dom_idx].sid);
+ if (use_lookupnames4) {
+ sid_copy(sid, sid_array3.sids[i].sid);
+ } else {
+ sid_copy(sid, domains->domains[dom_idx].sid);
- if (dom_rid != 0xffffffff) {
- sid_append_rid(sid, dom_rid);
+ if (sid_array.sids[i].rid != 0xffffffff) {
+ sid_append_rid(sid, sid_array.sids[i].rid);
+ }
}
- (*types)[i] = sid_array.sids[i].sid_type;
-
if (dom_names == NULL) {
continue;
}
@@ -455,3 +479,31 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
return result;
}
+
+NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *pol, int num_names,
+ const char **names,
+ const char ***dom_names,
+ int level,
+ DOM_SID **sids,
+ enum lsa_SidType **types)
+{
+ return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
+ names, dom_names, level, sids,
+ types, false);
+}
+
+NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *pol, int num_names,
+ const char **names,
+ const char ***dom_names,
+ int level,
+ DOM_SID **sids,
+ enum lsa_SidType **types)
+{
+ return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names,
+ names, dom_names, level, sids,
+ types, true);
+}