summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-28 05:44:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:25 -0500
commitb2f1a29e4348a5bc34a87d72d526e23e421ed9d5 (patch)
treec69987090647da615193f1361e03986588ac164d /source4/torture/rpc
parenta675b09e8d45b9298df8f8c82bbaa7b91a793eb5 (diff)
downloadsamba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.tar.gz
samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.tar.bz2
samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.zip
r2710: continue with the new style of providing a parent context whenever
possible to a structure creation routine. This makes for much easier global cleanup. (This used to be commit e14ee428ec357fab76a960387a9820a673786e27)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/samr.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 5bc5b3bf49..ac09a346f6 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -2887,30 +2887,40 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct samr_Connect4 r4;
struct samr_Connect5 r5;
union samr_ConnectInfo info;
- BOOL ret = True;
+ struct policy_handle h;
+ BOOL ret = True, got_handle = False;
printf("testing samr_Connect\n");
r.in.system_name = 0;
r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
- r.out.connect_handle = handle;
+ r.out.connect_handle = &h;
status = dcerpc_samr_Connect(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect failed - %s\n", nt_errstr(status));
ret = False;
+ } else {
+ got_handle = True;
+ *handle = h;
}
printf("testing samr_Connect2\n");
r2.in.system_name = NULL;
r2.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
- r2.out.connect_handle = handle;
+ r2.out.connect_handle = &h;
status = dcerpc_samr_Connect2(p, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect2 failed - %s\n", nt_errstr(status));
ret = False;
+ } else {
+ if (got_handle) {
+ test_Close(p, mem_ctx, handle);
+ }
+ got_handle = True;
+ *handle = h;
}
printf("testing samr_Connect3\n");
@@ -2918,12 +2928,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r3.in.system_name = NULL;
r3.in.unknown = 0;
r3.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
- r3.out.connect_handle = handle;
+ r3.out.connect_handle = &h;
status = dcerpc_samr_Connect3(p, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect3 failed - %s\n", nt_errstr(status));
ret = False;
+ } else {
+ if (got_handle) {
+ test_Close(p, mem_ctx, handle);
+ }
+ got_handle = True;
+ *handle = h;
}
printf("testing samr_Connect4\n");
@@ -2931,12 +2947,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r4.in.system_name = "";
r4.in.unknown = 0;
r4.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
- r4.out.connect_handle = handle;
+ r4.out.connect_handle = &h;
status = dcerpc_samr_Connect4(p, mem_ctx, &r4);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect4 failed - %s\n", nt_errstr(status));
ret = False;
+ } else {
+ if (got_handle) {
+ test_Close(p, mem_ctx, handle);
+ }
+ got_handle = True;
+ *handle = h;
}
printf("testing samr_Connect5\n");
@@ -2949,12 +2971,18 @@ static BOOL test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r5.in.level = 1;
r5.in.info = &info;
r5.out.info = &info;
- r5.out.connect_handle = handle;
+ r5.out.connect_handle = &h;
status = dcerpc_samr_Connect5(p, mem_ctx, &r5);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect5 failed - %s\n", nt_errstr(status));
ret = False;
+ } else {
+ if (got_handle) {
+ test_Close(p, mem_ctx, handle);
+ }
+ got_handle = True;
+ *handle = h;
}
return ret;