summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-21 15:21:45 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-21 15:21:45 +0100
commitd9f8232c34a695df04a5240e270dd7ffc3101c0e (patch)
tree292590769a70bed4722ed677df74569e71f5b355 /source4
parent921b17648456027b6b46a582aa1d13024a5e9a90 (diff)
downloadsamba-d9f8232c34a695df04a5240e270dd7ffc3101c0e.tar.gz
samba-d9f8232c34a695df04a5240e270dd7ffc3101c0e.tar.bz2
samba-d9f8232c34a695df04a5240e270dd7ffc3101c0e.zip
Remove more uses of global_loadparm.
(This used to be commit 230355d2e6e27918dff40823eb238904c7a1870e)
Diffstat (limited to 'source4')
-rw-r--r--source4/kdc/hdb-ldb.c3
-rw-r--r--source4/kdc/kdc.h1
-rw-r--r--source4/kdc/pac-glue.c8
-rw-r--r--source4/ntvfs/posix/pvfs_rename.c14
-rw-r--r--source4/ntvfs/posix/pvfs_resolve.c5
-rw-r--r--source4/torture/basic/utable.c6
-rw-r--r--source4/torture/rap/rap.c14
7 files changed, 27 insertions, 24 deletions
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c
index d8877655c9..2143d26cde 100644
--- a/source4/kdc/hdb-ldb.c
+++ b/source4/kdc/hdb-ldb.c
@@ -430,6 +430,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
}
private->entry_ex = entry_ex;
+ private->iconv_convenience = lp_iconv_convenience(lp_ctx);
talloc_set_destructor(private, hdb_ldb_destrutor);
@@ -546,7 +547,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
entry_ex->entry.generation = NULL;
/* Get keys from the db */
- ret = LDB_message2entry_keys(context, lp_iconv_convenience(lp_ctx), private, msg, userAccountControl, entry_ex);
+ ret = LDB_message2entry_keys(context, private->iconv_convenience, private, msg, userAccountControl, entry_ex);
if (ret) {
/* Could be bougus data in the entry, or out of memory */
goto out;
diff --git a/source4/kdc/kdc.h b/source4/kdc/kdc.h
index 9d031b8f7d..78276183c2 100644
--- a/source4/kdc/kdc.h
+++ b/source4/kdc/kdc.h
@@ -51,6 +51,7 @@ struct kdc_server {
struct hdb_ldb_private {
struct ldb_context *samdb;
+ struct smb_iconv_convenience *iconv_convenience;
struct ldb_message *msg;
struct ldb_message *realm_ref_msg;
hdb_entry_ex *entry_ex;
diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c
index 637f39aa74..cf55618a06 100644
--- a/source4/kdc/pac-glue.c
+++ b/source4/kdc/pac-glue.c
@@ -114,7 +114,6 @@ krb5_error_code samba_kdc_get_pac(void *priv,
struct hdb_ldb_private *private = talloc_get_type(client->ctx, struct hdb_ldb_private);
TALLOC_CTX *mem_ctx = talloc_named(private, 0, "samba_get_pac context");
unsigned int userAccountControl;
- struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
if (!mem_ctx) {
return ENOMEM;
@@ -140,7 +139,7 @@ krb5_error_code samba_kdc_get_pac(void *priv,
return ENOMEM;
}
- ret = make_pac(context, mem_ctx, iconv_convenience, server_info, pac);
+ ret = make_pac(context, mem_ctx, private->iconv_convenience, server_info, pac);
talloc_free(mem_ctx);
return ret;
@@ -166,7 +165,6 @@ krb5_error_code samba_kdc_reget_pac(void *priv, krb5_context context,
struct PAC_LOGON_INFO_CTR logon_info;
union netr_Validation validation;
struct auth_serversupplied_info *server_info_out;
- struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
TALLOC_CTX *mem_ctx = talloc_named(private, 0, "samba_get_pac context");
@@ -193,7 +191,7 @@ krb5_error_code samba_kdc_reget_pac(void *priv, krb5_context context,
return ENOMEM;
}
- ndr_err = ndr_pull_struct_blob(&pac_in, mem_ctx, iconv_convenience, &logon_info,
+ ndr_err = ndr_pull_struct_blob(&pac_in, mem_ctx, private->iconv_convenience, &logon_info,
(ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err) || !logon_info.info) {
nt_status = ndr_map_error2ntstatus(ndr_err);
@@ -216,7 +214,7 @@ krb5_error_code samba_kdc_reget_pac(void *priv, krb5_context context,
/* We will compleatly regenerate this pac */
krb5_pac_free(context, *pac);
- ret = make_pac(context, mem_ctx, iconv_convenience, server_info_out, pac);
+ ret = make_pac(context, mem_ctx, private->iconv_convenience, server_info_out, pac);
talloc_free(mem_ctx);
return ret;
diff --git a/source4/ntvfs/posix/pvfs_rename.c b/source4/ntvfs/posix/pvfs_rename.c
index 3b9842db7f..ea12f49333 100644
--- a/source4/ntvfs/posix/pvfs_rename.c
+++ b/source4/ntvfs/posix/pvfs_rename.c
@@ -89,6 +89,7 @@ NTSTATUS pvfs_do_rename(struct pvfs_state *pvfs, const struct pvfs_filename *nam
resolve a wildcard rename pattern. This works on one component of the name
*/
static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
const char *fname,
const char *pattern)
{
@@ -108,16 +109,16 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx,
while (*p2) {
codepoint_t c1, c2;
size_t c_size1, c_size2;
- c1 = next_codepoint(lp_iconv_convenience(global_loadparm), p1, &c_size1);
- c2 = next_codepoint(lp_iconv_convenience(global_loadparm), p2, &c_size2);
+ c1 = next_codepoint(iconv_convenience, p1, &c_size1);
+ c2 = next_codepoint(iconv_convenience, p2, &c_size2);
if (c2 == '?') {
- d += push_codepoint(lp_iconv_convenience(global_loadparm), d, c1);
+ d += push_codepoint(iconv_convenience, d, c1);
} else if (c2 == '*') {
memcpy(d, p1, strlen(p1));
d += strlen(p1);
break;
} else {
- d += push_codepoint(lp_iconv_convenience(global_loadparm), d, c2);
+ d += push_codepoint(iconv_convenience, d, c2);
}
p1 += c_size1;
@@ -138,6 +139,7 @@ static const char *pvfs_resolve_wildcard(TALLOC_CTX *mem_ctx,
{
const char *base1, *base2;
const char *ext1, *ext2;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
char *p;
/* break into base part plus extension */
@@ -165,8 +167,8 @@ static const char *pvfs_resolve_wildcard(TALLOC_CTX *mem_ctx,
return NULL;
}
- base1 = pvfs_resolve_wildcard_component(mem_ctx, base1, base2);
- ext1 = pvfs_resolve_wildcard_component(mem_ctx, ext1, ext2);
+ base1 = pvfs_resolve_wildcard_component(mem_ctx, iconv_convenience, base1, base2);
+ ext1 = pvfs_resolve_wildcard_component(mem_ctx, iconv_convenience, ext1, ext2);
if (base1 == NULL || ext1 == NULL) {
return NULL;
}
diff --git a/source4/ntvfs/posix/pvfs_resolve.c b/source4/ntvfs/posix/pvfs_resolve.c
index 949fa131a4..cf74816391 100644
--- a/source4/ntvfs/posix/pvfs_resolve.c
+++ b/source4/ntvfs/posix/pvfs_resolve.c
@@ -336,12 +336,13 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t
int i, num_components, err_count;
char **components;
char *p, *s, *ret;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
s = talloc_strdup(mem_ctx, *fname);
if (s == NULL) return NT_STATUS_NO_MEMORY;
for (num_components=1, p=s; *p; p += c_size) {
- c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
+ c = next_codepoint(iconv_convenience, p, &c_size);
if (c == '\\') num_components++;
}
@@ -353,7 +354,7 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t
components[0] = s;
for (i=0, p=s; *p; p += c_size) {
- c = next_codepoint(lp_iconv_convenience(global_loadparm), p, &c_size);
+ c = next_codepoint(iconv_convenience, p, &c_size);
if (c == '\\') {
*p = 0;
components[++i] = p+1;
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 8bdd6a8ddd..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;
@@ -253,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;
@@ -345,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;
@@ -451,7 +451,7 @@ _PUBLIC_ NTSTATUS smbcli_rap_netservergetinfo(struct smbcli_tree *tree,
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;
}
@@ -524,7 +524,7 @@ 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, lp_iconv_convenience(torture->lp_ctx), call);