From 3fa8da4d26d9a880a2a4911a32f222fbc5d2eeaa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Nov 2003 11:01:39 +0000 Subject: - fixed lsa_EnumTrustDom - added lsa_OpenAccount - handle STATUS_SOME_UNMAPPED (This used to be commit e5d93cf996b3e9647ef0ca45f6aab7601369936b) --- source4/torture/rpc/lsa.c | 56 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 90db819a33..df095aca6e 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -183,7 +183,7 @@ static BOOL test_LookupNames(struct dcerpc_pipe *p, r.out.sids = &sids; status = dcerpc_lsa_LookupNames(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { + if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) { printf("LookupNames failed - %s\n", nt_errstr(status)); return False; } @@ -238,7 +238,7 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p, r.out.names = &names; status = dcerpc_lsa_LookupSids(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { + if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) { printf("LookupSids failed - %s\n", nt_errstr(status)); return False; } @@ -271,6 +271,31 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p, return True; } +static BOOL test_OpenAccount(struct dcerpc_pipe *p, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct dom_sid *sid) +{ + NTSTATUS status; + struct lsa_OpenAccount r; + struct policy_handle acct_handle; + + printf("Testing account %s\n", lsa_sid_string_talloc(mem_ctx, sid)); + + r.in.handle = handle; + r.in.sid = sid; + r.in.desired_access = SEC_RIGHTS_MAXIMUM_ALLOWED; + r.out.acct_handle = &acct_handle; + + status = dcerpc_lsa_OpenAccount(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("OpenAccount failed - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + static BOOL test_EnumAccounts(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) @@ -305,6 +330,12 @@ static BOOL test_EnumAccounts(struct dcerpc_pipe *p, if (!test_LookupSids(p, mem_ctx, handle, &sids1)) { return False; } + + printf("testing all accounts\n"); + for (i=0;icount, - r.out.domains->max_count); - for (i=0;icount;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 domains (max_count=%d)\n", + domains.count, + domains.max_count); + for (i=0;icount;i++) { + printf("name='%s' sid=%s\n", + domains.domains[i].name.name, + lsa_sid_string_talloc(mem_ctx, domains.domains[i].sid)); } return True; @@ -431,10 +462,13 @@ static BOOL test_Close(struct dcerpc_pipe *p, { NTSTATUS status; struct lsa_Close r; + struct policy_handle handle2; printf("\ntesting Close\n"); r.in.handle = handle; + r.out.handle = &handle2; + status = dcerpc_lsa_Close(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); -- cgit