r26431: Require ndr_push creators to specify a iconv_convenience context.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 13 Dec 2007 21:46:23 +0000 (22:46 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:50:00 +0000 (05:50 +0100)
(This used to be commit 7352206f4450fdf881b95bda064cedd9d2477e4c)

19 files changed:
source4/cluster/cluster.c
source4/cluster/cluster.h
source4/cluster/cluster_private.h
source4/cluster/ctdb/ctdb_cluster.c
source4/cluster/local.c
source4/lib/messaging/messaging.c
source4/libcli/raw/rawacl.c
source4/librpc/ndr/ndr.c
source4/librpc/ndr/ndr_compression.c
source4/librpc/ndr/ndr_spoolss_buf.c
source4/librpc/rpc/dcerpc.c
source4/librpc/rpc/dcerpc_util.c
source4/librpc/tools/ndrdump.c
source4/ntvfs/common/notify.c
source4/ntvfs/common/opendb_tdb.c
source4/ntvfs/ipc/ipc_rap.c
source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcesrv_auth.c
source4/torture/rap/rap.c

index 673ce2be4e121119459d38e89c14d01250c75426..6bac1dcbe504f79597c3c0d29155232abd7ca9b6 100644 (file)
@@ -69,10 +69,10 @@ const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id)
 /*
   open a temporary tdb in a cluster friendly manner
 */
-struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, const char *dbname, int flags)
+struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *dbname, int flags)
 {
        cluster_init();
-       return ops->cluster_tdb_tmp_open(ops, mem_ctx, dbname, flags);
+       return ops->cluster_tdb_tmp_open(ops, mem_ctx, lp_ctx, dbname, flags);
 }
 
 
index c83cc2cfa33719678c6641298b772fb862464597..7cd31282cc10aab94252197f78dd47c45d4d8eb1 100644 (file)
@@ -38,7 +38,7 @@ typedef void (*cluster_message_fn_t)(struct messaging_context *, DATA_BLOB);
 /* prototypes */
 struct server_id cluster_id(uint32_t id);
 const char *cluster_id_string(TALLOC_CTX *mem_ctx, struct server_id id);
-struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, const char *dbname, int flags);
+struct tdb_wrap *cluster_tdb_tmp_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, const char *dbname, int flags);
 void *cluster_backend_handle(void);
 
 NTSTATUS cluster_message_init(struct messaging_context *msg, struct server_id server,
index 6307ba8ae6518e102d1b482011b84eb58e839de3..1c895b8640d54e1d46f323280fd813c5c4d6ade5 100644 (file)
@@ -27,7 +27,9 @@ struct cluster_ops {
        const char *(*cluster_id_string)(struct cluster_ops *ops, 
                                         TALLOC_CTX *, struct server_id );
        struct tdb_wrap *(*cluster_tdb_tmp_open)(struct cluster_ops *,
-                                                TALLOC_CTX *, const char *, int);
+                                                TALLOC_CTX *, 
+                                                struct loadparm_context *,
+                                                const char *, int);
        void *(*backend_handle)(struct cluster_ops *);
        NTSTATUS (*message_init)(struct cluster_ops *ops, 
                                 struct messaging_context *msg, struct server_id server,
index 6bac35080521dde3ccfe503973d36fc4d540f357..9a543ee3ee58a6235c5113c9118cb0e55a46c135 100644 (file)
@@ -80,6 +80,7 @@ static const char *ctdb_id_string(struct cluster_ops *ops,
 */
 static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops,
                                          TALLOC_CTX *mem_ctx, 
+                                         struct loadparm_context *lp_ctx,
                                          const char *dbname, int flags)
 {
        const char *dir = lp_parm_string(global_loadparm, NULL, "ctdb", "shared data");
index c994596930a5772b1fe03b35b43478d2f3c0fda2..539e47d271318342d6b97487ef768cd22f45ce78 100644 (file)
@@ -56,9 +56,10 @@ static const char *local_id_string(struct cluster_ops *ops,
 */
 static struct tdb_wrap *local_tdb_tmp_open(struct cluster_ops *ops,
                                           TALLOC_CTX *mem_ctx, 
+                                          struct loadparm_context *lp_ctx,
                                           const char *dbname, int flags)
 {
-       char *path = smbd_tmp_path(mem_ctx, global_loadparm, dbname);
+       char *path = smbd_tmp_path(mem_ctx, lp_ctx, dbname);
        struct tdb_wrap *w;
        w = tdb_wrap_open(mem_ctx, path, 0, flags,
                          O_RDWR|O_CREAT, 0600);
index df0bfa32a69f5c03344782a104948212e19f0812..9497e5248c2138b83dbc56681f57e0a1f4bd8310 100644 (file)
@@ -698,7 +698,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);
+       push = ndr_push_init_ctx(m->ndr, lp_iconv_convenience(global_loadparm));
        if (push == NULL) {
                status = NT_STATUS_NO_MEMORY;
                goto failed;
@@ -890,7 +890,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);
+       ndr = ndr_push_init_ctx(irpc, lp_iconv_convenience(global_loadparm));
        if (ndr == NULL) goto failed;
 
        ndr_err = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header);
index 0f2fdb60af5eef89a63de047cec9f08ec0d8c05f..e7747de94c876fda4dfb1ca3bb12a46ef1d88049 100644 (file)
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "libcli/raw/libcliraw.h"
 #include "librpc/gen_ndr/ndr_security.h"
+#include "param/param.h"
 
 /****************************************************************************
 fetch file ACL (async send)
@@ -134,7 +135,7 @@ struct smbcli_request *smb_raw_set_secdesc_send(struct smbcli_tree *tree,
        nt.in.params.data = params;
        nt.in.params.length = 8;
 
-       ndr = ndr_push_init_ctx(NULL);
+       ndr = ndr_push_init_ctx(NULL, lp_iconv_convenience(global_loadparm));
        if (!ndr) return NULL;
 
        ndr_err = ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, io->set_secdesc.in.sd);
index 070ad99a827c71d5ea7eee0dbf1588eb86d249cf..f547bd3d0fcff53cc0e9ef33fdaba5ebb6b252b6 100644 (file)
@@ -101,7 +101,7 @@ static enum ndr_err_code ndr_pull_set_offset(struct ndr_pull *ndr, uint32_t ofs)
 }
 
 /* create a ndr_push structure, ready for some marshalling */
-_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
+_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience)
 {
        struct ndr_push *ndr;
 
@@ -116,7 +116,7 @@ _PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
        if (!ndr->data) {
                return NULL;
        }
-       ndr->iconv_convenience = talloc_reference(ndr, lp_iconv_convenience(global_loadparm));
+       ndr->iconv_convenience = talloc_reference(ndr, iconv_convenience);
 
        return ndr;
 }
@@ -471,7 +471,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr,
 {
        struct ndr_push *subndr;
 
-       subndr = ndr_push_init_ctx(ndr);
+       subndr = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
        NDR_ERR_HAVE_NO_MEMORY(subndr);
        subndr->flags   = ndr->flags;
 
@@ -759,7 +759,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem
                              ndr_push_flags_fn_t fn)
 {
        struct ndr_push *ndr;
-       ndr = ndr_push_init_ctx(mem_ctx);
+       ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        NDR_ERR_HAVE_NO_MEMORY(ndr);
 
        NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
@@ -778,7 +778,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_
                             uint32_t level, ndr_push_flags_fn_t fn)
 {
        struct ndr_push *ndr;
-       ndr = ndr_push_init_ctx(mem_ctx);
+       ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        NDR_ERR_HAVE_NO_MEMORY(ndr);
 
        NDR_CHECK(ndr_push_set_switch_value(ndr, p, level));
@@ -803,7 +803,7 @@ _PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t pu
        /* avoid recursion */
        if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
 
-       ndr = ndr_push_init_ctx(NULL);
+       ndr = ndr_push_init_ctx(NULL, lp_iconv_convenience(global_loadparm));
        if (!ndr) return 0;
        ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
        status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
@@ -828,7 +828,7 @@ _PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_pus
        /* avoid recursion */
        if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
 
-       ndr = ndr_push_init_ctx(NULL);
+       ndr = ndr_push_init_ctx(NULL, lp_iconv_convenience(global_loadparm));
        if (!ndr) return 0;
        ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
 
index 411d4a17e2e992d3b1b79345c8210f479c7803a4..310f8c4ce44dfa487535c0bafc96aa76f03701fb 100644 (file)
@@ -86,7 +86,7 @@ static enum ndr_err_code ndr_pull_compression_mszip(struct ndr_pull *subndr,
        struct decomp_state *decomp_state;
        bool last = false;
 
-       ndrpush = ndr_push_init_ctx(subndr);
+       ndrpush = ndr_push_init_ctx(subndr, subndr->iconv_convenience);
        NDR_ERR_HAVE_NO_MEMORY(ndrpush);
 
        decomp_state = ZIPdecomp_state(subndr);
@@ -197,7 +197,7 @@ static enum ndr_err_code ndr_pull_compression_xpress(struct ndr_pull *subndr,
        DATA_BLOB uncompressed;
        bool last = false;
 
-       ndrpush = ndr_push_init_ctx(subndr);
+       ndrpush = ndr_push_init_ctx(subndr, subndr->iconv_convenience);
        NDR_ERR_HAVE_NO_MEMORY(ndrpush);
 
        while (!last) {
@@ -264,7 +264,7 @@ enum ndr_err_code ndr_push_compression_start(struct ndr_push *subndr,
 {
        struct ndr_push *comndr;
 
-       comndr = ndr_push_init_ctx(subndr);
+       comndr = ndr_push_init_ctx(subndr, subndr->iconv_convenience);
        NDR_ERR_HAVE_NO_MEMORY(comndr);
        comndr->flags   = subndr->flags;
 
index 9800430203c94d3228eca42f7293dd3c6a4019b8..d389c26255612ef9a1602b2bb6cc105350954a48 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "includes.h"
 #include "librpc/gen_ndr/ndr_spoolss.h"
+#include "param/param.h"
 
 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
        if (!r->in.buffer && r->in.offered != 0) {\
@@ -55,7 +56,7 @@
        }\
        if (r->in.buffer) {\
                DATA_BLOB _data_blob_info;\
-               _ndr_info = ndr_push_init_ctx(ndr);\
+               _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
                NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
                _ndr_info->flags= ndr->flags;\
                if (r->out.info) {\
 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
        struct __##fn __r;\
        DATA_BLOB _data_blob_info;\
-       struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx);\
+       struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));\
        if (!_ndr_info) return 0;\
        _ndr_info->flags|=0;\
        __r.in.level    = level;\
@@ -414,7 +415,7 @@ enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flag
                _r.out.result   = r->out.result;
                {
                        struct __spoolss_GetPrinterData __r;
-                       _ndr_info = ndr_push_init_ctx(ndr);
+                       _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
                        NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
                        _ndr_info->flags= ndr->flags;
                        __r.in.type     = r->out.type;
@@ -494,7 +495,7 @@ enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flag
                struct __spoolss_SetPrinterData __r;
                DATA_BLOB _data_blob_data;
 
-               _ndr_data = ndr_push_init_ctx(ndr);
+               _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
                NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
                _ndr_data->flags= ndr->flags;
 
index 432cd09094353028d203f6f35486d81fdd8e7ad6..a1b1f6e82584f405b1d1686e67298de75d27fe8b 100644 (file)
@@ -350,7 +350,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c,
                return ncacn_push_auth(blob, mem_ctx, pkt, c->security_state.auth_info);
        }
 
-       ndr = ndr_push_init_ctx(mem_ctx);
+       ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        if (!ndr) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -1194,7 +1194,7 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c,
                return ndr_map_error2ntstatus(ndr_err);
        }
 
-       push = ndr_push_init_ctx(mem_ctx);
+       push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        if (!push) {
                return NT_STATUS_NO_MEMORY;
        }       
@@ -1252,7 +1252,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
        }
        memcpy(st, struct_ptr, struct_size);
 
-       push = ndr_push_init_ctx(mem_ctx);
+       push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        if (!push) {
                return NT_STATUS_NO_MEMORY;
        }       
@@ -1283,7 +1283,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
                return ndr_map_error2ntstatus(ndr_err);
        }
 
-       push = ndr_push_init_ctx(mem_ctx);
+       push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        if (!push) {
                return NT_STATUS_NO_MEMORY;
        }       
@@ -1354,7 +1354,7 @@ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p,
        call = &table->calls[opnum];
 
        /* setup for a ndr_push_* call */
-       push = ndr_push_init_ctx(mem_ctx);
+       push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        if (!push) {
                return NULL;
        }
index 2fa34140f6c574bf01f06ac322ccac51f49a00d6..c53bdca9d1bada296655391ffeed6b8b618b6038 100644 (file)
@@ -56,7 +56,7 @@ NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
        struct ndr_push *ndr;
        enum ndr_err_code ndr_err;
 
-       ndr = ndr_push_init_ctx(mem_ctx);
+       ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        if (!ndr) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -466,7 +466,7 @@ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_synta
 
 static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
 {
-       struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
+       struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
 
        ndr->flags |= LIBNDR_FLAG_NOALIGN;
 
index a86b349aa962f5f02713b3f9638497166777bca3..7ee702fefb5e4a7ff4199458581377574c4a537b 100644 (file)
@@ -25,6 +25,7 @@
 #include "system/locale.h"
 #include "librpc/ndr/libndr.h"
 #include "librpc/ndr/ndr_table.h"
+#include "param/param.h"
 #endif
 
 static const struct ndr_interface_call *find_function(
@@ -379,7 +380,7 @@ static void ndrdump_data(uint8_t *d, uint32_t l, bool force)
                uint8_t byte_a, byte_b;
                bool differ;
 
-               ndr_v_push = ndr_push_init_ctx(mem_ctx);
+               ndr_v_push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(cmdline_lp_ctx));
                
                ndr_err = f->ndr_push(ndr_v_push, flags, st);
                status = ndr_map_error2ntstatus(ndr_err);
index 16cf4e4b5421c739e080e6538aea6c4b4562d5fe..187a349b4bf111ac8d7576a9b6c42efb9245a0fc 100644 (file)
@@ -35,6 +35,7 @@
 #include "ntvfs/common/ntvfs_common.h"
 #include "ntvfs/sysdep/sys_notify.h"
 #include "cluster/cluster.h"
+#include "param/param.h"
 
 struct notify_context {
        struct tdb_wrap *w;
@@ -95,7 +96,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
                return NULL;
        }
 
-       notify->w = cluster_tdb_tmp_open(notify, "notify.tdb", TDB_SEQNUM);
+       notify->w = cluster_tdb_tmp_open(notify, global_loadparm, "notify.tdb", TDB_SEQNUM);
        if (notify->w == NULL) {
                talloc_free(notify);
                return NULL;
index b8b8a5cb3322d8e71f21be3fb7213d29eddc3a20..41b5ad2ebe238e7c28dce6c0bf88ab287046337c 100644 (file)
@@ -79,7 +79,7 @@ static struct odb_context *odb_tdb_init(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       odb->w = cluster_tdb_tmp_open(odb, "openfiles.tdb", TDB_DEFAULT);
+       odb->w = cluster_tdb_tmp_open(odb, ntvfs_ctx->lp_ctx, "openfiles.tdb", TDB_DEFAULT);
        if (odb->w == NULL) {
                talloc_free(odb);
                return NULL;
index d8e9812dd8ce01bf7e02ac7096727230b44d37b6..0636e42e16d918a457dd3ddbee90673b7809233c 100644 (file)
@@ -23,6 +23,7 @@
 #include "libcli/rap/rap.h"
 #include "ntvfs/ipc/proto.h"
 #include "librpc/ndr/libndr.h"
+#include "param/param.h"
 
 #define NDR_RETURN(call) do { \
        enum ndr_err_code _ndr_err; \
@@ -444,8 +445,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
        NDR_RETURN(ndr_pull_string(call->ndr_pull_param, NDR_SCALARS,
                                  &call->datadesc));
 
-       call->ndr_push_param = ndr_push_init_ctx(call);
-       call->ndr_push_data = ndr_push_init_ctx(call);
+       call->ndr_push_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+       call->ndr_push_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
 
        if ((call->ndr_push_param == NULL) || (call->ndr_push_data == NULL))
                return NT_STATUS_NO_MEMORY;
@@ -470,8 +471,8 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct smb_trans2 *trans)
        result_param = ndr_push_blob(call->ndr_push_param);
        result_data = ndr_push_blob(call->ndr_push_data);
 
-       final_param = ndr_push_init_ctx(call);
-       final_data = ndr_push_init_ctx(call);
+       final_param = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
+       final_data = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
 
        if ((final_param == NULL) || (final_data == NULL))
                return NT_STATUS_NO_MEMORY;
index 256f20ed5400dabbf68644aee972edf87a690ecb..db4136a853306d7b0e53f8631b419ec63f33d5fb 100644 (file)
@@ -884,7 +884,7 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call)
        }
 
        /* form the reply NDR */
-       push = ndr_push_init_ctx(call);
+       push = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
        NT_STATUS_HAVE_NO_MEMORY(push);
 
        /* carry over the pointer count to the reply in case we are
index 319dc0788a0b262ee2dd99e28e82fb8d15e66205..b7c0e2a8339d986d9a3260d7b0374b034d67cfa8 100644 (file)
@@ -406,7 +406,7 @@ bool dcesrv_auth_response(struct dcesrv_call_state *call,
                return NT_STATUS_IS_OK(status);
        }
 
-       ndr = ndr_push_init_ctx(call);
+       ndr = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
        if (!ndr) {
                return false;
        }
index d39a83034d98e4e248d3d11498268cb694e44e6b..8e630b6781495c10a751c3ae00a7e6f31231726c 100644 (file)
@@ -87,10 +87,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);
+       call->ndr_push_param = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        call->ndr_push_param->flags = RAPNDR_FLAGS;
 
-       call->ndr_push_data = ndr_push_init_ctx(mem_ctx);
+       call->ndr_push_data = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
        call->ndr_push_data->flags = RAPNDR_FLAGS;
 
        return call;
@@ -195,7 +195,7 @@ static NTSTATUS rap_cli_do_call(struct smbcli_tree *tree, struct rap_call *call)
        struct ndr_push *params;
        struct smb_trans2 trans;
 
-       params = ndr_push_init_ctx(call);
+       params = ndr_push_init_ctx(call, lp_iconv_convenience(global_loadparm));
 
        if (params == NULL)
                return NT_STATUS_NO_MEMORY;