diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-15 20:47:59 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-15 20:47:59 +0000 |
commit | c24f56e71c2d15ba0e41146abf4b0387a2461bac (patch) | |
tree | 9cfa6905626f6a1a5c8a07ddb39462691d939ff4 /source4 | |
parent | 8c90fcd32b37f211c32bcabe5e0c9af1a1ec5381 (diff) | |
download | samba-c24f56e71c2d15ba0e41146abf4b0387a2461bac.tar.gz samba-c24f56e71c2d15ba0e41146abf4b0387a2461bac.tar.bz2 samba-c24f56e71c2d15ba0e41146abf4b0387a2461bac.zip |
remember to samr_Close() policy handles after use
(This used to be commit 8b4e5c65e0e18657befbd5eba2d195c2751dcf7f)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/idl/samr.idl | 4 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.c | 2 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.h | 2 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 51 |
4 files changed, 53 insertions, 6 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index f64f9603ee..ec782acd01 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -19,7 +19,9 @@ /******************/ /* Function: 0x01 */ - NTSTATUS samr_Close (); + NTSTATUS samr_Close ( + [in,out,ref] policy_handle *handle + ); /******************/ /* Function: 0x02 */ diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index 5ee496e103..fc42d56005 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -15,6 +15,7 @@ NTSTATUS ndr_push_samr_Connect(struct ndr_push *ndr, struct samr_Connect *r) NTSTATUS ndr_push_samr_Close(struct ndr_push *ndr, struct samr_Close *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); return NT_STATUS_OK; } @@ -482,6 +483,7 @@ NTSTATUS ndr_pull_samr_Connect(struct ndr_pull *ndr, struct samr_Connect *r) NTSTATUS ndr_pull_samr_Close(struct ndr_pull *ndr, struct samr_Close *r) { + NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.handle)); NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result)); return NT_STATUS_OK; diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h index 1d29f56c65..28a7bc16cc 100644 --- a/source4/librpc/ndr/ndr_samr.h +++ b/source4/librpc/ndr/ndr_samr.h @@ -15,9 +15,11 @@ struct samr_Connect { struct samr_Close { struct { + struct policy_handle *handle; } in; struct { + struct policy_handle *handle; NTSTATUS result; } out; diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 2cdde7fc59..bfabd01149 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -21,6 +21,26 @@ #include "includes.h" +static BOOL test_Close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + struct samr_Close r; + + r.in.handle = handle; + r.out.handle = handle; + + status = dcerpc_samr_Close(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("Close handle failed - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + + + static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -131,6 +151,10 @@ static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } + if (!test_Close(p, mem_ctx, &acct_handle)) { + ret = False; + } + return ret; } @@ -159,6 +183,10 @@ static BOOL test_OpenGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } + if (!test_Close(p, mem_ctx, &acct_handle)) { + ret = False; + } + return ret; } @@ -187,6 +215,10 @@ static BOOL test_OpenAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, ret = False; } + if (!test_Close(p, mem_ctx, &acct_handle)) { + ret = False; + } + return ret; } @@ -337,6 +369,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_OpenDomain r; struct policy_handle domain_handle; + BOOL ret = True; printf("Testing OpenDomain\n"); @@ -352,22 +385,26 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (!test_QueryDomainInfo(p, mem_ctx, &domain_handle)) { - return False; + ret = False; } if (!test_EnumDomainUsers(p, mem_ctx, &domain_handle)) { - return False; + ret = False; } if (!test_EnumDomainGroups(p, mem_ctx, &domain_handle)) { - return False; + ret = False; } if (!test_EnumDomainAliases(p, mem_ctx, &domain_handle)) { - return False; + ret = False; } - return True; + if (!test_Close(p, mem_ctx, &domain_handle)) { + ret = False; + } + + return ret; } static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, @@ -491,6 +528,10 @@ BOOL torture_rpc_samr(int dummy) ret = False; } + if (!test_Close(p, mem_ctx, &handle)) { + ret = False; + } + torture_rpc_close(p); return ret; |