1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s4:torture/libnet: make use of dcerpc_binding_handle stubs

metze
This commit is contained in:
Stefan Metzmacher 2010-03-11 11:33:10 +01:00
parent 7be154a616
commit f1633934cd
6 changed files with 97 additions and 91 deletions

View File

@ -47,7 +47,7 @@ static bool test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx,
}
static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle)
{
NTSTATUS status;
@ -59,7 +59,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("closing domain handle\n");
status = dcerpc_samr_Close(p, mem_ctx, &r);
status = dcerpc_samr_Close_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Close failed - %s\n", nt_errstr(status));
return false;
@ -100,7 +100,7 @@ bool torture_domainopen(struct torture_context *torture)
goto done;
}
if (!test_cleanup(net_ctx->samr.pipe, mem_ctx, &h)) {
if (!test_cleanup(net_ctx->samr.pipe->binding_handle, mem_ctx, &h)) {
ret = false;
goto done;
}

View File

@ -28,7 +28,7 @@
#include "param/param.h"
static bool test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_opendomain_samr(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct lsa_String *domname,
uint32_t *access_mask, struct dom_sid **sid_p)
{
@ -47,7 +47,7 @@ static bool test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r1.in.access_mask = *access_mask;
r1.out.connect_handle = &h;
status = dcerpc_samr_Connect(p, mem_ctx, &r1);
status = dcerpc_samr_Connect_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect failed - %s\n", nt_errstr(status));
return false;
@ -59,7 +59,7 @@ static bool test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("domain lookup on %s\n", domname->string);
status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2);
status = dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupDomain failed - %s\n", nt_errstr(status));
return false;
@ -72,7 +72,7 @@ static bool test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("opening domain\n");
status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3);
status = dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenDomain failed - %s\n", nt_errstr(status));
return false;
@ -84,7 +84,7 @@ static bool test_opendomain_samr(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_opendomain_lsa(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_opendomain_lsa(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct lsa_String *domname,
uint32_t *access_mask)
{
@ -110,7 +110,7 @@ static bool test_opendomain_lsa(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
open.in.access_mask = *access_mask;
open.out.handle = handle;
status = dcerpc_lsa_OpenPolicy2(p, mem_ctx, &open);
status = dcerpc_lsa_OpenPolicy2_r(b, mem_ctx, &open);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
@ -157,7 +157,7 @@ bool torture_domain_open_lsa(struct torture_context *torture)
lsa_close.in.handle = &ctx->lsa.handle;
lsa_close.out.handle = &h;
status = dcerpc_lsa_Close(ctx->lsa.pipe, ctx, &lsa_close);
status = dcerpc_lsa_Close_r(ctx->lsa.pipe->binding_handle, ctx, &lsa_close);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to close domain on lsa service: %s\n", nt_errstr(status));
ret = false;
@ -207,7 +207,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain_lsa(p, torture, &h, &domain_name, &access_mask)) {
if (!test_opendomain_lsa(p->binding_handle, torture, &h, &domain_name, &access_mask)) {
d_printf("failed to open domain on lsa service\n");
ret = false;
goto done;
@ -282,7 +282,7 @@ bool torture_domain_open_samr(struct torture_context *torture)
printf("closing domain handle\n");
status = dcerpc_samr_Close(ctx->samr.pipe, mem_ctx, &r);
status = dcerpc_samr_Close_r(ctx->samr.pipe->binding_handle, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Close failed - %s\n", nt_errstr(status));
ret = false;
@ -336,7 +336,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
domain_name.string = talloc_strdup(mem_ctx, lp_workgroup(torture->lp_ctx));
if (!test_opendomain_samr(p, torture, &h, &domain_name, &access_mask, &sid)) {
if (!test_opendomain_samr(p->binding_handle, torture, &h, &domain_name, &access_mask, &sid)) {
d_printf("failed to open domain on samr service\n");
ret = false;
goto done;

View File

@ -31,7 +31,7 @@
#define TEST_GROUPNAME "libnetgrouptest"
static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle, const char *groupname)
{
NTSTATUS status;
@ -53,7 +53,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("group account lookup '%s'\n", groupname);
status = dcerpc_samr_LookupNames(p, mem_ctx, &r1);
status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupNames failed - %s\n", nt_errstr(status));
return false;
@ -68,7 +68,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("opening group account\n");
status = dcerpc_samr_OpenGroup(p, mem_ctx, &r2);
status = dcerpc_samr_OpenGroup_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenGroup failed - %s\n", nt_errstr(status));
return false;
@ -79,7 +79,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("deleting group account\n");
status = dcerpc_samr_DeleteDomainGroup(p, mem_ctx, &r3);
status = dcerpc_samr_DeleteDomainGroup_r(b, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("DeleteGroup failed - %s\n", nt_errstr(status));
return false;
@ -89,7 +89,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_creategroup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, const char *name)
{
NTSTATUS status;
@ -108,19 +108,19 @@ static bool test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("creating group account %s\n", name);
status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r);
status = dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateGroup failed - %s\n", nt_errstr(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_GROUP_EXISTS)) {
printf("Group (%s) already exists - attempting to delete and recreate group again\n", name);
if (!test_cleanup(p, mem_ctx, handle, TEST_GROUPNAME)) {
if (!test_cleanup(b, mem_ctx, handle, TEST_GROUPNAME)) {
return false;
}
printf("creating group account\n");
status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r);
status = dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateGroup failed - %s\n", nt_errstr(status));
return false;
@ -134,7 +134,7 @@ static bool test_creategroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_opendomain(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct lsa_String *domname)
{
NTSTATUS status;
@ -150,7 +150,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r1.out.connect_handle = &h;
status = dcerpc_samr_Connect(p, mem_ctx, &r1);
status = dcerpc_samr_Connect_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect failed - %s\n", nt_errstr(status));
return false;
@ -162,7 +162,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("domain lookup on %s\n", domname->string);
status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2);
status = dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupDomain failed - %s\n", nt_errstr(status));
return false;
@ -175,7 +175,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("opening domain\n");
status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3);
status = dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenDomain failed - %s\n", nt_errstr(status));
return false;
@ -187,7 +187,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_samr_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle)
{
NTSTATUS status;
@ -196,7 +196,7 @@ static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.handle = domain_handle;
r.out.handle = domain_handle;
status = dcerpc_samr_Close(p, mem_ctx, &r);
status = dcerpc_samr_Close_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Close samr domain failed - %s\n", nt_errstr(status));
return false;
@ -206,7 +206,7 @@ static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_lsa_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle)
{
NTSTATUS status;
@ -215,7 +215,7 @@ static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.handle = domain_handle;
r.out.handle = domain_handle;
status = dcerpc_lsa_Close(p, mem_ctx, &r);
status = dcerpc_lsa_Close_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Close lsa domain failed - %s\n", nt_errstr(status));
return false;
@ -250,12 +250,12 @@ bool torture_groupinfo_api(struct torture_context *torture)
}
domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
if (!test_opendomain(p->binding_handle, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
}
if (!test_creategroup(p, prep_mem_ctx, &h, name)) {
if (!test_creategroup(p->binding_handle, prep_mem_ctx, &h, name)) {
ret = false;
goto done;
}
@ -275,13 +275,13 @@ bool torture_groupinfo_api(struct torture_context *torture)
goto done;
}
if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_GROUPNAME)) {
if (!test_cleanup(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle, TEST_GROUPNAME)) {
printf("cleanup failed\n");
ret = false;
goto done;
}
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
printf("domain close failed\n");
ret = false;
}
@ -337,12 +337,12 @@ bool torture_grouplist(struct torture_context *torture)
goto done;
}
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
printf("domain close failed\n");
ret = false;
}
if (!test_lsa_close(ctx->lsa.pipe, mem_ctx, &ctx->lsa.handle)) {
if (!test_lsa_close(ctx->lsa.pipe->binding_handle, mem_ctx, &ctx->lsa.handle)) {
printf("lsa domain close failed\n");
ret = false;
}
@ -379,13 +379,13 @@ bool torture_creategroup(struct torture_context *torture)
goto done;
}
if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_GROUPNAME)) {
if (!test_cleanup(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle, TEST_GROUPNAME)) {
printf("cleanup failed\n");
ret = false;
goto done;
}
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
printf("domain close failed\n");
ret = false;
}

View File

@ -165,7 +165,7 @@ done:
}
static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, const char *host,
static bool test_addshare(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, const char *host,
const char* share)
{
NTSTATUS status;
@ -188,7 +188,7 @@ static bool test_addshare(struct dcerpc_pipe *svc_pipe, TALLOC_CTX *mem_ctx, con
add.in.info = &info;
add.in.parm_error = NULL;
status = dcerpc_srvsvc_NetShareAdd(svc_pipe, mem_ctx, &add);
status = dcerpc_srvsvc_NetShareAdd_r(b, mem_ctx, &add);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to add a new share\n");
return false;
@ -222,7 +222,7 @@ bool torture_delshare(struct torture_context *torture)
torture_assert_ntstatus_ok(torture, status, "Failed to get rpc connection");
if (!test_addshare(p, torture, host, TEST_SHARENAME)) {
if (!test_addshare(p->binding_handle, torture, host, TEST_SHARENAME)) {
return false;
}

View File

@ -29,7 +29,7 @@
#include "param/param.h"
static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle, const char *username)
{
NTSTATUS status;
@ -51,7 +51,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("user account lookup '%s'\n", username);
status = dcerpc_samr_LookupNames(p, mem_ctx, &r1);
status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupNames failed - %s\n", nt_errstr(status));
return false;
@ -66,7 +66,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("opening user account\n");
status = dcerpc_samr_OpenUser(p, mem_ctx, &r2);
status = dcerpc_samr_OpenUser_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenUser failed - %s\n", nt_errstr(status));
return false;
@ -77,7 +77,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("deleting user account\n");
status = dcerpc_samr_DeleteUser(p, mem_ctx, &r3);
status = dcerpc_samr_DeleteUser_r(b, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("DeleteUser failed - %s\n", nt_errstr(status));
return false;
@ -87,7 +87,7 @@ static bool test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_opendomain(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct lsa_String *domname)
{
NTSTATUS status;
@ -103,7 +103,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r1.out.connect_handle = &h;
status = dcerpc_samr_Connect(p, mem_ctx, &r1);
status = dcerpc_samr_Connect_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("Connect failed - %s\n", nt_errstr(status));
return false;
@ -115,7 +115,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("domain lookup on %s\n", domname->string);
status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2);
status = dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupDomain failed - %s\n", nt_errstr(status));
return false;
@ -128,7 +128,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("opening domain\n");
status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3);
status = dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenDomain failed - %s\n", nt_errstr(status));
return false;
@ -140,7 +140,7 @@ static bool test_opendomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_samr_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle)
{
NTSTATUS status;
@ -149,7 +149,7 @@ static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.handle = domain_handle;
r.out.handle = domain_handle;
status = dcerpc_samr_Close(p, mem_ctx, &r);
status = dcerpc_samr_Close_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Close samr domain failed - %s\n", nt_errstr(status));
return false;
@ -159,7 +159,7 @@ static bool test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_lsa_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle)
{
NTSTATUS status;
@ -168,7 +168,7 @@ static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.handle = domain_handle;
r.out.handle = domain_handle;
status = dcerpc_lsa_Close(p, mem_ctx, &r);
status = dcerpc_lsa_Close_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("Close lsa domain failed - %s\n", nt_errstr(status));
return false;
@ -178,7 +178,7 @@ static bool test_lsa_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static bool test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
static bool test_createuser(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, const char* user)
{
NTSTATUS status;
@ -198,19 +198,19 @@ static bool test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("creating user '%s'\n", username.string);
status = dcerpc_samr_CreateUser(p, mem_ctx, &r1);
status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateUser failed - %s\n", nt_errstr(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
printf("User (%s) already exists - attempting to delete and recreate account again\n", user);
if (!test_cleanup(p, mem_ctx, handle, TEST_USERNAME)) {
if (!test_cleanup(b, mem_ctx, handle, TEST_USERNAME)) {
return false;
}
printf("creating user account\n");
status = dcerpc_samr_CreateUser(p, mem_ctx, &r1);
status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateUser failed - %s\n", nt_errstr(status));
return false;
@ -225,7 +225,7 @@ static bool test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("closing user '%s'\n", username.string);
status = dcerpc_samr_Close(p, mem_ctx, &r2);
status = dcerpc_samr_Close_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("Close failed - %s\n", nt_errstr(status));
return false;
@ -259,13 +259,13 @@ bool torture_createuser(struct torture_context *torture)
goto done;
}
if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) {
if (!test_cleanup(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) {
printf("cleanup failed\n");
ret = false;
goto done;
}
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
printf("domain close failed\n");
ret = false;
}
@ -306,12 +306,12 @@ bool torture_deleteuser(struct torture_context *torture)
}
domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
if (!test_opendomain(p->binding_handle, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
}
if (!test_createuser(p, prep_mem_ctx, &h, name)) {
if (!test_createuser(p->binding_handle, prep_mem_ctx, &h, name)) {
ret = false;
goto done;
}
@ -483,6 +483,7 @@ bool torture_modifyuser(struct torture_context *torture)
struct libnet_UserInfo user_req;
int fld;
bool ret = true;
struct dcerpc_binding_handle *b;
prep_mem_ctx = talloc_init("prepare test_deleteuser");
@ -496,16 +497,17 @@ bool torture_modifyuser(struct torture_context *torture)
ret = false;
goto done;
}
b = p->binding_handle;
name = talloc_strdup(prep_mem_ctx, TEST_USERNAME);
domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
if (!test_opendomain(b, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
}
if (!test_createuser(p, prep_mem_ctx, &h, name)) {
if (!test_createuser(b, prep_mem_ctx, &h, name)) {
ret = false;
goto done;
}
@ -589,13 +591,13 @@ bool torture_modifyuser(struct torture_context *torture)
}
cleanup:
if (!test_cleanup(ctx->samr.pipe, torture, &ctx->samr.handle, name)) {
if (!test_cleanup(ctx->samr.pipe->binding_handle, torture, &ctx->samr.handle, name)) {
printf("cleanup failed\n");
ret = false;
goto done;
}
if (!test_samr_close(ctx->samr.pipe, torture, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, torture, &ctx->samr.handle)) {
printf("domain close failed\n");
ret = false;
}
@ -618,6 +620,7 @@ bool torture_userinfo_api(struct torture_context *torture)
struct policy_handle h;
struct lsa_String domain_name;
struct libnet_UserInfo req;
struct dcerpc_binding_handle *b;
prep_mem_ctx = talloc_init("prepare torture user info");
@ -630,14 +633,15 @@ bool torture_userinfo_api(struct torture_context *torture)
if (!NT_STATUS_IS_OK(status)) {
return false;
}
b = p->binding_handle;
domain_name.string = lp_workgroup(torture->lp_ctx);
if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) {
if (!test_opendomain(b, prep_mem_ctx, &h, &domain_name)) {
ret = false;
goto done;
}
if (!test_createuser(p, prep_mem_ctx, &h, name)) {
if (!test_createuser(b, prep_mem_ctx, &h, name)) {
ret = false;
goto done;
}
@ -657,13 +661,13 @@ bool torture_userinfo_api(struct torture_context *torture)
goto done;
}
if (!test_cleanup(ctx->samr.pipe, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) {
if (!test_cleanup(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle, TEST_USERNAME)) {
printf("cleanup failed\n");
ret = false;
goto done;
}
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
printf("domain close failed\n");
ret = false;
}
@ -720,13 +724,13 @@ bool torture_userlist(struct torture_context *torture)
goto done;
}
if (!test_samr_close(ctx->samr.pipe, mem_ctx, &ctx->samr.handle)) {
if (!test_samr_close(ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) {
printf("samr domain close failed\n");
ret = false;
goto done;
}
if (!test_lsa_close(ctx->lsa.pipe, mem_ctx, &ctx->lsa.handle)) {
if (!test_lsa_close(ctx->lsa.pipe->binding_handle, mem_ctx, &ctx->lsa.handle)) {
printf("lsa domain close failed\n");
ret = false;
}

View File

@ -29,7 +29,7 @@
bool test_opendomain(struct torture_context *tctx,
struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, struct lsa_String *domname,
struct dom_sid2 *sid_p)
{
@ -46,7 +46,7 @@ bool test_opendomain(struct torture_context *tctx,
r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r1.out.connect_handle = &h;
status = dcerpc_samr_Connect(p, mem_ctx, &r1);
status = dcerpc_samr_Connect_r(b, mem_ctx, &r1);
torture_assert_ntstatus_ok(tctx, status, "Connect failed");
r2.in.connect_handle = &h;
@ -55,7 +55,7 @@ bool test_opendomain(struct torture_context *tctx,
torture_comment(tctx, "domain lookup on %s\n", domname->string);
status = dcerpc_samr_LookupDomain(p, mem_ctx, &r2);
status = dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2);
torture_assert_ntstatus_ok(tctx, status, "LookupDomain failed");
r3.in.connect_handle = &h;
@ -65,7 +65,7 @@ bool test_opendomain(struct torture_context *tctx,
torture_comment(tctx, "opening domain\n");
status = dcerpc_samr_OpenDomain(p, mem_ctx, &r3);
status = dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3);
torture_assert_ntstatus_ok(tctx, status, "OpenDomain failed");
*handle = domain_handle;
@ -74,7 +74,8 @@ bool test_opendomain(struct torture_context *tctx,
}
bool test_user_cleanup(struct torture_context *tctx, struct dcerpc_pipe *p,
bool test_user_cleanup(struct torture_context *tctx,
struct dcerpc_binding_handle *b,
TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle,
const char *name)
{
@ -97,7 +98,7 @@ bool test_user_cleanup(struct torture_context *tctx, struct dcerpc_pipe *p,
torture_comment(tctx, "user account lookup '%s'\n", name);
status = dcerpc_samr_LookupNames(p, mem_ctx, &r1);
status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1);
torture_assert_ntstatus_ok(tctx, status, "LookupNames failed");
rid = r1.out.rids->ids[0];
@ -109,7 +110,7 @@ bool test_user_cleanup(struct torture_context *tctx, struct dcerpc_pipe *p,
torture_comment(tctx, "opening user account\n");
status = dcerpc_samr_OpenUser(p, mem_ctx, &r2);
status = dcerpc_samr_OpenUser_r(b, mem_ctx, &r2);
torture_assert_ntstatus_ok(tctx, status, "OpenUser failed");
r3.in.user_handle = &user_handle;
@ -117,7 +118,7 @@ bool test_user_cleanup(struct torture_context *tctx, struct dcerpc_pipe *p,
torture_comment(tctx, "deleting user account\n");
status = dcerpc_samr_DeleteUser(p, mem_ctx, &r3);
status = dcerpc_samr_DeleteUser_r(b, mem_ctx, &r3);
torture_assert_ntstatus_ok(tctx, status, "DeleteUser failed");
return true;
@ -125,7 +126,8 @@ bool test_user_cleanup(struct torture_context *tctx, struct dcerpc_pipe *p,
bool test_user_create(struct torture_context *tctx,
struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct dcerpc_binding_handle *b,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle, const char *name,
uint32_t *rid)
{
@ -144,19 +146,19 @@ bool test_user_create(struct torture_context *tctx,
torture_comment(tctx, "creating user account %s\n", name);
status = dcerpc_samr_CreateUser(p, mem_ctx, &r);
status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateUser failed - %s\n", nt_errstr(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
torture_comment(tctx, "User (%s) already exists - attempting to delete and recreate account again\n", name);
if (!test_user_cleanup(tctx, p, mem_ctx, handle, name)) {
if (!test_user_cleanup(tctx, b, mem_ctx, handle, name)) {
return false;
}
torture_comment(tctx, "creating user account\n");
status = dcerpc_samr_CreateUser(p, mem_ctx, &r);
status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r);
torture_assert_ntstatus_ok(tctx, status, "CreateUser failed");
return true;
}
@ -167,7 +169,7 @@ bool test_user_create(struct torture_context *tctx,
}
bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
bool test_group_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *domain_handle,
const char *name)
{
@ -190,7 +192,7 @@ bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("group account lookup '%s'\n", name);
status = dcerpc_samr_LookupNames(p, mem_ctx, &r1);
status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1);
if (!NT_STATUS_IS_OK(status)) {
printf("LookupNames failed - %s\n", nt_errstr(status));
return false;
@ -205,7 +207,7 @@ bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("opening group account\n");
status = dcerpc_samr_OpenGroup(p, mem_ctx, &r2);
status = dcerpc_samr_OpenGroup_r(b, mem_ctx, &r2);
if (!NT_STATUS_IS_OK(status)) {
printf("OpenGroup failed - %s\n", nt_errstr(status));
return false;
@ -216,7 +218,7 @@ bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("deleting group account\n");
status = dcerpc_samr_DeleteDomainGroup(p, mem_ctx, &r3);
status = dcerpc_samr_DeleteDomainGroup_r(b, mem_ctx, &r3);
if (!NT_STATUS_IS_OK(status)) {
printf("DeleteGroup failed - %s\n", nt_errstr(status));
return false;
@ -226,7 +228,7 @@ bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
bool test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
bool test_group_create(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, const char *name,
uint32_t *rid)
{
@ -245,19 +247,19 @@ bool test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("creating group account %s\n", name);
status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r);
status = dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateGroup failed - %s\n", nt_errstr(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
printf("Group (%s) already exists - attempting to delete and recreate account again\n", name);
if (!test_group_cleanup(p, mem_ctx, handle, name)) {
if (!test_group_cleanup(b, mem_ctx, handle, name)) {
return false;
}
printf("creating group account\n");
status = dcerpc_samr_CreateDomainGroup(p, mem_ctx, &r);
status = dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
printf("CreateGroup failed - %s\n", nt_errstr(status));
return false;