From 84b476394713d4f2b84782c59dcc084a25af360f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 23:23:25 +0100 Subject: r26441: Remove global_loadparm uses. (This used to be commit 32007c6277efa46341da7741b749a98633d71640) --- source4/lib/messaging/irpc.h | 2 ++ source4/lib/messaging/messaging.c | 12 ++++++++---- source4/lib/messaging/tests/irpc.c | 8 ++++++-- source4/lib/messaging/tests/messaging.c | 8 ++++++-- source4/libnet/libnet_lookup.c | 3 ++- source4/scripting/ejs/smbcalls_auth.c | 3 ++- source4/scripting/ejs/smbcalls_rpc.c | 4 +++- source4/smbd/service_stream.c | 4 +++- source4/smbd/service_task.c | 4 +++- source4/utils/getntacl.c | 2 +- source4/utils/ntlm_auth.c | 3 ++- 11 files changed, 38 insertions(+), 15 deletions(-) diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h index 989e5d4255..d596c6721e 100644 --- a/source4/lib/messaging/irpc.h +++ b/source4/lib/messaging/irpc.h @@ -92,9 +92,11 @@ NTSTATUS messaging_register_tmp(struct messaging_context *msg, void *private, struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, const char *dir, struct server_id server_id, + struct smb_iconv_convenience *iconv_convenience, struct event_context *ev); struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx, const char *dir, + struct smb_iconv_convenience *iconv_convenience, struct event_context *ev); NTSTATUS messaging_send_ptr(struct messaging_context *msg, struct server_id server, uint32_t msg_type, void *ptr); diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index af742f7374..811d5a85bf 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -49,6 +49,7 @@ struct messaging_context { struct idr_context *dispatch_tree; struct messaging_rec *pending; struct messaging_rec *retry_queue; + struct smb_iconv_convenience *iconv_convenience; struct irpc_list *irpc; struct idr_context *idr; const char **names; @@ -532,6 +533,7 @@ static int messaging_destructor(struct messaging_context *msg) struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, const char *dir, struct server_id server_id, + struct smb_iconv_convenience *iconv_convenience, struct event_context *ev) { struct messaging_context *msg; @@ -560,6 +562,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, msg->base_path = talloc_reference(msg, dir); msg->path = messaging_path(msg, server_id); msg->server_id = server_id; + msg->iconv_convenience = iconv_convenience; msg->idr = idr_init(msg); msg->dispatch_tree = idr_init(msg); msg->start_time = timeval_current(); @@ -609,12 +612,13 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, */ struct messaging_context *messaging_client_init(TALLOC_CTX *mem_ctx, const char *dir, + struct smb_iconv_convenience *iconv_convenience, struct event_context *ev) { struct server_id id; ZERO_STRUCT(id); id.id = random() % 0x10000000; - return messaging_init(mem_ctx, dir, id, ev); + return messaging_init(mem_ctx, dir, id, iconv_convenience, ev); } /* a list of registered irpc server functions @@ -698,7 +702,7 @@ NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status) m->header.status = status; /* setup the reply */ - push = ndr_push_init_ctx(m->ndr, lp_iconv_convenience(global_loadparm)); + push = ndr_push_init_ctx(m->ndr, m->msg_ctx->iconv_convenience); if (push == NULL) { status = NT_STATUS_NO_MEMORY; goto failed; @@ -798,7 +802,7 @@ static void irpc_handler(struct messaging_context *msg_ctx, void *private, m->from = src; - m->ndr = ndr_pull_init_blob(packet, m, lp_iconv_convenience(global_loadparm)); + m->ndr = ndr_pull_init_blob(packet, m, msg_ctx->iconv_convenience); if (m->ndr == NULL) goto failed; m->ndr->flags |= LIBNDR_FLAG_REF_ALLOC; @@ -890,7 +894,7 @@ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, header.status = NT_STATUS_OK; /* construct the irpc packet */ - ndr = ndr_push_init_ctx(irpc, lp_iconv_convenience(global_loadparm)); + ndr = ndr_push_init_ctx(irpc, msg_ctx->iconv_convenience); if (ndr == NULL) goto failed; ndr_err = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header); diff --git a/source4/lib/messaging/tests/irpc.c b/source4/lib/messaging/tests/irpc.c index 0618adcfb2..ce3d1045e5 100644 --- a/source4/lib/messaging/tests/irpc.c +++ b/source4/lib/messaging/tests/irpc.c @@ -221,13 +221,17 @@ static bool irpc_setup(struct torture_context *tctx, void **_data) torture_assert(tctx, data->msg_ctx1 = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(MSG_ID1), data->ev), + cluster_id(MSG_ID1), + lp_iconv_convenience(tctx->lp_ctx), + data->ev), "Failed to init first messaging context"); torture_assert(tctx, data->msg_ctx2 = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(MSG_ID2), data->ev), + cluster_id(MSG_ID2), + lp_iconv_convenience(tctx->lp_ctx), + data->ev), "Failed to init second messaging context"); /* register the server side function */ diff --git a/source4/lib/messaging/tests/messaging.c b/source4/lib/messaging/tests/messaging.c index ba3d2f91d6..0df04bce2b 100644 --- a/source4/lib/messaging/tests/messaging.c +++ b/source4/lib/messaging/tests/messaging.c @@ -73,7 +73,9 @@ static bool test_ping_speed(struct torture_context *tctx) msg_server_ctx = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(1), ev); + cluster_id(1), + lp_iconv_convenience(tctx->lp_ctx), + ev); torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context"); @@ -82,7 +84,9 @@ static bool test_ping_speed(struct torture_context *tctx) msg_client_ctx = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(2), ev); + cluster_id(2), + lp_iconv_convenience(tctx->lp_ctx), + ev); torture_assert(tctx, msg_client_ctx != NULL, "msg_client_ctx messaging_init() failed"); diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c index a7442eb32d..409cc7575b 100644 --- a/source4/libnet/libnet_lookup.c +++ b/source4/libnet/libnet_lookup.c @@ -192,7 +192,8 @@ struct composite_context* libnet_LookupDCs_send(struct libnet_context *ctx, { struct composite_context *c; struct messaging_context *msg_ctx = - messaging_client_init(mem_ctx, lp_messaging_path(mem_ctx, ctx->lp_ctx), ctx->event_ctx); + messaging_client_init(mem_ctx, lp_messaging_path(mem_ctx, ctx->lp_ctx), + lp_iconv_convenience(ctx->lp_ctx), ctx->event_ctx); c = finddcs_send(mem_ctx, lp_netbios_name(ctx->lp_ctx), lp_nbt_port(ctx->lp_ctx), io->in.domain_name, io->in.name_type, diff --git a/source4/scripting/ejs/smbcalls_auth.c b/source4/scripting/ejs/smbcalls_auth.c index 7747bb14c6..89370890c8 100644 --- a/source4/scripting/ejs/smbcalls_auth.c +++ b/source4/scripting/ejs/smbcalls_auth.c @@ -56,7 +56,8 @@ static int ejs_doauth(MprVarHandle eid, } else { /* Hope we can find the event context somewhere up there... */ ev = event_context_find(tmp_ctx); - msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, global_loadparm), ev); + msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, global_loadparm), + lp_iconv_convenience(global_loadparm), ev); } if (auth_types) { diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index 535c1d2e34..2bfc8b5883 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -80,7 +80,9 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv) for (i=0;i<10000;i++) { p->msg_ctx = messaging_init(p, lp_messaging_path(p, global_loadparm), - cluster_id(EJS_ID_BASE + i), ev); + cluster_id(EJS_ID_BASE + i), + lp_iconv_convenience(global_loadparm), + ev); if (p->msg_ctx) break; } if (p->msg_ctx == NULL) { diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 8df8c474f5..6d2e95dc94 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -183,7 +183,9 @@ static void stream_new_connection(struct event_context *ev, /* setup to receive internal messages on this connection */ srv_conn->msg_ctx = messaging_init(srv_conn, lp_messaging_path(srv_conn, global_loadparm), - srv_conn->server_id, ev); + srv_conn->server_id, + lp_iconv_convenience(global_loadparm), + ev); if (!srv_conn->msg_ctx) { stream_terminate_connection(srv_conn, "messaging_init() failed"); return; diff --git a/source4/smbd/service_task.c b/source4/smbd/service_task.c index dceda5a922..f286da5cf6 100644 --- a/source4/smbd/service_task.c +++ b/source4/smbd/service_task.c @@ -68,7 +68,9 @@ static void task_server_callback(struct event_context *event_ctx, task->msg_ctx = messaging_init(task, lp_messaging_path(task, task->lp_ctx), - task->server_id, task->event_ctx); + task->server_id, + lp_iconv_convenience(task->lp_ctx), + task->event_ctx); if (!task->msg_ctx) { task_server_terminate(task, "messaging_init() failed"); return; diff --git a/source4/utils/getntacl.c b/source4/utils/getntacl.c index e1ab97b4d5..132d689dcb 100644 --- a/source4/utils/getntacl.c +++ b/source4/utils/getntacl.c @@ -72,7 +72,7 @@ static NTSTATUS get_ntacl(TALLOC_CTX *mem_ctx, } blob.length = size; - ndr = ndr_pull_init_blob(&blob, NULL, lp_iconv_convenience(global_loadparm)); + ndr = ndr_pull_init_blob(&blob, NULL, NULL); ndr_err = ndr_pull_xattr_NTACL(ndr, NDR_SCALARS|NDR_BUFFERS, *ntacl); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 299be37765..b224689d70 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -471,7 +471,8 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, if (!ev) { exit(1); } - msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx), ev); + msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx), + lp_iconv_convenience(lp_ctx), ev); if (!msg) { exit(1); } -- cgit