diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-09 02:21:24 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-09 02:21:24 +0000 |
commit | 946d358646977e265cb36b34324a1145c6121870 (patch) | |
tree | 7e537d756241e98dfa2d4bbb44f50ee3f4e6d648 /source4/torture/rpc | |
parent | 75a30ad8283c49bb426c087344e40ed09abe95fd (diff) | |
download | samba-946d358646977e265cb36b34324a1145c6121870.tar.gz samba-946d358646977e265cb36b34324a1145c6121870.tar.bz2 samba-946d358646977e265cb36b34324a1145c6121870.zip |
lsa_LookupNames now works
(This used to be commit fba3a7ad22edcbe394861e42b5e5c53709e9d5fe)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/lsa.c | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 044c09ced0..3f107be41e 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -143,6 +143,69 @@ static BOOL test_OpenPolicy2(struct dcerpc_pipe *p, struct policy_handle *handle return True; } +static BOOL test_LookupNames(struct dcerpc_pipe *p, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_TransNameArray *tnames) +{ + struct lsa_LookupNames r; + struct lsa_TransSidArray sids; + struct lsa_Name *names; + uint32 count = 0; + NTSTATUS status; + int i; + + printf("\nTesting LookupNames\n"); + + sids.count = 0; + sids.sids = NULL; + + names = talloc(mem_ctx, tnames->count * sizeof(names[0])); + for (i=0;i<tnames->count;i++) { + names[i].name_len = 2*strlen(tnames->names[i].name.name); + names[i].name_size = 2*strlen(tnames->names[i].name.name); + names[i].name = tnames->names[i].name.name; + } + + 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.out.count = &count; + r.out.sids = &sids; + + status = dcerpc_lsa_LookupNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("LookupNames 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 sids (sids.count=%d)\n", count, sids.count); + for (i=0;i<sids.count;i++) { + printf("sid_type=%d rid=%d sid_index=%d\n", + sids.sids[i].sid_type, + sids.sids[i].rid, + sids.sids[i].sid_index); + } + + printf("\n"); + + return True; +} + static BOOL test_LookupSids(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, @@ -193,9 +256,12 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p, names.names[i].name.name); } - printf("\n"); + if (!test_LookupNames(p, mem_ctx, handle, &names)) { + return False; + } + return True; } |