diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-09 00:58:40 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-09 00:58:40 +0000 |
commit | cff32d6b0ae3b8f17973f544d8be891704437915 (patch) | |
tree | e1bf089b426305deb478750336cef08906c9bf93 /source4/torture | |
parent | 2430e941d748beebd1297c83d176982e7ff89be7 (diff) | |
download | samba-cff32d6b0ae3b8f17973f544d8be891704437915.tar.gz samba-cff32d6b0ae3b8f17973f544d8be891704437915.tar.bz2 samba-cff32d6b0ae3b8f17973f544d8be891704437915.zip |
added idl, generated code and test code for lsa_LookupSids
(This used to be commit afa1ff5f08fceba3d34b4e0965fe7e0c0143ede9)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/rpc/lsa.c | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 5cf56acd30..044c09ced0 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -144,6 +144,61 @@ static BOOL test_OpenPolicy2(struct dcerpc_pipe *p, struct policy_handle *handle } +static BOOL test_LookupSids(struct dcerpc_pipe *p, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_SidArray *sids) +{ + struct lsa_LookupSids r; + struct lsa_TransNameArray names; + uint32 count = sids->num_sids; + NTSTATUS status; + int i; + + printf("\nTesting LookupSids\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.out.count = &count; + r.out.names = &names; + + status = dcerpc_lsa_LookupSids(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("LookupSids failed - %s\n", nt_errstr(status)); + return False; + } + + if (r.out.domains) { + printf("lookup gave %d domains (max_count=%d)\n", + r.out.domains->count, + r.out.domains->max_count); + for (i=0;i<r.out.domains->count;i++) { + printf("name='%s' sid=%s\n", + r.out.domains->domains[i].name.name, + lsa_sid_string_talloc(mem_ctx, r.out.domains->domains[i].sid)); + } + } + + printf("lookup gave %d names (names.count=%d)\n", count, names.count); + for (i=0;i<names.count;i++) { + printf("type=%d sid_index=%d name='%s'\n", + names.names[i].sid_type, + names.names[i].sid_index, + names.names[i].name.name); + } + + + printf("\n"); + + return True; +} + static BOOL test_EnumSids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) @@ -168,11 +223,15 @@ static BOOL test_EnumSids(struct dcerpc_pipe *p, printf("%s\n", lsa_sid_string_talloc(mem_ctx, sids1.sids[i].sid)); } + if (!test_LookupSids(p, mem_ctx, handle, &sids1)) { + return False; + } + if (sids1.num_sids < 3) { return True; } - printf("trying partial listing (asking for 1 at 2)\n"); + printf("trying EnumSids partial listing (asking for 1 at 2)\n"); resume_handle = 2; status = dcerpc_lsa_EnumSids(p, mem_ctx, handle, &resume_handle, 1, &sids2); if (!NT_STATUS_IS_OK(status)) { |