diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/auth/pac.c | 34 | ||||
-rw-r--r-- | source4/torture/basic/utable.c | 6 | ||||
-rw-r--r-- | source4/torture/rap/rap.c | 43 | ||||
-rw-r--r-- | source4/torture/raw/composite.c | 1 | ||||
-rw-r--r-- | source4/torture/rpc/netlogon.c | 2 | ||||
-rw-r--r-- | source4/torture/rpc/samba3rpc.c | 31 | ||||
-rw-r--r-- | source4/torture/rpc/samlogon.c | 15 | ||||
-rw-r--r-- | source4/torture/rpc/schannel.c | 2 |
8 files changed, 84 insertions, 50 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/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/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/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 779a28e126..95252e7397 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -985,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, @@ -2337,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; @@ -2346,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; } @@ -2354,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; } @@ -2561,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)); @@ -2747,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)); @@ -3066,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) { @@ -3083,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; } @@ -3128,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; @@ -3142,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; @@ -3199,7 +3203,8 @@ static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture, 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; @@ -3226,6 +3231,7 @@ static NTSTATUS torture_samba3_deleteshare(struct torture_context *torture, } static NTSTATUS torture_samba3_setconfig(struct smbcli_state *cli, + struct loadparm_context *lp_ctx, const char *sharename, const char *parameter, const char *value) @@ -3238,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;; @@ -3263,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; } @@ -3298,14 +3305,14 @@ 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)); 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/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, |