summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-27 05:15:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:20 -0500
commit399aade69ccab93312337a05dd8f21335a44566a (patch)
treeebd922ad4c07a07580bdc0b00c65faa64c3b402c /source4/torture
parent61a7dfc2371c65bce0bf15ef868b40921cd81756 (diff)
downloadsamba-399aade69ccab93312337a05dd8f21335a44566a.tar.gz
samba-399aade69ccab93312337a05dd8f21335a44566a.tar.bz2
samba-399aade69ccab93312337a05dd8f21335a44566a.zip
r2676: add a test of the reference counting logic in the SAMR server into the
RPC-SAMR torture test. This closes the samr connection before working on a open domain handle. The server is supposed to know that the open domain handle still holds a reference to the connection, so the connection remains valid even though it has been closed. (This used to be commit f31e5d56e364ce8ab76fdb20b30e179b458b2ffa)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/samr.c117
1 files changed, 31 insertions, 86 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 5a9462a92a..5bc5b3bf49 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -2705,6 +2705,8 @@ static BOOL test_RemoveMemberFromForeignDomain(struct dcerpc_pipe *p,
+static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle);
static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct dom_sid *sid)
@@ -2735,89 +2737,31 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
- if (!test_QuerySecurity(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_RemoveMemberFromForeignDomain(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_CreateUser2(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_CreateUser(p, mem_ctx, &domain_handle, &user_handle)) {
- ret = False;
- }
-
- if (!test_CreateAlias(p, mem_ctx, &domain_handle, &alias_handle, sid)) {
- ret = False;
- }
-
- if (!test_CreateDomainGroup(p, mem_ctx, &domain_handle, &group_handle)) {
- ret = False;
- }
-
- if (!test_QueryDomainInfo(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_QueryDomainInfo2(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_EnumDomainUsers(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_EnumDomainUsers_async(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_EnumDomainGroups(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_EnumDomainAliases(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_QueryDisplayInfo(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_QueryDisplayInfo2(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_QueryDisplayInfo3(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_GroupList(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_TestPrivateFunctionsDomain(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_RidToSid(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
-
- if (!test_GetBootKeyInformation(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
+ /* run the domain tests with the main handle closed - this tests
+ the servers reference counting */
+ ret &= test_Close(p, mem_ctx, handle);
+
+ ret &= test_QuerySecurity(p, mem_ctx, &domain_handle);
+ ret &= test_RemoveMemberFromForeignDomain(p, mem_ctx, &domain_handle);
+ ret &= test_CreateUser2(p, mem_ctx, &domain_handle);
+ ret &= test_CreateUser(p, mem_ctx, &domain_handle, &user_handle);
+ ret &= test_CreateAlias(p, mem_ctx, &domain_handle, &alias_handle, sid);
+ ret &= test_CreateDomainGroup(p, mem_ctx, &domain_handle, &group_handle);
+ ret &= test_QueryDomainInfo(p, mem_ctx, &domain_handle);
+ ret &= test_QueryDomainInfo2(p, mem_ctx, &domain_handle);
+ ret &= test_EnumDomainUsers(p, mem_ctx, &domain_handle);
+ ret &= test_EnumDomainUsers_async(p, mem_ctx, &domain_handle);
+ ret &= test_EnumDomainGroups(p, mem_ctx, &domain_handle);
+ ret &= test_EnumDomainAliases(p, mem_ctx, &domain_handle);
+ ret &= test_QueryDisplayInfo(p, mem_ctx, &domain_handle);
+ ret &= test_QueryDisplayInfo2(p, mem_ctx, &domain_handle);
+ ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
+ ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
+ ret &= test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle);
+ ret &= test_GroupList(p, mem_ctx, &domain_handle);
+ ret &= test_TestPrivateFunctionsDomain(p, mem_ctx, &domain_handle);
+ ret &= test_RidToSid(p, mem_ctx, &domain_handle);
+ ret &= test_GetBootKeyInformation(p, mem_ctx, &domain_handle);
if (!policy_handle_empty(&user_handle) &&
!test_DeleteUser(p, mem_ctx, &user_handle)) {
@@ -2834,9 +2778,10 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
- if (!test_Close(p, mem_ctx, &domain_handle)) {
- ret = False;
- }
+ ret &= test_Close(p, mem_ctx, &domain_handle);
+
+ /* reconnect the main handle */
+ ret &= test_Connect(p, mem_ctx, handle);
return ret;
}