summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/lsa.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-26 06:33:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:10 -0500
commitb56d1c5cb7768a403f57c3a48e4dbd40978d3c79 (patch)
tree1e7c750a415968cd2d0e9db801d520927cfd7a07 /source4/torture/rpc/lsa.c
parent990acc9f770325bf8c5bb8d04e0c6f6cdb4b67ef (diff)
downloadsamba-b56d1c5cb7768a403f57c3a48e4dbd40978d3c79.tar.gz
samba-b56d1c5cb7768a403f57c3a48e4dbd40978d3c79.tar.bz2
samba-b56d1c5cb7768a403f57c3a48e4dbd40978d3c79.zip
r3978: added IDL and test code for lsa_LookupSids2() and lsa_LookupNames2()
(This used to be commit 9da455ed56ebc167f295b231c2730e3ff9c94617)
Diffstat (limited to 'source4/torture/rpc/lsa.c')
-rw-r--r--source4/torture/rpc/lsa.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index c33606cc9e..395ce7ab26 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -143,6 +143,50 @@ static BOOL test_LookupNames(struct dcerpc_pipe *p,
return True;
}
+static BOOL test_LookupNames2(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ struct lsa_TransNameArray2 *tnames)
+{
+ struct lsa_LookupNames2 r;
+ struct lsa_TransSidArray2 sids;
+ struct lsa_String *names;
+ uint32_t count = 0;
+ NTSTATUS status;
+ int i;
+
+ printf("\nTesting LookupNames2 with %d names\n", tnames->count);
+
+ sids.count = 0;
+ sids.sids = NULL;
+
+ names = talloc(mem_ctx, tnames->count * sizeof(names[0]));
+ for (i=0;i<tnames->count;i++) {
+ init_lsa_String(&names[i], tnames->names[i].name.string);
+ }
+
+ r.in.handle = handle;
+ r.in.num_names = tnames->count;
+ r.in.names = names;
+ r.in.sids = &sids;
+ r.in.level = 1;
+ r.in.count = &count;
+ r.in.unknown1 = 0;
+ r.in.unknown2 = 0;
+ r.out.count = &count;
+ r.out.sids = &sids;
+
+ status = dcerpc_lsa_LookupNames2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
+ printf("LookupNames2 failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ printf("\n");
+
+ return True;
+}
+
static BOOL test_LookupSids(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
@@ -182,6 +226,47 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p,
return True;
}
+
+static BOOL test_LookupSids2(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle,
+ struct lsa_SidArray *sids)
+{
+ struct lsa_LookupSids2 r;
+ struct lsa_TransNameArray2 names;
+ uint32_t count = sids->num_sids;
+ NTSTATUS status;
+
+ printf("\nTesting LookupSids2\n");
+
+ names.count = 0;
+ names.names = NULL;
+
+ r.in.handle = handle;
+ r.in.sids = sids;
+ r.in.names = &names;
+ r.in.level = 1;
+ r.in.count = &count;
+ r.in.unknown1 = 0;
+ r.in.unknown2 = 0;
+ r.out.count = &count;
+ r.out.names = &names;
+
+ status = dcerpc_lsa_LookupSids2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
+ printf("LookupSids2 failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ printf("\n");
+
+ if (!test_LookupNames2(p, mem_ctx, handle, &names)) {
+ return False;
+ }
+
+ return True;
+}
+
static BOOL test_many_LookupSids(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
@@ -607,6 +692,10 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p,
return False;
}
+ if (!test_LookupSids2(p, mem_ctx, handle, &sids1)) {
+ return False;
+ }
+
printf("testing all accounts\n");
for (i=0;i<sids1.num_sids;i++) {
test_OpenAccount(p, mem_ctx, handle, sids1.sids[i].sid);