summaryrefslogtreecommitdiff
path: root/source4/torture/libnet
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r--source4/torture/libnet/domain.c2
-rw-r--r--source4/torture/libnet/groupinfo.c2
-rw-r--r--source4/torture/libnet/libnet_domain.c33
-rw-r--r--source4/torture/libnet/libnet_group.c2
-rw-r--r--source4/torture/libnet/libnet_lookup.c9
-rw-r--r--source4/torture/libnet/libnet_rpc.c27
-rw-r--r--source4/torture/libnet/libnet_share.c11
-rw-r--r--source4/torture/libnet/libnet_user.c13
-rw-r--r--source4/torture/libnet/userinfo.c2
-rw-r--r--source4/torture/libnet/userman.c6
10 files changed, 25 insertions, 82 deletions
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c
index 8eaca99dc9..17b8a94f42 100644
--- a/source4/torture/libnet/domain.c
+++ b/source4/torture/libnet/domain.c
@@ -72,7 +72,6 @@ static BOOL test_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL torture_domainopen(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct libnet_context *net_ctx;
struct event_context *evt_ctx;
TALLOC_CTX *mem_ctx;
@@ -81,7 +80,6 @@ BOOL torture_domainopen(struct torture_context *torture)
struct lsa_String name;
mem_ctx = talloc_init("test_domain_open");
- binding = torture_setting_string(torture, "binding", NULL);
evt_ctx = event_context_find(torture);
net_ctx = libnet_context_init(evt_ctx);
diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c
index 6e02d4f05d..0dca1519de 100644
--- a/source4/torture/libnet/groupinfo.c
+++ b/source4/torture/libnet/groupinfo.c
@@ -223,7 +223,6 @@ static BOOL test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL torture_groupinfo(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_pipe *p;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
@@ -233,7 +232,6 @@ BOOL torture_groupinfo(struct torture_context *torture)
uint32_t rid;
mem_ctx = talloc_init("test_userinfo");
- binding = torture_setting_string(torture, "binding", NULL);
status = torture_rpc_connection(torture,
&p,
diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c
index 915054bf50..675ab9f099 100644
--- a/source4/torture/libnet/libnet_domain.c
+++ b/source4/torture/libnet/libnet_domain.c
@@ -179,17 +179,14 @@ BOOL torture_domain_close_lsa(struct torture_context *torture)
struct libnet_context *ctx;
struct lsa_String domain_name;
struct dcerpc_binding *binding;
- const char *bindstr;
uint32_t access_mask;
struct policy_handle h;
struct dcerpc_pipe *p;
struct libnet_DomainClose r;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
- return False;
+ return false;
}
ctx = libnet_context_init(NULL);
@@ -202,11 +199,10 @@ BOOL torture_domain_close_lsa(struct torture_context *torture)
ctx->cred = cmdline_credentials;
mem_ctx = talloc_init("torture_domain_close_lsa");
- status = dcerpc_pipe_connect(mem_ctx, &p, bindstr, &ndr_table_lsarpc,
+ status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc,
cmdline_credentials, NULL);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to connect to server %s: %s\n", bindstr,
- nt_errstr(status));
+ d_printf("failed to connect to server: %s\n", nt_errstr(status));
ret = False;
goto done;
}
@@ -247,7 +243,6 @@ done:
BOOL torture_domain_open_samr(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct libnet_context *ctx;
struct event_context *evt_ctx=NULL;
TALLOC_CTX *mem_ctx;
@@ -258,7 +253,6 @@ BOOL torture_domain_open_samr(struct torture_context *torture)
BOOL ret = True;
mem_ctx = talloc_init("test_domainopen_lsa");
- binding = torture_setting_string(torture, "binding", NULL);
ctx = libnet_context_init(evt_ctx);
ctx->cred = cmdline_credentials;
@@ -314,18 +308,15 @@ BOOL torture_domain_close_samr(struct torture_context *torture)
struct libnet_context *ctx;
struct lsa_String domain_name;
struct dcerpc_binding *binding;
- const char *bindstr;
uint32_t access_mask;
struct policy_handle h;
struct dcerpc_pipe *p;
struct libnet_DomainClose r;
struct dom_sid *sid;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
- return False;
+ return false;
}
ctx = libnet_context_init(NULL);
@@ -338,11 +329,10 @@ BOOL torture_domain_close_samr(struct torture_context *torture)
ctx->cred = cmdline_credentials;
mem_ctx = talloc_init("torture_domain_close_samr");
- status = dcerpc_pipe_connect(mem_ctx, &p, bindstr, &ndr_table_samr,
+ status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr,
ctx->cred, NULL);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to connect to server %s: %s\n", bindstr,
- nt_errstr(status));
+ d_printf("failed to connect to server: %s\n", nt_errstr(status));
ret = False;
goto done;
}
@@ -387,17 +377,14 @@ BOOL torture_domain_list(struct torture_context *torture)
BOOL ret = True;
NTSTATUS status;
TALLOC_CTX *mem_ctx = NULL;
- const char *bindstr;
struct dcerpc_binding *binding;
struct libnet_context *ctx;
struct libnet_DomainList r;
int i;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
- return False;
+ return false;
}
ctx = libnet_context_init(NULL);
diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c
index db2952e226..1f4725d6dd 100644
--- a/source4/torture/libnet/libnet_group.c
+++ b/source4/torture/libnet/libnet_group.c
@@ -204,7 +204,6 @@ static BOOL test_samr_close(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL torture_groupinfo_api(struct torture_context *torture)
{
const char *name = TEST_GROUPNAME;
- const char *binding;
BOOL ret = True;
NTSTATUS status;
TALLOC_CTX *mem_ctx = NULL, *prep_mem_ctx;
@@ -215,7 +214,6 @@ BOOL torture_groupinfo_api(struct torture_context *torture)
struct libnet_GroupInfo req;
prep_mem_ctx = talloc_init("prepare torture group info");
- binding = torture_setting_string(torture, "binding", NULL);
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c
index d4251bbdee..b48f7e7bac 100644
--- a/source4/torture/libnet/libnet_lookup.c
+++ b/source4/torture/libnet/libnet_lookup.c
@@ -24,6 +24,7 @@
#include "librpc/gen_ndr/nbt.h"
#include "librpc/rpc/dcerpc.h"
#include "libcli/libcli.h"
+#include "torture/rpc/rpc.h"
#include "torture/torture.h"
@@ -35,7 +36,6 @@ BOOL torture_lookup(struct torture_context *torture)
struct libnet_context *ctx;
struct libnet_Lookup lookup;
struct dcerpc_binding *bind;
- const char *bindstr;
mem_ctx = talloc_init("test_lookup");
@@ -44,8 +44,7 @@ BOOL torture_lookup(struct torture_context *torture)
lookup.in.hostname = torture_setting_string(torture, "host", NULL);
if (lookup.in.hostname == NULL) {
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(mem_ctx, bindstr, &bind);
+ status = torture_rpc_binding(torture, &bind);
if (NT_STATUS_IS_OK(status)) {
lookup.in.hostname = bind->host;
}
@@ -81,7 +80,6 @@ BOOL torture_lookup_host(struct torture_context *torture)
struct libnet_context *ctx;
struct libnet_Lookup lookup;
struct dcerpc_binding *bind;
- const char *bindstr;
mem_ctx = talloc_init("test_lookup_host");
@@ -90,8 +88,7 @@ BOOL torture_lookup_host(struct torture_context *torture)
lookup.in.hostname = torture_setting_string(torture, "host", NULL);
if (lookup.in.hostname == NULL) {
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(mem_ctx, bindstr, &bind);
+ status = torture_rpc_binding(torture, &bind);
if (NT_STATUS_IS_OK(status)) {
lookup.in.hostname = bind->host;
}
diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c
index d751a8e423..07c586ebf3 100644
--- a/source4/torture/libnet/libnet_rpc.c
+++ b/source4/torture/libnet/libnet_rpc.c
@@ -28,6 +28,7 @@
#include "librpc/gen_ndr/ndr_samr.h"
#include "librpc/gen_ndr/ndr_srvsvc.h"
#include "librpc/rpc/dcerpc.h"
+#include "torture/rpc/rpc.h"
#include "torture/torture.h"
@@ -136,12 +137,9 @@ BOOL torture_rpc_connect_srv(struct torture_context *torture)
const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_SERVER;
NTSTATUS status;
struct dcerpc_binding *binding;
- const char *bindstr;;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
return False;
}
@@ -154,13 +152,10 @@ BOOL torture_rpc_connect_pdc(struct torture_context *torture)
const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_PDC;
NTSTATUS status;
struct dcerpc_binding *binding;
- const char *bindstr;
const char *domain_name;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
return False;
}
@@ -177,13 +172,10 @@ BOOL torture_rpc_connect_dc(struct torture_context *torture)
const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_DC;
NTSTATUS status;
struct dcerpc_binding *binding;
- const char *bindstr;
const char *domain_name;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
return False;
}
@@ -200,13 +192,10 @@ BOOL torture_rpc_connect_dc_info(struct torture_context *torture)
const enum libnet_RpcConnect_level level = LIBNET_RPC_CONNECT_DC_INFO;
NTSTATUS status;
struct dcerpc_binding *binding;
- const char *bindstr;
const char *domain_name;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
return False;
}
@@ -225,12 +214,12 @@ BOOL torture_rpc_connect_binding(struct torture_context *torture)
struct dcerpc_binding *binding;
const char *bindstr;
- bindstr = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(torture, bindstr, &binding);
+ status = torture_rpc_binding(torture, &binding);
if (!NT_STATUS_IS_OK(status)) {
- d_printf("failed to parse binding string\n");
return False;
}
+ bindstr = dcerpc_binding_string(torture, binding);
+
return torture_rpc_connect(torture, level, bindstr, NULL);
}
diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c
index a4d94a6b9c..b6b0b37d01 100644
--- a/source4/torture/libnet/libnet_share.c
+++ b/source4/torture/libnet/libnet_share.c
@@ -121,15 +121,12 @@ BOOL torture_listshares(struct torture_context *torture)
int i;
BOOL ret = True;
struct libnet_context* libnetctx;
- const char *binding;
struct dcerpc_binding *bind;
TALLOC_CTX *mem_ctx;
mem_ctx = talloc_init("test_listshares");
- binding = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(mem_ctx, binding, &bind);
+ status = torture_rpc_binding(torture, &bind);
if (!NT_STATUS_IS_OK(status)) {
- printf("Error while parsing the binding string\n");
ret = False;
goto done;
}
@@ -203,7 +200,7 @@ BOOL torture_delshare(struct torture_context *torture)
struct dcerpc_pipe *p;
struct dcerpc_binding *bind;
struct libnet_context* libnetctx;
- const char *host, *binding;
+ const char *host;
TALLOC_CTX *mem_ctx;
NTSTATUS status;
BOOL ret = True;
@@ -211,10 +208,8 @@ BOOL torture_delshare(struct torture_context *torture)
mem_ctx = talloc_init("test_listshares");
host = torture_setting_string(torture, "host", NULL);
- binding = torture_setting_string(torture, "binding", NULL);
- status = dcerpc_parse_binding(mem_ctx, binding, &bind);
+ status = torture_rpc_binding(torture, &bind);
if (!NT_STATUS_IS_OK(status)) {
- printf("Error while parsing the binding string\n");
ret = False;
goto done;
}
diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c
index f3371e07a7..7a3b9f19c1 100644
--- a/source4/torture/libnet/libnet_user.c
+++ b/source4/torture/libnet/libnet_user.c
@@ -233,14 +233,12 @@ static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL torture_createuser(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
TALLOC_CTX *mem_ctx;
struct libnet_context *ctx;
struct libnet_CreateUser req;
BOOL ret = True;
mem_ctx = talloc_init("test_createuser");
- binding = torture_setting_string(torture, "binding", NULL);
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
@@ -277,7 +275,6 @@ done:
BOOL torture_deleteuser(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_pipe *p;
TALLOC_CTX *prep_mem_ctx, *mem_ctx;
struct policy_handle h;
@@ -288,7 +285,6 @@ BOOL torture_deleteuser(struct torture_context *torture)
BOOL ret = True;
prep_mem_ctx = talloc_init("prepare test_deleteuser");
- binding = torture_setting_string(torture, "binding", NULL);
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
@@ -464,7 +460,6 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r,
BOOL torture_modifyuser(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_binding *bind;
struct dcerpc_pipe *p;
TALLOC_CTX *prep_mem_ctx, *mem_ctx;
@@ -478,7 +473,6 @@ BOOL torture_modifyuser(struct torture_context *torture)
BOOL ret = True;
prep_mem_ctx = talloc_init("prepare test_deleteuser");
- binding = torture_setting_string(torture, "binding", NULL);
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
@@ -506,7 +500,7 @@ BOOL torture_modifyuser(struct torture_context *torture)
mem_ctx = talloc_init("test_modifyuser");
- status = dcerpc_parse_binding(mem_ctx, binding, &bind);
+ status = torture_rpc_binding(mem_ctx, &bind);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
goto done;
@@ -608,7 +602,6 @@ done:
BOOL torture_userinfo_api(struct torture_context *torture)
{
const char *name = TEST_USERNAME;
- const char *binding;
BOOL ret = True;
NTSTATUS status;
TALLOC_CTX *mem_ctx = NULL, *prep_mem_ctx;
@@ -619,7 +612,6 @@ BOOL torture_userinfo_api(struct torture_context *torture)
struct libnet_UserInfo req;
prep_mem_ctx = talloc_init("prepare torture user info");
- binding = torture_setting_string(torture, "binding", NULL);
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
@@ -678,7 +670,6 @@ done:
BOOL torture_userlist(struct torture_context *torture)
{
- const char *binding;
BOOL ret = True;
NTSTATUS status;
TALLOC_CTX *mem_ctx = NULL;
@@ -687,8 +678,6 @@ BOOL torture_userlist(struct torture_context *torture)
struct libnet_UserList req;
int i;
- binding = torture_setting_string(torture, "binding", NULL);
-
ctx = libnet_context_init(NULL);
ctx->cred = cmdline_credentials;
diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c
index a1603b4bfc..ad35e84861 100644
--- a/source4/torture/libnet/userinfo.c
+++ b/source4/torture/libnet/userinfo.c
@@ -302,7 +302,6 @@ static BOOL test_userinfo_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL torture_userinfo(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_pipe *p;
TALLOC_CTX *mem_ctx;
BOOL ret = True;
@@ -312,7 +311,6 @@ BOOL torture_userinfo(struct torture_context *torture)
uint32_t rid;
mem_ctx = talloc_init("test_userinfo");
- binding = torture_setting_string(torture, "binding", NULL);
status = torture_rpc_connection(torture,
&p,
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c
index d70fb0bc77..90b3f41959 100644
--- a/source4/torture/libnet/userman.c
+++ b/source4/torture/libnet/userman.c
@@ -478,7 +478,6 @@ static BOOL test_compare(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL torture_useradd(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_pipe *p;
struct policy_handle h;
struct lsa_String domain_name;
@@ -487,7 +486,6 @@ BOOL torture_useradd(struct torture_context *torture)
BOOL ret = True;
mem_ctx = talloc_init("test_useradd");
- binding = torture_setting_string(torture, "binding", NULL);
status = torture_rpc_connection(torture,
&p,
@@ -537,7 +535,6 @@ done:
BOOL torture_userdel(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_pipe *p;
struct policy_handle h;
struct lsa_String domain_name;
@@ -546,7 +543,6 @@ BOOL torture_userdel(struct torture_context *torture)
BOOL ret = True;
mem_ctx = talloc_init("test_userdel");
- binding = torture_setting_string(torture, "binding", NULL);
status = torture_rpc_connection(torture,
&p,
@@ -581,7 +577,6 @@ done:
BOOL torture_usermod(struct torture_context *torture)
{
NTSTATUS status;
- const char *binding;
struct dcerpc_pipe *p;
struct policy_handle h;
struct lsa_String domain_name;
@@ -591,7 +586,6 @@ BOOL torture_usermod(struct torture_context *torture)
BOOL ret = True;
mem_ctx = talloc_init("test_userdel");
- binding = torture_setting_string(torture, "binding", NULL);
status = torture_rpc_connection(torture,
&p,