summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/util/ms_fnmatch.c15
-rw-r--r--source4/ntvfs/posix/pvfs_shortname.c6
-rw-r--r--source4/torture/rpc/samba3rpc.c18
-rw-r--r--source4/torture/rpc/samlogon.c11
4 files changed, 31 insertions, 19 deletions
diff --git a/source4/lib/util/ms_fnmatch.c b/source4/lib/util/ms_fnmatch.c
index 1fb57b07a4..5e04ec1f4b 100644
--- a/source4/lib/util/ms_fnmatch.c
+++ b/source4/lib/util/ms_fnmatch.c
@@ -64,8 +64,9 @@ static int ms_fnmatch_core(const char *p, const char *n,
codepoint_t c, c2;
int i;
size_t size, size_n;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
- while ((c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &size))) {
+ while ((c = next_codepoint(iconv_convenience, p, &size))) {
p += size;
switch (c) {
@@ -75,7 +76,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
return null_match(p);
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n);
+ next_codepoint(iconv_convenience, n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) {
return 0;
}
@@ -94,7 +95,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
return -1;
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(lp_iconv_convenience(global_loadparm), n+i, &size_n);
+ next_codepoint(iconv_convenience, n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) return 0;
if (n+i == ldot) {
if (ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot) == 0) return 0;
@@ -110,7 +111,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
if (! *n) {
return -1;
}
- next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
+ next_codepoint(iconv_convenience, n, &size_n);
n += size_n;
break;
@@ -124,7 +125,7 @@ static int ms_fnmatch_core(const char *p, const char *n,
break;
}
if (! *n) return null_match(p);
- next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
+ next_codepoint(iconv_convenience, n, &size_n);
n += size_n;
break;
@@ -134,12 +135,12 @@ static int ms_fnmatch_core(const char *p, const char *n,
return 0;
}
if (*n != '.') return -1;
- next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
+ next_codepoint(iconv_convenience, n, &size_n);
n += size_n;
break;
default:
- c2 = next_codepoint(lp_iconv_convenience(global_loadparm), n, &size_n);
+ c2 = next_codepoint(iconv_convenience, n, &size_n);
if (c != c2 && codepoint_cmpi(c, c2) != 0) {
return -1;
}
diff --git a/source4/ntvfs/posix/pvfs_shortname.c b/source4/ntvfs/posix/pvfs_shortname.c
index 083a281819..923887debd 100644
--- a/source4/ntvfs/posix/pvfs_shortname.c
+++ b/source4/ntvfs/posix/pvfs_shortname.c
@@ -104,6 +104,8 @@ struct pvfs_mangle_context {
/* this is used to reverse the base 36 mapping */
unsigned char base_reverse[256];
+
+ struct smb_iconv_convenience *iconv_convenience;
};
@@ -388,7 +390,7 @@ static bool is_legal_name(struct pvfs_mangle_context *ctx, const char *name)
{
while (*name) {
size_t c_size;
- codepoint_t c = next_codepoint(lp_iconv_convenience(global_loadparm), name, &c_size);
+ codepoint_t c = next_codepoint(ctx->iconv_convenience, name, &c_size);
if (c == INVALID_CODEPOINT) {
return false;
}
@@ -613,6 +615,8 @@ NTSTATUS pvfs_mangle_init(struct pvfs_state *pvfs)
return NT_STATUS_NO_MEMORY;
}
+ ctx->iconv_convenience = lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx);
+
/* by default have a max of 512 entries in the cache. */
ctx->cache_size = lp_parm_int(pvfs->ntvfs->ctx->lp_ctx, NULL, "mangle", "cachesize", 512);
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
index f62fa8742b..9e46993bad 100644
--- a/source4/torture/rpc/samba3rpc.c
+++ b/source4/torture/rpc/samba3rpc.c
@@ -2355,7 +2355,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;
}
@@ -3067,6 +3067,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)
{
@@ -3084,7 +3085,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;
}
@@ -3129,6 +3130,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;
@@ -3143,7 +3145,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;
@@ -3200,7 +3202,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;
@@ -3227,6 +3230,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)
@@ -3239,7 +3243,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;;
@@ -3299,14 +3303,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..89352ba8c4 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;
};
/*
@@ -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,