From 10169a203019445e6d325a5c1559de3c73782237 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 17:54:24 +0100 Subject: Remove more global_loadparm instance.s (This used to be commit a1280252ce924df69d911e597b7f65d8038abef9) --- source4/lib/registry/ldb.c | 14 +++++++++----- source4/libcli/finddcs.c | 4 +++- source4/libcli/resolve/nbtlist.c | 3 ++- source4/libnet/libnet_become_dc.c | 3 ++- source4/libnet/libnet_site.c | 2 +- source4/libnet/libnet_unbecome_dc.c | 3 ++- source4/librpc/rpc/dcerpc.c | 8 ++++---- source4/librpc/rpc/dcerpc_util.c | 3 ++- source4/ntvfs/common/notify.c | 10 ++++++---- source4/ntvfs/posix/pvfs_xattr.c | 2 +- source4/rpc_server/dcerpc_server.c | 10 ++++------ source4/rpc_server/dcesrv_auth.c | 2 +- source4/smb_server/smb/request.c | 2 +- 13 files changed, 38 insertions(+), 28 deletions(-) diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 0c8a55396e..dfd368ea80 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -36,7 +36,9 @@ struct ldb_key_data int subkey_count, value_count; }; -static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, +static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, + struct ldb_message *msg, const char **name, uint32_t *type, DATA_BLOB *data) { @@ -57,7 +59,7 @@ static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, { case REG_SZ: case REG_EXPAND_SZ: - data->length = convert_string_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), CH_UTF8, CH_UTF16, + data->length = convert_string_talloc(mem_ctx, iconv_convenience, CH_UTF8, CH_UTF16, val->data, val->length, (void **)&data->data); break; @@ -281,7 +283,7 @@ static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct hive_key *k, if (idx >= kd->value_count) return WERR_NO_MORE_ITEMS; - reg_ldb_unpack_value(mem_ctx, kd->values[idx], + reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), kd->values[idx], name, data_type, data); return WERR_OK; @@ -310,7 +312,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k, if (res->count == 0) return WERR_BADFILE; - reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data); + reg_ldb_unpack_value(mem_ctx, lp_iconv_convenience(global_loadparm), res->msgs[0], NULL, data_type, data); return WERR_OK; } @@ -607,7 +609,9 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx, if (max_valbufsize != NULL) { DATA_BLOB data; - reg_ldb_unpack_value(mem_ctx, kd->values[i], NULL, + reg_ldb_unpack_value(mem_ctx, + lp_iconv_convenience(global_loadparm), + kd->values[i], NULL, NULL, &data); *max_valbufsize = MAX(*max_valbufsize, data.length); talloc_free(data.data); diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index 606809751e..67ba47ddc6 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -28,6 +28,7 @@ #include "libcli/libcli.h" #include "libcli/resolve/resolve.h" #include "libcli/finddcs.h" +#include "param/param.h" struct finddcs_state { struct composite_context *ctx; @@ -195,7 +196,8 @@ static void fallback_node_status(struct finddcs_state *state) state->node_status.in.timeout = 1; state->node_status.in.retries = 2; - nbtsock = nbt_name_socket_init(state, state->ctx->event_ctx); + nbtsock = nbt_name_socket_init(state, state->ctx->event_ctx, + lp_iconv_convenience(global_loadparm)); if (composite_nomem(nbtsock, state->ctx)) return; name_req = nbt_name_status_send(nbtsock, &state->node_status); diff --git a/source4/libcli/resolve/nbtlist.c b/source4/libcli/resolve/nbtlist.c index 34578e953a..887bdd7ecf 100644 --- a/source4/libcli/resolve/nbtlist.c +++ b/source4/libcli/resolve/nbtlist.c @@ -141,7 +141,8 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx, return c; } - state->nbtsock = nbt_name_socket_init(state, event_ctx); + state->nbtsock = nbt_name_socket_init(state, event_ctx, + lp_iconv_convenience(global_loadparm)); if (composite_nomem(state->nbtsock, c)) return c; /* count the address_list size */ diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index c9185c749b..c4f9cabb11 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -747,7 +747,8 @@ static void becomeDC_send_cldap(struct libnet_BecomeDC_state *s) s->cldap.io.in.acct_control = -1; s->cldap.io.in.version = 6; - s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx); + s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx, + lp_iconv_convenience(s->libnet->lp_ctx)); if (composite_nomem(s->cldap.sock, c)) return; req = cldap_netlogon_send(s->cldap.sock, &s->cldap.io); diff --git a/source4/libnet/libnet_site.c b/source4/libnet/libnet_site.c index 9db9494865..dabd23a5be 100644 --- a/source4/libnet/libnet_site.c +++ b/source4/libnet/libnet_site.c @@ -55,7 +55,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r) search.in.acct_control = -1; search.in.version = 6; - cldap = cldap_socket_init(tmp_ctx, NULL); + cldap = cldap_socket_init(tmp_ctx, NULL, lp_iconv_convenience(global_loadparm)); status = cldap_netlogon(cldap, tmp_ctx, &search); if (!NT_STATUS_IS_OK(status)) { /* diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index 415912e34d..5d346ac166 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -267,7 +267,8 @@ static void unbecomeDC_send_cldap(struct libnet_UnbecomeDC_state *s) s->cldap.io.in.acct_control = -1; s->cldap.io.in.version = 6; - s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx); + s->cldap.sock = cldap_socket_init(s, s->libnet->event_ctx, + lp_iconv_convenience(s->libnet->lp_ctx)); if (composite_nomem(s->cldap.sock, c)) return; req = cldap_netlogon_send(s->cldap.sock, &s->cldap.io); diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index b19a5d7160..a379398f19 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -351,7 +351,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c, /* non-signed packets are simpler */ if (!c->security_state.auth_info || !c->security_state.generic_state) { - return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info); + return ncacn_push_auth(blob, mem_ctx, c->iconv_convenience, pkt, c->security_state.auth_info); } ndr = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); @@ -750,7 +750,7 @@ struct composite_context *dcerpc_bind_send(struct dcerpc_pipe *p, pkt.u.bind.auth_info = data_blob(NULL, 0); /* construct the NDR form of the packet */ - c->status = ncacn_push_auth(&blob, c, &pkt, + c->status = ncacn_push_auth(&blob, c, p->conn->iconv_convenience, &pkt, p->conn->security_state.auth_info); if (!composite_is_ok(c)) return c; @@ -813,7 +813,7 @@ NTSTATUS dcerpc_auth3(struct dcerpc_connection *c, pkt.u.auth3.auth_info = data_blob(NULL, 0); /* construct the NDR form of the packet */ - status = ncacn_push_auth(&blob, mem_ctx, &pkt, c->security_state.auth_info); + status = ncacn_push_auth(&blob, mem_ctx, c->iconv_convenience, &pkt, c->security_state.auth_info); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -1646,7 +1646,7 @@ struct composite_context *dcerpc_alter_context_send(struct dcerpc_pipe *p, pkt.u.alter.auth_info = data_blob(NULL, 0); /* construct the NDR form of the packet */ - c->status = ncacn_push_auth(&blob, mem_ctx, &pkt, + c->status = ncacn_push_auth(&blob, mem_ctx, p->conn->iconv_convenience, &pkt, p->conn->security_state.auth_info); if (!composite_is_ok(c)) return c; diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index 4e5d049d66..b8128baf43 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -50,13 +50,14 @@ const struct ndr_interface_call *dcerpc_iface_find_call(const struct ndr_interfa push a ncacn_packet into a blob, potentially with auth info */ NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, + struct smb_iconv_convenience *iconv_convenience, struct ncacn_packet *pkt, struct dcerpc_auth *auth_info) { struct ndr_push *ndr; enum ndr_err_code ndr_err; - ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm)); + ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience); if (!ndr) { return NT_STATUS_NO_MEMORY; } diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 94d32488eb..23aa3fb668 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -45,6 +45,7 @@ struct notify_context { struct notify_array *array; int seqnum; struct sys_notify_context *sys_notify_ctx; + struct smb_iconv_convenience *iconv_convenience; }; @@ -107,6 +108,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, notify->messaging_ctx = messaging_ctx; notify->list = NULL; notify->array = NULL; + notify->iconv_convenience = lp_iconv_convenience(lp_ctx); notify->seqnum = tdb_get_seqnum(notify->w->tdb); talloc_set_destructor(notify, notify_destructor); @@ -171,7 +173,7 @@ static NTSTATUS notify_load(struct notify_context *notify) blob.data = dbuf.dptr; blob.length = dbuf.dsize; - ndr_err = ndr_pull_struct_blob(&blob, notify->array, lp_iconv_convenience(global_loadparm), + ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->iconv_convenience, notify->array, (ndr_pull_flags_fn_t)ndr_pull_notify_array); free(dbuf.dptr); @@ -220,7 +222,7 @@ static NTSTATUS notify_save(struct notify_context *notify) tmp_ctx = talloc_new(notify); NT_STATUS_HAVE_NO_MEMORY(tmp_ctx); - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, lp_iconv_convenience(global_loadparm), notify->array, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->iconv_convenience, notify->array, (ndr_push_flags_fn_t)ndr_push_notify_array); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -256,7 +258,7 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data return; } - ndr_err = ndr_pull_struct_blob(data, tmp_ctx, lp_iconv_convenience(global_loadparm), &ev, + ndr_err = ndr_pull_struct_blob(data, tmp_ctx, notify->iconv_convenience, &ev, (ndr_pull_flags_fn_t)ndr_pull_notify_event); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -555,7 +557,7 @@ static void notify_send(struct notify_context *notify, struct notify_entry *e, tmp_ctx = talloc_new(notify); - ndr_err = ndr_push_struct_blob(&data, tmp_ctx, lp_iconv_convenience(global_loadparm), &ev, (ndr_push_flags_fn_t)ndr_push_notify_event); + ndr_err = ndr_push_struct_blob(&data, tmp_ctx, notify->iconv_convenience, &ev, (ndr_push_flags_fn_t)ndr_push_notify_event); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); return; diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index 39090bf702..b66d252a45 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -140,7 +140,7 @@ _PUBLIC_ NTSTATUS pvfs_xattr_ndr_save(struct pvfs_state *pvfs, NTSTATUS status; enum ndr_err_code ndr_err; - ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(global_loadparm), p, (ndr_push_flags_fn_t)push_fn); + ndr_err = ndr_push_struct_blob(&blob, mem_ctx, lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), p, (ndr_push_flags_fn_t)push_fn); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(mem_ctx); return ndr_map_error2ntstatus(ndr_err); diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index b043424faa..6e53c7c8ae 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -462,7 +462,7 @@ static NTSTATUS dcesrv_fault(struct dcesrv_call_state *call, uint32_t fault_code return NT_STATUS_NO_MEMORY; } - status = ncacn_push_auth(&rep->blob, call, &pkt, NULL); + status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, NULL); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -501,7 +501,7 @@ static NTSTATUS dcesrv_bind_nak(struct dcesrv_call_state *call, uint32_t reason) return NT_STATUS_NO_MEMORY; } - status = ncacn_push_auth(&rep->blob, call, &pkt, NULL); + status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, NULL); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -642,8 +642,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) return NT_STATUS_NO_MEMORY; } - status = ncacn_push_auth(&rep->blob, call, &pkt, - call->conn->auth_state.auth_info); + status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, call->conn->auth_state.auth_info); if (!NT_STATUS_IS_OK(status)) { return status; } @@ -787,8 +786,7 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call) return NT_STATUS_NO_MEMORY; } - status = ncacn_push_auth(&rep->blob, call, &pkt, - call->conn->auth_state.auth_info); + status = ncacn_push_auth(&rep->blob, call, lp_iconv_convenience(call->conn->dce_ctx->lp_ctx), &pkt, call->conn->auth_state.auth_info); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c index dce775591b..75b13bb824 100644 --- a/source4/rpc_server/dcesrv_auth.c +++ b/source4/rpc_server/dcesrv_auth.c @@ -402,7 +402,7 @@ bool dcesrv_auth_response(struct dcesrv_call_state *call, /* non-signed packets are simple */ if (!dce_conn->auth_state.auth_info || !dce_conn->auth_state.gensec_security) { - status = ncacn_push_auth(blob, call, pkt, NULL); + status = ncacn_push_auth(blob, call, lp_iconv_convenience(dce_conn->dce_ctx->lp_ctx), pkt, NULL); return NT_STATUS_IS_OK(status); } diff --git a/source4/smb_server/smb/request.c b/source4/smb_server/smb/request.c index d7f3793f23..87073517dd 100644 --- a/source4/smb_server/smb/request.c +++ b/source4/smb_server/smb/request.c @@ -423,7 +423,7 @@ size_t req_push_str(struct smbsrv_request *req, uint8_t *dest, const char *str, dest = req->out.buffer + PTR_DIFF(dest, buf0); } - len = push_string(lp_iconv_convenience(global_loadparm), dest, str, len, flags); + len = push_string(lp_iconv_convenience(req->smb_conn->lp_ctx), dest, str, len, flags); grow_size = len + PTR_DIFF(dest, req->out.data); -- cgit