mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
s4:libnet: let libnet_rpc_groupadd() take tevent_context/dcerpc_binding_handle
This avoids usage/dereferencing 'struct dcerpc_pipe'. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
committed by
Günther Deschner
parent
1c6a2f8bca
commit
7a97662bb5
@ -127,13 +127,14 @@ static void continue_groupadd_created(struct tevent_req *subreq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS libnet_rpc_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
NTSTATUS libnet_rpc_groupadd(struct tevent_context *ev,
|
||||||
|
struct dcerpc_binding_handle *b,
|
||||||
|
TALLOC_CTX *mem_ctx,
|
||||||
struct libnet_rpc_groupadd *io)
|
struct libnet_rpc_groupadd *io)
|
||||||
{
|
{
|
||||||
struct composite_context *c;
|
struct composite_context *c;
|
||||||
|
|
||||||
c = libnet_rpc_groupadd_send(mem_ctx, p->conn->event_ctx,
|
c = libnet_rpc_groupadd_send(mem_ctx, ev, b, io, NULL);
|
||||||
p->binding_handle, io, NULL);
|
|
||||||
return libnet_rpc_groupadd_recv(c, mem_ctx, io);
|
return libnet_rpc_groupadd_recv(c, mem_ctx, io);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
#include "torture/libnet/proto.h"
|
#include "torture/libnet/proto.h"
|
||||||
|
|
||||||
|
|
||||||
static bool test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
static bool test_groupadd(struct torture_context *tctx,
|
||||||
|
struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
||||||
struct policy_handle *domain_handle,
|
struct policy_handle *domain_handle,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
@ -35,12 +36,15 @@ static bool test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
|
|||||||
bool ret = true;
|
bool ret = true;
|
||||||
struct libnet_rpc_groupadd group;
|
struct libnet_rpc_groupadd group;
|
||||||
|
|
||||||
|
ZERO_STRUCT(group);
|
||||||
|
|
||||||
group.in.domain_handle = *domain_handle;
|
group.in.domain_handle = *domain_handle;
|
||||||
group.in.groupname = name;
|
group.in.groupname = name;
|
||||||
|
|
||||||
printf("Testing libnet_rpc_groupadd\n");
|
printf("Testing libnet_rpc_groupadd\n");
|
||||||
|
|
||||||
status = libnet_rpc_groupadd(p, mem_ctx, &group);
|
status = libnet_rpc_groupadd(tctx->ev, p->binding_handle,
|
||||||
|
mem_ctx, &group);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
printf("Failed to call sync libnet_rpc_groupadd - %s\n", nt_errstr(status));
|
printf("Failed to call sync libnet_rpc_groupadd - %s\n", nt_errstr(status));
|
||||||
return false;
|
return false;
|
||||||
@ -77,7 +81,7 @@ bool torture_groupadd(struct torture_context *torture)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_groupadd(p, mem_ctx, &h, name)) {
|
if (!test_groupadd(torture, p, mem_ctx, &h, name)) {
|
||||||
ret = false;
|
ret = false;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user