mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
remember to samr_Close() policy handles after use
(This used to be commit 8b4e5c65e0
)
This commit is contained in:
parent
8c90fcd32b
commit
c24f56e71c
@ -19,7 +19,9 @@
|
||||
|
||||
/******************/
|
||||
/* Function: 0x01 */
|
||||
NTSTATUS samr_Close ();
|
||||
NTSTATUS samr_Close (
|
||||
[in,out,ref] policy_handle *handle
|
||||
);
|
||||
|
||||
/******************/
|
||||
/* Function: 0x02 */
|
||||
|
@ -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;
|
||||
|
@ -15,9 +15,11 @@ struct samr_Connect {
|
||||
|
||||
struct samr_Close {
|
||||
struct {
|
||||
struct policy_handle *handle;
|
||||
} in;
|
||||
|
||||
struct {
|
||||
struct policy_handle *handle;
|
||||
NTSTATUS result;
|
||||
} out;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user