summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-21 14:50:57 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-21 14:50:57 +0100
commit921b17648456027b6b46a582aa1d13024a5e9a90 (patch)
tree637fe02b288cf87c33fabd6e6875f5e6d011eae5 /source4
parent37deca2d41d74faa7abe060a21340263bd6d66f7 (diff)
downloadsamba-921b17648456027b6b46a582aa1d13024a5e9a90.tar.gz
samba-921b17648456027b6b46a582aa1d13024a5e9a90.tar.bz2
samba-921b17648456027b6b46a582aa1d13024a5e9a90.zip
Remove more uses of global_loadparm.
(This used to be commit 47d05ecf6fef66c90994f666b8c63e2e7b5a6cd8)
Diffstat (limited to 'source4')
-rw-r--r--source4/kdc/pac-glue.c11
-rw-r--r--source4/libcli/auth/smbencrypt.c6
-rw-r--r--source4/libcli/dgram/browse.c6
-rw-r--r--source4/libcli/dgram/dgramsocket.c5
-rw-r--r--source4/libcli/dgram/libdgram.h1
-rw-r--r--source4/libcli/dgram/netlogon.c6
-rw-r--r--source4/libcli/dgram/ntlogon.c6
-rw-r--r--source4/libcli/nbt/nbtname.c4
-rw-r--r--source4/libcli/raw/clitransport.c5
-rw-r--r--source4/libcli/smb_composite/fetchfile.c4
-rw-r--r--source4/libcli/smb_composite/smb_composite.h1
-rw-r--r--source4/torture/raw/composite.c1
12 files changed, 33 insertions, 23 deletions
diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c
index 5f3a718abd..637f39aa74 100644
--- a/source4/kdc/pac-glue.c
+++ b/source4/kdc/pac-glue.c
@@ -47,6 +47,7 @@ void samba_kdc_plugin_fini(void *ptr)
static krb5_error_code make_pac(krb5_context context,
TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
struct auth_serversupplied_info *server_info,
krb5_pac *pac)
{
@@ -73,7 +74,7 @@ static krb5_error_code make_pac(krb5_context context,
logon_info.info->info3 = *info3;
- ndr_err = ndr_push_struct_blob(&pac_out, mem_ctx, lp_iconv_convenience(global_loadparm), &logon_info,
+ ndr_err = ndr_push_struct_blob(&pac_out, mem_ctx, iconv_convenience, &logon_info,
(ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO_CTR);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
nt_status = ndr_map_error2ntstatus(ndr_err);
@@ -113,6 +114,7 @@ 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;
@@ -138,7 +140,7 @@ krb5_error_code samba_kdc_get_pac(void *priv,
return ENOMEM;
}
- ret = make_pac(context, mem_ctx, server_info, pac);
+ ret = make_pac(context, mem_ctx, iconv_convenience, server_info, pac);
talloc_free(mem_ctx);
return ret;
@@ -164,6 +166,7 @@ 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");
@@ -190,7 +193,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, lp_iconv_convenience(global_loadparm), &logon_info,
+ ndr_err = ndr_pull_struct_blob(&pac_in, mem_ctx, 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);
@@ -213,7 +216,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, server_info_out, pac);
+ ret = make_pac(context, mem_ctx, iconv_convenience, server_info_out, pac);
talloc_free(mem_ctx);
return ret;
diff --git a/source4/libcli/auth/smbencrypt.c b/source4/libcli/auth/smbencrypt.c
index 4ccf568d8c..c5223db63f 100644
--- a/source4/libcli/auth/smbencrypt.c
+++ b/source4/libcli/auth/smbencrypt.c
@@ -125,6 +125,8 @@ bool ntv2_owf_gen(const uint8_t owf[16],
HMACMD5Context ctx;
TALLOC_CTX *mem_ctx = talloc_init("ntv2_owf_gen for %s\\%s", domain_in, user_in);
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
+
if (!mem_ctx) {
return false;
}
@@ -151,14 +153,14 @@ bool ntv2_owf_gen(const uint8_t owf[16],
}
}
- user_byte_len = push_ucs2_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), &user, user_in);
+ user_byte_len = push_ucs2_talloc(mem_ctx, iconv_convenience, &user, user_in);
if (user_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_uss2_talloc() for user returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
return false;
}
- domain_byte_len = push_ucs2_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), &domain, domain_in);
+ domain_byte_len = push_ucs2_talloc(mem_ctx, iconv_convenience, &domain, domain_in);
if (domain_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_ucs2_talloc() for domain returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
diff --git a/source4/libcli/dgram/browse.c b/source4/libcli/dgram/browse.c
index eb19555d15..14d8278635 100644
--- a/source4/libcli/dgram/browse.c
+++ b/source4/libcli/dgram/browse.c
@@ -38,7 +38,7 @@ NTSTATUS dgram_mailslot_browse_send(struct nbt_dgram_socket *dgmsock,
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
- ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), request,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, dgmsock->iconv_convenience, request,
(ndr_push_flags_fn_t)ndr_push_nbt_browse_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
@@ -66,7 +66,7 @@ NTSTATUS dgram_mailslot_browse_reply(struct nbt_dgram_socket *dgmsock,
struct nbt_name myname;
struct socket_address *dest;
- ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), reply,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, dgmsock->iconv_convenience, reply,
(ndr_push_flags_fn_t)ndr_push_nbt_browse_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
@@ -99,7 +99,7 @@ NTSTATUS dgram_mailslot_browse_parse(struct dgram_mailslot_handler *dgmslot,
DATA_BLOB data = dgram_mailslot_data(dgram);
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), pkt,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, pkt,
(ndr_pull_flags_fn_t)ndr_pull_nbt_browse_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
diff --git a/source4/libcli/dgram/dgramsocket.c b/source4/libcli/dgram/dgramsocket.c
index 032d9de67b..7d6f5627c5 100644
--- a/source4/libcli/dgram/dgramsocket.c
+++ b/source4/libcli/dgram/dgramsocket.c
@@ -72,7 +72,7 @@ static void dgm_socket_recv(struct nbt_dgram_socket *dgmsock)
}
/* parse the request */
- ndr_err = ndr_pull_struct_blob(&blob, packet, lp_iconv_convenience(global_loadparm), packet,
+ ndr_err = ndr_pull_struct_blob(&blob, packet, dgmsock->iconv_convenience, packet,
(ndr_pull_flags_fn_t)ndr_pull_nbt_dgram_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -187,6 +187,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx,
dgmsock->send_queue = NULL;
dgmsock->incoming.handler = NULL;
dgmsock->mailslot_handlers = NULL;
+ dgmsock->iconv_convenience = lp_iconv_convenience(global_loadparm);
return dgmsock;
@@ -229,7 +230,7 @@ NTSTATUS nbt_dgram_send(struct nbt_dgram_socket *dgmsock,
req->dest = dest;
if (talloc_reference(req, dest) == NULL) goto failed;
- ndr_err = ndr_push_struct_blob(&req->encoded, req, lp_iconv_convenience(global_loadparm), packet,
+ ndr_err = ndr_push_struct_blob(&req->encoded, req, dgmsock->iconv_convenience, packet,
(ndr_push_flags_fn_t)ndr_push_nbt_dgram_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
diff --git a/source4/libcli/dgram/libdgram.h b/source4/libcli/dgram/libdgram.h
index 6d4cdb2bdf..4645840971 100644
--- a/source4/libcli/dgram/libdgram.h
+++ b/source4/libcli/dgram/libdgram.h
@@ -40,6 +40,7 @@ struct nbt_dgram_request {
struct nbt_dgram_socket {
struct socket_context *sock;
struct event_context *event_ctx;
+ struct smb_iconv_convenience *iconv_convenience;
/* the fd event */
struct fd_event *fde;
diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c
index 670af4ea63..5c7dedc7bb 100644
--- a/source4/libcli/dgram/netlogon.c
+++ b/source4/libcli/dgram/netlogon.c
@@ -41,7 +41,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock,
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
ndr_err = ndr_push_struct_blob(&blob, tmp_ctx,
- lp_iconv_convenience(global_loadparm),
+ dgmsock->iconv_convenience,
request,
(ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -76,7 +76,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock,
struct socket_address *dest;
ndr_err = ndr_push_struct_blob(&blob, tmp_ctx,
- lp_iconv_convenience(global_loadparm),
+ dgmsock->iconv_convenience,
reply,
(ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -114,7 +114,7 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot,
DATA_BLOB data = dgram_mailslot_data(dgram);
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), netlogon,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, netlogon,
(ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
diff --git a/source4/libcli/dgram/ntlogon.c b/source4/libcli/dgram/ntlogon.c
index 98aad1af8c..7b26ed7c00 100644
--- a/source4/libcli/dgram/ntlogon.c
+++ b/source4/libcli/dgram/ntlogon.c
@@ -41,7 +41,7 @@ NTSTATUS dgram_mailslot_ntlogon_send(struct nbt_dgram_socket *dgmsock,
DATA_BLOB blob;
TALLOC_CTX *tmp_ctx = talloc_new(dgmsock);
- ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm),
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, dgmsock->iconv_convenience,
request,
(ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -75,7 +75,7 @@ NTSTATUS dgram_mailslot_ntlogon_reply(struct nbt_dgram_socket *dgmsock,
struct nbt_name myname;
struct socket_address *dest;
- ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), reply,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, dgmsock->iconv_convenience, reply,
(ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
@@ -113,7 +113,7 @@ NTSTATUS dgram_mailslot_ntlogon_parse(struct dgram_mailslot_handler *dgmslot,
DATA_BLOB data = dgram_mailslot_data(dgram);
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), ntlogon,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, ntlogon,
(ndr_pull_flags_fn_t)ndr_pull_nbt_ntlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
diff --git a/source4/libcli/nbt/nbtname.c b/source4/libcli/nbt/nbtname.c
index 142dad0296..ae9f3f6b05 100644
--- a/source4/libcli/nbt/nbtname.c
+++ b/source4/libcli/nbt/nbtname.c
@@ -381,11 +381,11 @@ _PUBLIC_ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struc
/**
push a nbt name into a blob
*/
-_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name)
+_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, DATA_BLOB *blob, struct nbt_name *name)
{
enum ndr_err_code ndr_err;
- ndr_err = ndr_push_struct_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm), name, (ndr_push_flags_fn_t)ndr_push_nbt_name);
+ ndr_err = ndr_push_struct_blob(blob, mem_ctx, iconv_convenience, name, (ndr_push_flags_fn_t)ndr_push_nbt_name);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return ndr_map_error2ntstatus(ndr_err);
}
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 288f0612de..5c14e9f9b8 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -164,14 +164,15 @@ struct smbcli_request *smbcli_transport_connect_send(struct smbcli_transport *tr
DATA_BLOB calling_blob, called_blob;
TALLOC_CTX *tmp_ctx = talloc_new(transport);
NTSTATUS status;
+ struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
status = nbt_name_dup(transport, called, &transport->called);
if (!NT_STATUS_IS_OK(status)) goto failed;
- status = nbt_name_to_blob(tmp_ctx, &calling_blob, calling);
+ status = nbt_name_to_blob(tmp_ctx, iconv_convenience, &calling_blob, calling);
if (!NT_STATUS_IS_OK(status)) goto failed;
- status = nbt_name_to_blob(tmp_ctx, &called_blob, called);
+ status = nbt_name_to_blob(tmp_ctx, iconv_convenience, &called_blob, called);
if (!NT_STATUS_IS_OK(status)) goto failed;
/* allocate output buffer */
diff --git a/source4/libcli/smb_composite/fetchfile.c b/source4/libcli/smb_composite/fetchfile.c
index c7d02e323c..e4312794c9 100644
--- a/source4/libcli/smb_composite/fetchfile.c
+++ b/source4/libcli/smb_composite/fetchfile.c
@@ -147,8 +147,8 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
state->connect->in.fallback_to_anonymous = false;
state->connect->in.workgroup = io->in.workgroup;
- lp_smbcli_options(global_loadparm, &state->connect->in.options);
-
+ state->connect->in.options = io->in.options;
+
state->creq = smb_composite_connect_send(state->connect, state,
lp_resolve_context(global_loadparm), event_ctx);
if (state->creq == NULL) goto failed;
diff --git a/source4/libcli/smb_composite/smb_composite.h b/source4/libcli/smb_composite/smb_composite.h
index a732617f80..964ffb0936 100644
--- a/source4/libcli/smb_composite/smb_composite.h
+++ b/source4/libcli/smb_composite/smb_composite.h
@@ -55,6 +55,7 @@ struct smb_composite_fetchfile {
struct cli_credentials *credentials;
const char *workgroup;
const char *filename;
+ struct smbcli_options options;
} in;
struct {
uint8_t *data;
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);