diff options
-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; |