summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/auth/pac.c34
-rw-r--r--source4/torture/basic/base.c18
-rw-r--r--source4/torture/basic/utable.c6
-rw-r--r--source4/torture/config.mk18
-rw-r--r--source4/torture/rap/rap.c43
-rw-r--r--source4/torture/raw/composite.c1
-rw-r--r--source4/torture/raw/oplock.c5
-rw-r--r--source4/torture/rpc/initshutdown.c13
-rw-r--r--source4/torture/rpc/netlogon.c2
-rw-r--r--source4/torture/rpc/samba3rpc.c104
-rw-r--r--source4/torture/rpc/samlogon.c15
-rw-r--r--source4/torture/rpc/samsync.c13
-rw-r--r--source4/torture/rpc/schannel.c2
-rw-r--r--source4/torture/rpc/winreg.c15
-rw-r--r--source4/torture/smbtorture.c2
15 files changed, 167 insertions, 124 deletions
diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c
index efb36e3ef8..68bbd3483a 100644
--- a/source4/torture/auth/pac.c
+++ b/source4/torture/auth/pac.c
@@ -112,7 +112,9 @@ static bool torture_pac_self_check(struct torture_context *tctx)
}
/* OK, go ahead and make a PAC */
- ret = kerberos_create_pac(mem_ctx, server_info,
+ ret = kerberos_create_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ server_info,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
&server_keyblock,
@@ -137,7 +139,9 @@ static bool torture_pac_self_check(struct torture_context *tctx)
dump_data(10,tmp_blob.data,tmp_blob.length);
/* Now check that we can read it back */
- nt_status = kerberos_decode_pac(mem_ctx, &pac_data,
+ nt_status = kerberos_decode_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &pac_data,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -159,7 +163,9 @@ static bool torture_pac_self_check(struct torture_context *tctx)
}
/* Now check that we can read it back */
- nt_status = kerberos_pac_logon_info(mem_ctx, &logon_info,
+ nt_status = kerberos_pac_logon_info(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &logon_info,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -367,7 +373,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
}
/* Decode and verify the signaure on the PAC */
- nt_status = kerberos_decode_pac(mem_ctx, &pac_data,
+ nt_status = kerberos_decode_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &pac_data,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -386,7 +394,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
}
/* Parse the PAC again, for the logon info this time */
- nt_status = kerberos_pac_logon_info(mem_ctx, &logon_info,
+ nt_status = kerberos_pac_logon_info(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &logon_info,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -442,6 +452,7 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
}
ret = kerberos_encode_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
pac_data,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -493,6 +504,7 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
}
ret = kerberos_create_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
server_info_out,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -565,7 +577,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
}
/* Break the auth time, to ensure we check this vital detail (not setting this caused all the pain in the first place... */
- nt_status = kerberos_decode_pac(mem_ctx, &pac_data,
+ nt_status = kerberos_decode_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &pac_data,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -601,7 +615,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
smb_get_krb5_error_message(smb_krb5_context->krb5_context, ret, mem_ctx)));
}
- nt_status = kerberos_decode_pac(mem_ctx, &pac_data,
+ nt_status = kerberos_decode_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &pac_data,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
@@ -619,7 +635,9 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
/* Finally... Bugger up the signature, and check we fail the checksum */
tmp_blob.data[tmp_blob.length - 2]++;
- nt_status = kerberos_decode_pac(mem_ctx, &pac_data,
+ nt_status = kerberos_decode_pac(mem_ctx,
+ lp_iconv_convenience(tctx->lp_ctx),
+ &pac_data,
tmp_blob,
smb_krb5_context->krb5_context,
&krbtgt_keyblock,
diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
index aa729ec0df..42d7ddaaa1 100644
--- a/source4/torture/basic/base.c
+++ b/source4/torture/basic/base.c
@@ -633,6 +633,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
int retries=4;
int i = 0;
bool correct = true;
+ int nsec;
+ int msec;
+ double sec;
+
+ nsec = torture_setting_int(tctx, "sharedelay", 1000000);
+ msec = nsec / 1000;
+ sec = ((double)nsec) / ((double) 1000000);
if (retries <= 0) {
torture_comment(tctx, "failed to connect\n");
@@ -657,9 +664,10 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
}
if (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
double e = timeval_elapsed(&tv);
- if (e < 0.5 || e > 1.5) {
- torture_comment(tctx,"Timing incorrect %.2f violation\n",
- e);
+ if (e < (0.5 * sec) || e > (1.5 * sec)) {
+ torture_comment(tctx,"Timing incorrect %.2f violation 1 sec == %.2f\n",
+ e, sec);
+ return false;
}
}
} while (NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION));
@@ -671,13 +679,13 @@ static bool run_deferopen(struct torture_context *tctx, struct smbcli_state *cli
torture_comment(tctx, "pid %u open %d\n", (unsigned)getpid(), i);
- sleep(10);
+ msleep(10 * msec);
i++;
if (NT_STATUS_IS_ERR(smbcli_close(cli->tree, fnum))) {
torture_comment(tctx,"Failed to close %s, error=%s\n", fname, smbcli_errstr(cli->tree));
return false;
}
- sleep(2);
+ msleep(2 * msec);
}
if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c
index 112cf323a1..2b222d7c6e 100644
--- a/source4/torture/basic/utable.c
+++ b/source4/torture/basic/utable.c
@@ -98,7 +98,7 @@ bool torture_utable(struct torture_context *tctx,
}
-static char *form_name(int c)
+static char *form_name(struct smb_iconv_convenience *iconv_convenience, int c)
{
static fstring fname;
uint8_t c2[4];
@@ -109,7 +109,7 @@ static char *form_name(int c)
p = fname+strlen(fname);
SSVAL(c2, 0, c);
- len = convert_string(lp_iconv_convenience(global_loadparm), CH_UTF16, CH_UNIX,
+ len = convert_string(iconv_convenience, CH_UTF16, CH_UNIX,
c2, 2,
p, sizeof(fname)-strlen(fname));
p[len] = 0;
@@ -139,7 +139,7 @@ bool torture_casetable(struct torture_context *tctx,
torture_comment(tctx, "%04x (%c)\n", c, isprint(c)?c:'.');
- fname = form_name(c);
+ fname = form_name(lp_iconv_convenience(tctx->lp_ctx), c);
fnum = smbcli_nt_create_full(cli->tree, fname, 0,
#if 0
SEC_RIGHT_MAXIMUM_ALLOWED,
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index a1975a6caf..626349a45d 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -11,7 +11,8 @@ OBJ_FILES = \
PUBLIC_DEPENDENCIES = \
LIBSAMBA-CONFIG \
LIBSAMBA-UTIL \
- LIBTALLOC
+ LIBTALLOC \
+ LIBPOPT
[SUBSYSTEM::TORTURE_UTIL]
OBJ_FILES = util_smb.o util_provision.o
@@ -369,21 +370,14 @@ MANPAGE = man/locktest.1
# End BINARY locktest
#################################
-GCOV_CFLAGS = -ftest-coverage -fprofile-arcs
-GCOV_LDFLAGS = $(GCOV_CFLAGS) -lgcov
-
COV_TARGET = test
COV_VARS = \
- CFLAGS="$(CFLAGS) $(GCOV_CFLAGS)" \
- BNLD_FLAGS="$(BNLD_FLAGS) $(GCOV_LDFLAGS)" \
- SHLD_FLAGS="$(SHLD_FLAGS) $(GCOV_LDFLAGS)" \
- MDLD_FLAGS="$(MDLD_FLAGS) $(GCOV_LDFLAGS)" \
- HOSTCC_FLAGS="$(HOSTCC_FLAGS) $(GCOV_CFLAGS)" \
- HOSTLD_FLAGS="$(HOSTLD_FLAGS) $(GCOV_LDFLAGS)"
+ CFLAGS="$(CFLAGS) --coverage" \
+ LDFLAGS="$(LDFLAGS) --coverage"
test_cov:
- @$(MAKE) $(COV_TARGET) $(COV_VARS)
+ -$(MAKE) $(COV_TARGET) $(COV_VARS)
gcov: test_cov
for I in $(sort $(dir $(ALL_OBJS))); \
@@ -395,10 +389,12 @@ lcov-split:
@$(MAKE) $(COV_TARGET) $(COV_VARS) \
TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\""
-rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
+ -rm lib/policy/*/{lex,parse}.{gcda,gcno}
genhtml -o coverage samba.info
lcov: test_cov
-rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
+ -rm lib/policy/*/{lex,parse}.{gcda,gcno}
lcov --base-directory `pwd` --directory . --capture --output-file samba.info
genhtml -o coverage samba.info
diff --git a/source4/torture/rap/rap.c b/source4/torture/rap/rap.c
index 71689786e8..edc74ee23e 100644
--- a/source4/torture/rap/rap.c
+++ b/source4/torture/rap/rap.c
@@ -73,7 +73,7 @@ struct rap_call {
#define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
-static struct rap_call *new_rap_cli_call(TALLOC_CTX *mem_ctx, uint16_t callno)
+static struct rap_call *new_rap_cli_call(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint16_t callno)
{
struct rap_call *call;
@@ -88,10 +88,10 @@ static struct rap_call *new_rap_cli_call(TALLOC_CTX *mem_ctx, uint16_t callno)
call->paramdesc = NULL;
call->datadesc = NULL;
- call->ndr_push_param = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+ call->ndr_push_param = ndr_push_init_ctx(mem_ctx, iconv_convenience);
call->ndr_push_param->flags = RAPNDR_FLAGS;
- call->ndr_push_data = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+ call->ndr_push_data = ndr_push_init_ctx(mem_ctx, iconv_convenience);
call->ndr_push_data->flags = RAPNDR_FLAGS;
return call;
@@ -189,14 +189,16 @@ static NTSTATUS rap_pull_string(TALLOC_CTX *mem_ctx, struct ndr_pull *ndr,
return NT_STATUS_OK;
}
-static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
+static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree,
+ struct smb_iconv_convenience *iconv_convenience,
+ struct rap_call *call)
{
NTSTATUS result;
DATA_BLOB param_blob;
struct ndr_push *params;
struct smb_trans2 trans;
- params = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+ params = ndr_push_init_ctx(call, iconv_convenience);
if (params == NULL)
return NT_STATUS_NO_MEMORY;
@@ -231,11 +233,11 @@ static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
return result;
call->ndr_pull_param = ndr_pull_init_blob(&trans.out.params, call,
- lp_iconv_convenience(global_loadparm));
+ iconv_convenience);
call->ndr_pull_param->flags = RAPNDR_FLAGS;
call->ndr_pull_data = ndr_pull_init_blob(&trans.out.data, call,
- lp_iconv_convenience(global_loadparm));
+ iconv_convenience);
call->ndr_pull_data->flags = RAPNDR_FLAGS;
return result;
@@ -243,6 +245,7 @@ static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
+ struct smb_iconv_convenience *iconv_convenience,
TALLOC_CTX *mem_ctx,
struct rap_NetShareEnum *r)
{
@@ -250,7 +253,7 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
int i;
- call = new_rap_cli_call(tree, RAP_WshareEnum);
+ call = new_rap_cli_call(tree, iconv_convenience, RAP_WshareEnum);
if (call == NULL)
return NT_STATUS_NO_MEMORY;
@@ -268,7 +271,7 @@ static NTSTATUS smbcli_rap_netshareenum(struct smbcli_tree *tree,
break;
}
- result = rap_cli_do_call(tree, call);
+ result = rap_cli_do_call(tree, iconv_convenience, call);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -322,7 +325,7 @@ static bool test_netshareenum(struct torture_context *tctx,
r.in.bufsize = 8192;
torture_assert_ntstatus_ok(tctx,
- smbcli_rap_netshareenum(cli->tree, tctx, &r), "");
+ smbcli_rap_netshareenum(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), "");
for (i=0; i<r.out.count; i++) {
printf("%s %d %s\n", r.out.info[i].info1.name,
@@ -334,6 +337,7 @@ static bool test_netshareenum(struct torture_context *tctx,
}
static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_tree *tree,
+ struct smb_iconv_convenience *iconv_convenience,
TALLOC_CTX *mem_ctx,
struct rap_NetServerEnum2 *r)
{
@@ -341,7 +345,7 @@ static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_tree *tree,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
int i;
- call = new_rap_cli_call(mem_ctx, RAP_NetServerEnum2);
+ call = new_rap_cli_call(mem_ctx, iconv_convenience, RAP_NetServerEnum2);
if (call == NULL)
return NT_STATUS_NO_MEMORY;
@@ -361,7 +365,7 @@ static NTSTATUS smbcli_rap_netserverenum2(struct smbcli_tree *tree,
break;
}
- result = rap_cli_do_call(tree, call);
+ result = rap_cli_do_call(tree, iconv_convenience, call);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -421,7 +425,7 @@ static bool test_netserverenum(struct torture_context *tctx,
r.in.domain = NULL;
torture_assert_ntstatus_ok(tctx,
- smbcli_rap_netserverenum2(cli->tree, tctx, &r), "");
+ smbcli_rap_netserverenum2(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), "");
for (i=0; i<r.out.count; i++) {
switch (r.in.level) {
@@ -440,13 +444,14 @@ static bool test_netserverenum(struct torture_context *tctx,
}
_PUBLIC_ NTSTATUS smbcli_rap_netservergetinfo(struct smbcli_tree *tree,
+ struct smb_iconv_convenience *iconv_convenience,
TALLOC_CTX *mem_ctx,
struct rap_WserverGetInfo *r)
{
struct rap_call *call;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- if (!(call = new_rap_cli_call(mem_ctx, RAP_WserverGetInfo))) {
+ if (!(call = new_rap_cli_call(mem_ctx, iconv_convenience, RAP_WserverGetInfo))) {
return NT_STATUS_NO_MEMORY;
}
@@ -466,7 +471,7 @@ _PUBLIC_ NTSTATUS smbcli_rap_netservergetinfo(struct smbcli_tree *tree,
goto done;
}
- result = rap_cli_do_call(tree, call);
+ result = rap_cli_do_call(tree, iconv_convenience, call);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -507,9 +512,9 @@ static bool test_netservergetinfo(struct torture_context *tctx,
r.in.bufsize = 0xffff;
r.in.level = 0;
- torture_assert_ntstatus_ok(tctx, smbcli_rap_netservergetinfo(cli->tree, tctx, &r), "");
+ torture_assert_ntstatus_ok(tctx, smbcli_rap_netservergetinfo(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), "");
r.in.level = 1;
- torture_assert_ntstatus_ok(tctx, smbcli_rap_netservergetinfo(cli->tree, tctx, &r), "");
+ torture_assert_ntstatus_ok(tctx, smbcli_rap_netservergetinfo(cli->tree, lp_iconv_convenience(tctx->lp_ctx), tctx, &r), "");
return res;
}
@@ -519,10 +524,10 @@ bool torture_rap_scan(struct torture_context *torture, struct smbcli_state *cli)
int callno;
for (callno = 0; callno < 0xffff; callno++) {
- struct rap_call *call = new_rap_cli_call(torture, callno);
+ struct rap_call *call = new_rap_cli_call(torture, lp_iconv_convenience(torture->lp_ctx), callno);
NTSTATUS result;
- result = rap_cli_do_call(cli->tree, call);
+ result = rap_cli_do_call(cli->tree, lp_iconv_convenience(torture->lp_ctx), call);
if (!NT_STATUS_EQUAL(result, NT_STATUS_INVALID_PARAMETER))
continue;
diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c
index 0367110ddc..7238a2fd46 100644
--- a/source4/torture/raw/composite.c
+++ b/source4/torture/raw/composite.c
@@ -161,6 +161,7 @@ static bool test_fetchfile(struct smbcli_state *cli, struct torture_context *tct
io2.in.credentials = cmdline_credentials;
io2.in.workgroup = lp_workgroup(tctx->lp_ctx);
io2.in.filename = fname;
+ lp_smbcli_options(tctx->lp_ctx, &io2.in.options);
printf("testing parallel fetchfile with %d ops\n", torture_numops);
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 952088e46c..3edd0c6820 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -914,7 +914,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, 0);
- smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_levelII, cli1->tree);
+ smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_levelII, cli2->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -1058,7 +1058,7 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_
bool ret = true;
union smb_open io;
union smb_setfileinfo sfi;
- uint16_t fnum=0, fnum2=0;
+ uint16_t fnum=0;
if (!torture_setup_dir(cli1, BASEDIR)) {
return false;
@@ -1118,7 +1118,6 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_
CHECK_VAL(break_info.level, 0);
smbcli_close(cli1->tree, fnum);
- smbcli_close(cli2->tree, fnum2);
done:
smb_raw_exit(cli1->session);
diff --git a/source4/torture/rpc/initshutdown.c b/source4/torture/rpc/initshutdown.c
index 9f6f1735ee..92fec5be0c 100644
--- a/source4/torture/rpc/initshutdown.c
+++ b/source4/torture/rpc/initshutdown.c
@@ -24,10 +24,9 @@
#include "librpc/gen_ndr/ndr_initshutdown_c.h"
#include "torture/rpc/rpc.h"
-static void init_initshutdown_String(TALLOC_CTX *mem_ctx, struct initshutdown_String *name, const char *s)
+static void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s)
{
- name->name = talloc(mem_ctx, struct initshutdown_String_sub);
- name->name->name = s;
+ name->string = s;
}
@@ -58,8 +57,8 @@ static bool test_Init(struct torture_context *tctx,
uint16_t hostname = 0x0;
r.in.hostname = &hostname;
- r.in.message = talloc(tctx, struct initshutdown_String);
- init_initshutdown_String(tctx, r.in.message, "spottyfood");
+ r.in.message = talloc(tctx, struct lsa_StringLarge);
+ init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
r.in.reboot = 1;
@@ -80,8 +79,8 @@ static bool test_InitEx(struct torture_context *tctx,
uint16_t hostname = 0x0;
r.in.hostname = &hostname;
- r.in.message = talloc(tctx, struct initshutdown_String);
- init_initshutdown_String(tctx, r.in.message, "spottyfood");
+ r.in.message = talloc(tctx, struct lsa_StringLarge);
+ init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
r.in.reboot = 1;
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index a13172b695..5b92ce1382 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -532,7 +532,7 @@ bool test_netlogon_ops(struct dcerpc_pipe *p, struct torture_context *tctx,
chal = data_blob_const(ninfo.challenge,
sizeof(ninfo.challenge));
- names_blob = NTLMv2_generate_names_blob(tctx, cli_credentials_get_workstation(credentials),
+ names_blob = NTLMv2_generate_names_blob(tctx, lp_iconv_convenience(tctx->lp_ctx), cli_credentials_get_workstation(credentials),
cli_credentials_get_domain(credentials));
status = cli_credentials_get_ntlm_response(cmdline_credentials, tctx,
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index b08cd05bdb..95252e7397 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -806,6 +806,7 @@ static bool join3(struct smbcli_state *cli,
*/
static bool auth2(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
struct cli_credentials *wks_cred)
{
TALLOC_CTX *mem_ctx;
@@ -829,7 +830,7 @@ static bool auth2(struct smbcli_state *cli,
net_pipe = dcerpc_pipe_init(mem_ctx,
cli->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm));
+ lp_iconv_convenience(lp_ctx));
if (net_pipe == NULL) {
d_printf("dcerpc_pipe_init failed\n");
goto done;
@@ -984,7 +985,8 @@ static bool schan(struct smbcli_state *cli,
generate_random_buffer(chal.data, chal.length);
names_blob = NTLMv2_generate_names_blob(
- mem_ctx, cli_credentials_get_workstation(user_creds),
+ mem_ctx, lp_iconv_convenience(lp_ctx),
+ cli_credentials_get_workstation(user_creds),
cli_credentials_get_domain(user_creds));
status = cli_credentials_get_ntlm_response(
user_creds, mem_ctx, &flags, chal, names_blob,
@@ -1204,7 +1206,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
int j;
- if (!auth2(cli, wks_creds)) {
+ if (!auth2(cli, torture->lp_ctx, wks_creds)) {
d_printf("auth2 failed\n");
goto done;
}
@@ -1283,7 +1285,7 @@ static bool test_join3(struct torture_context *tctx,
cmdline_credentials, cli_credentials_get_domain(wks_creds),
CRED_SPECIFIED);
- if (!auth2(cli, wks_creds)) {
+ if (!auth2(cli, tctx->lp_ctx, wks_creds)) {
d_printf("auth2 failed\n");
goto done;
}
@@ -1381,6 +1383,7 @@ bool torture_samba3_sessionkey(struct torture_context *torture)
*/
static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_tree *tree,
const char *pipe_name,
const struct ndr_interface_table *iface,
@@ -1391,7 +1394,7 @@ static NTSTATUS pipe_bind_smb(TALLOC_CTX *mem_ctx,
if (!(result = dcerpc_pipe_init(
mem_ctx, tree->session->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm)))) {
+ lp_iconv_convenience(lp_ctx)))) {
return NT_STATUS_NO_MEMORY;
}
@@ -1507,7 +1510,9 @@ static struct dom_sid *name2sid(TALLOC_CTX *mem_ctx,
* Find out the user SID on this connection
*/
-static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree)
+static struct dom_sid *whoami(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
+ struct smbcli_tree *tree)
{
struct dcerpc_pipe *lsa;
struct lsa_GetUserName r;
@@ -1515,7 +1520,7 @@ static struct dom_sid *whoami(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree)
struct lsa_StringPointer authority_name_p;
struct dom_sid *result;
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\lsarpc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\lsarpc",
&ndr_table_lsarpc, &lsa);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) Could not bind to LSA: %s\n",
@@ -1631,7 +1636,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("(%s) whoami on auth'ed connection failed\n",
__location__);
ret = false;
@@ -1658,7 +1663,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("(%s) whoami on anon connection failed\n",
__location__);
ret = false;
@@ -1732,7 +1737,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
goto done;
}
- if (!(user_sid = whoami(mem_ctx, tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, tree))) {
d_printf("(%s) whoami on user connection failed\n",
__location__);
ret = false;
@@ -1870,8 +1875,8 @@ bool torture_samba3_rpc_srvsvc(struct torture_context *torture)
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\pipe\\srvsvc",
- &ndr_table_srvsvc, &p);
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree,
+ "\\pipe\\srvsvc", &ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
__location__, nt_errstr(status));
@@ -2007,6 +2012,7 @@ bool torture_samba3_rpc_randomauth2(struct torture_context *torture)
}
static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_session *sess,
const char *sharename)
{
@@ -2028,7 +2034,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
return NULL;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\srvsvc",
&ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
@@ -2060,6 +2066,7 @@ static struct security_descriptor *get_sharesec(TALLOC_CTX *mem_ctx,
}
static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_session *sess,
const char *sharename,
struct security_descriptor *sd)
@@ -2083,7 +2090,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
return NT_STATUS_UNSUCCESSFUL;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\pipe\\srvsvc",
+ status = pipe_bind_smb(mem_ctx, lp_ctx, tree, "\\pipe\\srvsvc",
&ndr_table_srvsvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) could not bind to srvsvc pipe: %s\n",
@@ -2115,6 +2122,7 @@ static NTSTATUS set_sharesec(TALLOC_CTX *mem_ctx,
}
bool try_tcon(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct security_descriptor *orig_sd,
struct smbcli_session *session,
const char *sharename, const struct dom_sid *user_sid,
@@ -2162,7 +2170,7 @@ bool try_tcon(TALLOC_CTX *mem_ctx,
return false;
}
- status = set_sharesec(mem_ctx, session, sharename, sd);
+ status = set_sharesec(mem_ctx, lp_ctx, session, sharename, sd);
if (!NT_STATUS_IS_OK(status)) {
d_printf("custom set_sharesec failed: %s\n",
nt_errstr(status));
@@ -2193,7 +2201,7 @@ bool try_tcon(TALLOC_CTX *mem_ctx,
done:
smbcli_rmdir(rmdir_tree, "sharesec_testdir");
- status = set_sharesec(mem_ctx, session, sharename, orig_sd);
+ status = set_sharesec(mem_ctx, lp_ctx, session, sharename, orig_sd);
if (!NT_STATUS_IS_OK(status)) {
d_printf("custom set_sharesec failed: %s\n",
nt_errstr(status));
@@ -2225,25 +2233,25 @@ bool torture_samba3_rpc_sharesec(struct torture_context *torture)
return false;
}
- if (!(user_sid = whoami(mem_ctx, cli->tree))) {
+ if (!(user_sid = whoami(mem_ctx, torture->lp_ctx, cli->tree))) {
d_printf("whoami failed\n");
talloc_free(mem_ctx);
return false;
}
- sd = get_sharesec(mem_ctx, cli->session, torture_setting_string(torture,
- "share", NULL));
+ sd = get_sharesec(mem_ctx, torture->lp_ctx, cli->session,
+ torture_setting_string(torture, "share", NULL));
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, 0, NT_STATUS_ACCESS_DENIED, NT_STATUS_OK);
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, SEC_FILE_READ_DATA, NT_STATUS_OK,
NT_STATUS_MEDIA_WRITE_PROTECTED);
- ret &= try_tcon(mem_ctx, sd, cli->session,
+ ret &= try_tcon(mem_ctx, torture->lp_ctx, sd, cli->session,
torture_setting_string(torture, "share", NULL),
user_sid, SEC_FILE_ALL, NT_STATUS_OK, NT_STATUS_OK);
@@ -2273,7 +2281,7 @@ bool torture_samba3_rpc_lsa(struct torture_context *torture)
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\lsarpc",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\lsarpc",
&ndr_table_lsarpc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
@@ -2330,6 +2338,7 @@ bool torture_samba3_rpc_lsa(struct torture_context *torture)
}
static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree,
+ struct smb_iconv_convenience *iconv_convenience,
char **name)
{
struct rap_WserverGetInfo r;
@@ -2339,7 +2348,7 @@ static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree,
r.in.level = 0;
r.in.bufsize = 0xffff;
- status = smbcli_rap_netservergetinfo(tree, mem_ctx, &r);
+ status = smbcli_rap_netservergetinfo(tree, iconv_convenience, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -2347,7 +2356,7 @@ static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree,
memcpy(servername, r.out.info.info0.name, 16);
servername[16] = '\0';
- if (pull_ascii_talloc(mem_ctx, lp_iconv_convenience(global_loadparm),
+ if (pull_ascii_talloc(mem_ctx, iconv_convenience,
name, servername) < 0) {
return NT_STATUS_NO_MEMORY;
}
@@ -2356,7 +2365,8 @@ static NTSTATUS get_servername(TALLOC_CTX *mem_ctx, struct smbcli_tree *tree,
}
-static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree,
+static NTSTATUS find_printers(TALLOC_CTX *ctx, struct loadparm_context *lp_ctx,
+ struct smbcli_tree *tree,
const char ***printers, int *num_printers)
{
TALLOC_CTX *mem_ctx;
@@ -2372,7 +2382,8 @@ static NTSTATUS find_printers(TALLOC_CTX *ctx, struct smbcli_tree *tree,
return NT_STATUS_NO_MEMORY;
}
- status = pipe_bind_smb(mem_ctx, tree, "\\srvsvc", &ndr_table_srvsvc,
+ status = pipe_bind_smb(mem_ctx, lp_ctx,
+ tree, "\\srvsvc", &ndr_table_srvsvc,
&p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("could not bind to srvsvc pipe\n");
@@ -2552,7 +2563,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
return false;
}
- status = get_servername(mem_ctx, cli->tree, &servername);
+ status = get_servername(mem_ctx, cli->tree, lp_iconv_convenience(torture->lp_ctx), &servername);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "(%s) get_servername returned %s\n",
__location__, nt_errstr(status));
@@ -2560,7 +2571,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
return false;
}
- if (!NT_STATUS_IS_OK(find_printers(mem_ctx, cli->tree,
+ if (!NT_STATUS_IS_OK(find_printers(mem_ctx, torture->lp_ctx, cli->tree,
&printers, &num_printers))) {
talloc_free(mem_ctx);
return false;
@@ -2572,7 +2583,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
return true;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\spoolss",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\spoolss",
&ndr_table_spoolss, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
@@ -2738,7 +2749,7 @@ bool torture_samba3_rpc_wkssvc(struct torture_context *torture)
return false;
}
- status = get_servername(mem_ctx, cli->tree, &servername);
+ status = get_servername(mem_ctx, cli->tree, lp_iconv_convenience(torture->lp_ctx), &servername);
if (!NT_STATUS_IS_OK(status)) {
d_fprintf(stderr, "(%s) get_servername returned %s\n",
__location__, nt_errstr(status));
@@ -2746,7 +2757,7 @@ bool torture_samba3_rpc_wkssvc(struct torture_context *torture)
return false;
}
- status = pipe_bind_smb(mem_ctx, cli->tree, "\\wkssvc",
+ status = pipe_bind_smb(mem_ctx, torture->lp_ctx, cli->tree, "\\wkssvc",
&ndr_table_wkssvc, &p);
if (!NT_STATUS_IS_OK(status)) {
d_printf("(%s) pipe_bind_smb failed: %s\n", __location__,
@@ -2995,6 +3006,7 @@ bool torture_samba3_rpc_winreg(struct torture_context *torture)
}
static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
struct smbcli_state *cli,
const char *share,
struct srvsvc_NetShareInfo502 **info)
@@ -3006,7 +3018,7 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
if (!(p = dcerpc_pipe_init(cli,
cli->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm)))) {
+ lp_iconv_convenience(lp_ctx)))) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
@@ -3056,6 +3068,7 @@ static NTSTATUS get_shareinfo(TALLOC_CTX *mem_ctx,
static NTSTATUS get_hklm_handle(TALLOC_CTX *mem_ctx,
struct smbcli_state *cli,
+ struct smb_iconv_convenience *iconv_convenience,
struct dcerpc_pipe **pipe_p,
struct policy_handle **handle)
{
@@ -3073,7 +3086,7 @@ static NTSTATUS get_hklm_handle(TALLOC_CTX *mem_ctx,
if (!(p = dcerpc_pipe_init(result,
cli->transport->socket->event.ctx,
- lp_iconv_convenience(global_loadparm)))) {
+ iconv_convenience))) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
@@ -3118,6 +3131,7 @@ static NTSTATUS get_hklm_handle(TALLOC_CTX *mem_ctx,
}
static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
+ struct smb_iconv_convenience *iconv_convenience,
const char *sharename)
{
struct dcerpc_pipe *p;
@@ -3132,7 +3146,7 @@ static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
mem_ctx = talloc_new(cli);
NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
- status = get_hklm_handle(mem_ctx, cli, &p, &hklm);
+ status = get_hklm_handle(mem_ctx, cli, iconv_convenience, &p, &hklm);
if (!NT_STATUS_IS_OK(status)) {
d_printf("get_hklm_handle failed: %s\n", nt_errstr(status));
goto fail;
@@ -3176,7 +3190,8 @@ static NTSTATUS torture_samba3_createshare(struct smbcli_state *cli,
return status;
}
-static NTSTATUS torture_samba3_deleteshare(struct smbcli_state *cli,
+static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture,
+ struct smbcli_state *cli,
const char *sharename)
{
struct dcerpc_pipe *p;
@@ -3188,7 +3203,8 @@ static NTSTATUS torture_samba3_deleteshare(struct smbcli_state *cli,
mem_ctx = talloc_new(cli);
NT_STATUS_HAVE_NO_MEMORY(mem_ctx);
- status = get_hklm_handle(cli, cli, &p, &hklm);
+ status = get_hklm_handle(cli, cli, lp_iconv_convenience(torture->lp_ctx),
+ &p, &hklm);
if (!NT_STATUS_IS_OK(status)) {
d_printf("get_hklm_handle failed: %s\n", nt_errstr(status));
goto fail;
@@ -3215,6 +3231,7 @@ static NTSTATUS torture_samba3_deleteshare(struct smbcli_state *cli,
}
static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
+ struct loadparm_context *lp_ctx,
const char *sharename,
const char *parameter,
const char *value)
@@ -3227,7 +3244,7 @@ static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
DATA_BLOB val;
NTSTATUS status;
- status = get_hklm_handle(cli, cli, &p, &hklm);
+ status = get_hklm_handle(cli, cli, lp_iconv_convenience(lp_ctx), &p, &hklm);
if (!NT_STATUS_IS_OK(status)) {
d_printf("get_hklm_handle failed: %s\n", nt_errstr(status));
return status;;
@@ -3252,7 +3269,8 @@ static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli,
goto done;
}
- if (!reg_string_to_val(hklm, "REG_SZ", value, &type, &val)) {
+ if (!reg_string_to_val(hklm, lp_iconv_convenience(lp_ctx), "REG_SZ",
+ value, &type, &val)) {
d_printf("(%s) reg_string_to_val failed\n", __location__);
goto done;
}
@@ -3287,21 +3305,21 @@ bool torture_samba3_regconfig(struct torture_context *torture)
return false;
}
- status = torture_samba3_createshare(cli, "blubber");
+ status = torture_samba3_createshare(cli, lp_iconv_convenience(torture->lp_ctx), "blubber");
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_createshare failed: "
"%s\n", nt_errstr(status));
goto done;
}
- status = torture_samba3_setconfig(cli, "blubber", "comment", comment);
+ status = torture_samba3_setconfig(cli, torture->lp_ctx, "blubber", "comment", comment);
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_setconfig failed: "
"%s\n", nt_errstr(status));
goto done;
}
- status = get_shareinfo(torture, cli, "blubber", &i);
+ status = get_shareinfo(torture, torture->lp_ctx, cli, "blubber", &i);
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "get_shareinfo failed: "
"%s\n", nt_errstr(status));
@@ -3314,7 +3332,7 @@ bool torture_samba3_regconfig(struct torture_context *torture)
goto done;
}
- status = torture_samba3_deleteshare(cli, "blubber");
+ status = torture_samba3_deleteshare(torture, cli, "blubber");
if (!NT_STATUS_IS_OK(status)) {
torture_warning(torture, "torture_samba3_deleteshare failed: "
"%s\n", nt_errstr(status));
diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c
index 7fd5199908..aba7147716 100644
--- a/source4/torture/rpc/samlogon.c
+++ b/source4/torture/rpc/samlogon.c
@@ -64,6 +64,7 @@ struct samlogon_state {
NTSTATUS expected_error;
bool old_password; /* Allow an old password to be accepted or rejected without error, as well as session key bugs */
DATA_BLOB chall;
+ struct smb_iconv_convenience *iconv_convenience;
};
/*
@@ -591,7 +592,7 @@ static bool test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state,
DATA_BLOB lmv2_response = data_blob(NULL, 0);
DATA_BLOB lmv2_session_key = data_blob(NULL, 0);
DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0);
- DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, TEST_MACHINE_NAME, lp_workgroup(global_loadparm));
+ DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, TEST_MACHINE_NAME, lp_workgroup(global_loadparm));
uint8_t lm_session_key[8];
uint8_t user_session_key[16];
@@ -739,7 +740,7 @@ static bool test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state,
DATA_BLOB lmv2_response = data_blob(NULL, 0);
DATA_BLOB lmv2_session_key = data_blob(NULL, 0);
DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0);
- DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm));
+ DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, samlogon_state->iconv_convenience, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm));
DATA_BLOB ntlm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24);
DATA_BLOB ntlm_session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16);
@@ -1158,7 +1159,7 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea
ZERO_STRUCT(user_session_key);
if ((push_ucs2_talloc(samlogon_state->mem_ctx,
- lp_iconv_convenience(global_loadparm),
+ samlogon_state->iconv_convenience,
&unicodepw, samlogon_state->password)) == -1) {
DEBUG(0, ("push_ucs2_allocate failed!\n"));
exit(1);
@@ -1169,7 +1170,7 @@ static bool test_plaintext(struct samlogon_state *samlogon_state, enum ntlm_brea
password = strupper_talloc(samlogon_state->mem_ctx, samlogon_state->password);
if ((convert_string_talloc(samlogon_state->mem_ctx,
- lp_iconv_convenience(global_loadparm),
+ samlogon_state->iconv_convenience,
CH_UNIX, CH_DOS,
password, strlen(password)+1,
(void**)&dospw)) == -1) {
@@ -1310,6 +1311,7 @@ static const struct ntlm_tests {
try a netlogon SamLogon
*/
static bool test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct torture_context *tctx,
struct creds_CredentialState *creds,
const char *comment,
const char *account_domain, const char *account_name,
@@ -1340,6 +1342,7 @@ static bool test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
samlogon_state.chall = data_blob_talloc(fn_ctx, NULL, 8);
samlogon_state.parameter_control = parameter_control;
samlogon_state.old_password = old_password;
+ samlogon_state.iconv_convenience = lp_iconv_convenience(tctx->lp_ctx);
generate_random_buffer(samlogon_state.chall.data, 8);
samlogon_state.r_flags.in.server_name = talloc_asprintf(fn_ctx, "\\\\%s", dcerpc_server_name(p));
@@ -1792,7 +1795,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
}
if (usercreds[ci].network_login) {
- if (!test_SamLogon(p, mem_ctx, creds,
+ if (!test_SamLogon(p, mem_ctx, torture, creds,
usercreds[ci].comment,
usercreds[ci].domain,
usercreds[ci].username,
@@ -1825,7 +1828,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
}
if (usercreds[0].network_login) {
- if (!test_SamLogon(p, mem_ctx, creds,
+ if (!test_SamLogon(p, mem_ctx, torture, creds,
usercreds[0].comment,
usercreds[0].domain,
usercreds[0].username,
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 1f7f9f463e..865ebf9fd2 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -398,7 +398,7 @@ static bool samsync_handle_policy(TALLOC_CTX *mem_ctx, struct samsync_state *sam
return true;
}
-static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state,
+static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ctx, struct samsync_state *samsync_state,
int database_id, struct netr_DELTA_ENUM *delta)
{
uint32_t rid = delta->delta_id_union.rid;
@@ -548,7 +548,7 @@ static bool samsync_handle_user(TALLOC_CTX *mem_ctx, struct samsync_state *samsy
data.data = user->user_private_info.SensitiveData;
data.length = user->user_private_info.DataLength;
creds_arcfour_crypt(samsync_state->creds, data.data, data.length);
- ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(tctx->lp_ctx), &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
if (keys.keys.keys2.lmpassword.length == 16) {
sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
@@ -1101,8 +1101,9 @@ static bool samsync_handle_account(TALLOC_CTX *mem_ctx, struct samsync_state *sa
/*
try a netlogon DatabaseSync
*/
-static bool test_DatabaseSync(struct samsync_state *samsync_state,
- TALLOC_CTX *mem_ctx)
+static bool test_DatabaseSync(struct torture_context *tctx,
+ struct samsync_state *samsync_state,
+ TALLOC_CTX *mem_ctx)
{
NTSTATUS status;
TALLOC_CTX *loop_ctx, *delta_ctx, *trustdom_ctx;
@@ -1162,7 +1163,7 @@ static bool test_DatabaseSync(struct samsync_state *samsync_state,
}
break;
case NETR_DELTA_USER:
- if (!samsync_handle_user(delta_ctx, samsync_state,
+ if (!samsync_handle_user(tctx, delta_ctx, samsync_state,
r.in.database_id, &r.out.delta_enum_array->delta_enum[d])) {
printf("Failed to handle DELTA_USER\n");
ret = false;
@@ -1611,7 +1612,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
ret = false;
}
- if (!test_DatabaseSync(samsync_state, mem_ctx)) {
+ if (!test_DatabaseSync(torture, samsync_state, mem_ctx)) {
printf("DatabaseSync failed\n");
ret = false;
}
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index cb9b8be2c9..5a91366980 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -64,7 +64,7 @@ bool test_netlogon_ex_ops(struct dcerpc_pipe *p, struct torture_context *tctx,
chal = data_blob_const(ninfo.challenge,
sizeof(ninfo.challenge));
- names_blob = NTLMv2_generate_names_blob(tctx, cli_credentials_get_workstation(credentials),
+ names_blob = NTLMv2_generate_names_blob(tctx, lp_iconv_convenience(tctx->lp_ctx), cli_credentials_get_workstation(credentials),
cli_credentials_get_domain(credentials));
status = cli_credentials_get_ntlm_response(cmdline_credentials, tctx,
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index d77295605f..4695733671 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -38,12 +38,9 @@
#define TEST_SID "S-1-5-21-1234567890-1234567890-1234567890-500"
-static void init_initshutdown_String(TALLOC_CTX *mem_ctx,
- struct initshutdown_String *name,
- const char *s)
+static void init_lsa_StringLarge(struct lsa_StringLarge *name, const char *s)
{
- name->name = talloc(mem_ctx, struct initshutdown_String_sub);
- name->name->name = s;
+ name->string = s;
}
static void init_winreg_String(struct winreg_String *name, const char *s)
@@ -1636,8 +1633,8 @@ static bool test_InitiateSystemShutdown(struct torture_context *tctx,
uint16_t hostname = 0x0;
r.in.hostname = &hostname;
- r.in.message = talloc(tctx, struct initshutdown_String);
- init_initshutdown_String(tctx, r.in.message, "spottyfood");
+ r.in.message = talloc(tctx, struct lsa_StringLarge);
+ init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
r.in.reboot = 1;
@@ -1660,8 +1657,8 @@ static bool test_InitiateSystemShutdownEx(struct torture_context *tctx,
uint16_t hostname = 0x0;
r.in.hostname = &hostname;
- r.in.message = talloc(tctx, struct initshutdown_String);
- init_initshutdown_String(tctx, r.in.message, "spottyfood");
+ r.in.message = talloc(tctx, struct lsa_StringLarge);
+ init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
r.in.reboot = 1;
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 371ddc7297..4eeea73003 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -615,8 +615,6 @@ int main(int argc,char *argv[])
alarm(max_runtime);
}
- ldb_global_init();
-
if (extra_module != NULL) {
init_module_fn fn = load_module(talloc_autofree_context(), poptGetOptArg(pc));