diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/messaging/irpc.h | 2 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 12 | ||||
-rw-r--r-- | source4/lib/messaging/tests/irpc.c | 8 | ||||
-rw-r--r-- | source4/lib/messaging/tests/messaging.c | 8 |
4 files changed, 22 insertions, 8 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"); |