diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-01-12 03:19:48 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:44 -0500 |
commit | e6be2ad8b735ad5357bdec18bc0da983af300c2b (patch) | |
tree | 7dd4091b79168595172099caf29c424a9a1f5f66 /source4/torture/rpc | |
parent | c0571f623406ca33a4d5ce616c743479335eeba0 (diff) | |
download | samba-e6be2ad8b735ad5357bdec18bc0da983af300c2b.tar.gz samba-e6be2ad8b735ad5357bdec18bc0da983af300c2b.tar.bz2 samba-e6be2ad8b735ad5357bdec18bc0da983af300c2b.zip |
r4699: Move the test_EnumTrustDom() test into the test_CreateTrustedDomain
test. This way, it must have at least one domain to enumerate.
Andrew Bartlett
(This used to be commit c19f1850ee76db07d4ab5654039bc1f78377994d)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/lsa.c | 106 |
1 files changed, 63 insertions, 43 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index 98de8df78c..5bb282a033 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -631,45 +631,6 @@ static BOOL test_DeleteTrustedDomain(struct dcerpc_pipe *p, } -static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, - TALLOC_CTX *mem_ctx, - struct policy_handle *handle) -{ - NTSTATUS status; - struct lsa_CreateTrustedDomain r; - struct lsa_TrustInformation trustinfo; - struct dom_sid *domsid; - struct policy_handle trustdom_handle; - - printf("Testing CreateTrustedDomain\n"); - - domsid = dom_sid_parse_talloc(mem_ctx, "S-1-5-21-97398-379795-12345"); - - trustinfo.sid = domsid; - init_lsa_String(&trustinfo.name, "torturedomain"); - - r.in.handle = handle; - r.in.info = &trustinfo; - r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - r.out.trustdom_handle = &trustdom_handle; - - status = dcerpc_lsa_CreateTrustedDomain(p, mem_ctx, &r); - if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { - test_DeleteTrustedDomain(p, mem_ctx, handle, trustinfo.name); - status = dcerpc_lsa_CreateTrustedDomain(p, mem_ctx, &r); - } - if (!NT_STATUS_IS_OK(status)) { - printf("CreateTrustedDomain failed - %s\n", nt_errstr(status)); - return False; - } - - if (!test_Delete(p, mem_ctx, &trustdom_handle)) { - return False; - } - - return True; -} - static BOOL test_CreateSecret(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) @@ -1423,6 +1384,69 @@ static BOOL test_EnumTrustDom(struct dcerpc_pipe *p, return ret; } +static BOOL test_CreateTrustedDomain(struct dcerpc_pipe *p, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + BOOL ret = True; + struct lsa_CreateTrustedDomain r; + struct lsa_TrustInformation trustinfo; + struct dom_sid *domsid; + struct policy_handle trustdom_handle; + struct lsa_QueryTrustedDomainInfo q; + + printf("Testing CreateTrustedDomain\n"); + + domsid = dom_sid_parse_talloc(mem_ctx, "S-1-5-21-97398-379795-12345"); + + trustinfo.sid = domsid; + init_lsa_String(&trustinfo.name, "torturedomain"); + + r.in.handle = handle; + r.in.info = &trustinfo; + r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; + r.out.trustdom_handle = &trustdom_handle; + + status = dcerpc_lsa_CreateTrustedDomain(p, mem_ctx, &r); + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) { + test_DeleteTrustedDomain(p, mem_ctx, handle, trustinfo.name); + status = dcerpc_lsa_CreateTrustedDomain(p, mem_ctx, &r); + } + if (!NT_STATUS_IS_OK(status)) { + printf("CreateTrustedDomain failed - %s\n", nt_errstr(status)); + return False; + } + + q.in.trustdom_handle = &trustdom_handle; + q.in.level = LSA_TRUSTED_DOMAIN_INFO_NAME; + status = dcerpc_lsa_QueryTrustedDomainInfo(p, mem_ctx, &q); + if (!NT_STATUS_IS_OK(status)) { + printf("QueryTrustedDomainInfo level 1 failed - %s\n", nt_errstr(status)); + ret = False; + } + if (!q.out.info) { + ret = False; + } else { + if (strcmp(q.out.info->name.netbios_name.string, trustinfo.name.string) != 0) { + printf("QueryTrustedDomainInfo returned inconsistant short name: %s != %s\n", + q.out.info->name.netbios_name.string, trustinfo.name.string); + ret = False; + } + } + + /* now that we have some domains to look over, we can test the enum calls */ + if (!test_EnumTrustDom(p, mem_ctx, handle)) { + ret = False; + } + + if (!test_Delete(p, mem_ctx, &trustdom_handle)) { + ret = False; + } + + return ret; +} + static BOOL test_QueryInfoPolicy(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) @@ -1598,10 +1622,6 @@ BOOL torture_rpc_lsa(void) ret = False; } - if (!test_EnumTrustDom(p, mem_ctx, &handle)) { - ret = False; - } - if (!test_QueryInfoPolicy(p, mem_ctx, &handle)) { ret = False; } |