summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-01-01 22:05:13 -0600
committerStefan Metzmacher <metze@samba.org>2008-01-01 16:12:15 -0600
commit7d5f0e0893d42b56145a3ffa34e3b4b9906cbd91 (patch)
tree444af87d26b95edc8293bdbd669ddddd54f9b177 /source4/librpc
parent86dc05e99f124db47f2743d1fc23117a7f5145ab (diff)
downloadsamba-7d5f0e0893d42b56145a3ffa34e3b4b9906cbd91.tar.gz
samba-7d5f0e0893d42b56145a3ffa34e3b4b9906cbd91.tar.bz2
samba-7d5f0e0893d42b56145a3ffa34e3b4b9906cbd91.zip
r26639: librpc: Pass iconv convenience on from RPC connection to NDR library, so it can be overridden by OpenChange.
(This used to be commit 2f29f80e07adef1f020173f2cd6d947d0ef505ce)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/ndr.c25
-rw-r--r--source4/librpc/rpc/dcerpc.c26
-rw-r--r--source4/librpc/rpc/dcerpc.h1
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c2
-rw-r--r--source4/librpc/rpc/dcerpc_secondary.c2
5 files changed, 33 insertions, 23 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index fc1a5750dd..e6da096403 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -690,11 +690,11 @@ _PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *
/*
pull a struct from a blob using NDR
*/
-_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p,
ndr_pull_flags_fn_t fn)
{
struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
+ ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
NDR_ERR_HAVE_NO_MEMORY(ndr);
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
return NDR_ERR_SUCCESS;
@@ -703,11 +703,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CT
/*
pull a struct from a blob using NDR - failing if all bytes are not consumed
*/
-_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- ndr_pull_flags_fn_t fn)
+_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
+ void *p, ndr_pull_flags_fn_t fn)
{
struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
+ ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
NDR_ERR_HAVE_NO_MEMORY(ndr);
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
if (ndr->offset < ndr->data_size) {
@@ -721,11 +722,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLO
/*
pull a union from a blob using NDR, given the union discriminator
*/
-_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience, void *p,
uint32_t level, ndr_pull_flags_fn_t fn)
{
struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
+ ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
NDR_ERR_HAVE_NO_MEMORY(ndr);
NDR_CHECK(ndr_pull_set_switch_value(ndr, p, level));
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
@@ -736,11 +738,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX
pull a union from a blob using NDR, given the union discriminator,
failing if all bytes are not consumed
*/
-_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience, void *p,
uint32_t level, ndr_pull_flags_fn_t fn)
{
struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
+ ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience);
NDR_ERR_HAVE_NO_MEMORY(ndr);
NDR_CHECK(ndr_pull_set_switch_value(ndr, p, level));
NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
@@ -773,11 +776,11 @@ _PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem
/*
push a union to a blob using NDR
*/
-_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
+_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, void *p,
uint32_t level, ndr_push_flags_fn_t fn)
{
struct ndr_push *ndr;
- ndr = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+ ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience);
NDR_ERR_HAVE_NO_MEMORY(ndr);
NDR_CHECK(ndr_push_set_switch_value(ndr, p, level));
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index f5eae1b09a..b19a5d7160 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -56,7 +56,8 @@ static int dcerpc_connection_destructor(struct dcerpc_connection *conn)
the event context is optional
*/
static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx,
- struct event_context *ev)
+ struct event_context *ev,
+ struct smb_iconv_convenience *ic)
{
struct dcerpc_connection *c;
@@ -73,6 +74,8 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx,
}
}
+ c->iconv_convenience = talloc_reference(c, ic);
+
c->event_ctx = ev;
if (!talloc_reference(c, ev)) {
@@ -95,7 +98,8 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx,
}
/* initialise a dcerpc pipe. */
-struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *ev)
+struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *ev,
+ struct smb_iconv_convenience *ic)
{
struct dcerpc_pipe *p;
@@ -104,7 +108,7 @@ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct event_context *
return NULL;
}
- p->conn = dcerpc_connection_init(p, ev);
+ p->conn = dcerpc_connection_init(p, ev, ic);
if (p->conn == NULL) {
talloc_free(p);
return NULL;
@@ -170,7 +174,7 @@ void dcerpc_set_auth_length(DATA_BLOB *blob, uint16_t v)
static struct ndr_pull *ndr_pull_init_flags(struct dcerpc_connection *c,
DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
{
- struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx, lp_iconv_convenience(global_loadparm));
+ struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx, c->iconv_convenience);
if (ndr == NULL) return ndr;
@@ -350,7 +354,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, lp_iconv_convenience(global_loadparm));
+ ndr = ndr_push_init_ctx(mem_ctx, c->iconv_convenience);
if (!ndr) {
return NT_STATUS_NO_MEMORY;
}
@@ -666,6 +670,7 @@ static void dcerpc_bind_recv_handler(struct rpc_request *req,
enum ndr_err_code ndr_err;
ndr_err = ndr_pull_struct_blob(
&pkt->u.bind_ack.auth_info, conn,
+ NULL,
conn->security_state.auth_info,
(ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -1194,7 +1199,7 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c,
return ndr_map_error2ntstatus(ndr_err);
}
- push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+ push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience);
if (!push) {
return NT_STATUS_NO_MEMORY;
}
@@ -1252,7 +1257,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
}
memcpy(st, struct_ptr, struct_size);
- push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+ push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience);
if (!push) {
return NT_STATUS_NO_MEMORY;
}
@@ -1283,7 +1288,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
return ndr_map_error2ntstatus(ndr_err);
}
- push = ndr_push_init_ctx(mem_ctx, lp_iconv_convenience(global_loadparm));
+ push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience);
if (!push) {
return NT_STATUS_NO_MEMORY;
}
@@ -1334,7 +1339,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c,
}
-/*
+/**
send a rpc request given a dcerpc_call structure
*/
struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p,
@@ -1354,7 +1359,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, lp_iconv_convenience(global_loadparm));
+ push = ndr_push_init_ctx(mem_ctx, p->conn->iconv_convenience);
if (!push) {
return NULL;
}
@@ -1584,6 +1589,7 @@ static void dcerpc_alter_recv_handler(struct rpc_request *req,
enum ndr_err_code ndr_err;
ndr_err = ndr_pull_struct_blob(
&pkt->u.alter_resp.auth_info, recv_pipe,
+ NULL,
recv_pipe->conn->security_state.auth_info,
(ndr_pull_flags_fn_t)ndr_pull_dcerpc_auth);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h
index 9936ebe001..7c6aa7513b 100644
--- a/source4/librpc/rpc/dcerpc.h
+++ b/source4/librpc/rpc/dcerpc.h
@@ -55,6 +55,7 @@ struct dcerpc_connection {
struct dcerpc_security security_state;
const char *binding_string;
struct event_context *event_ctx;
+ struct smb_iconv_convenience *iconv_convenience;
bool dead;
bool free_skipped;
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index 8fd783fb83..63fd25dd1a 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -731,7 +731,7 @@ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent_ctx,
c->private_data = s;
/* initialise dcerpc pipe structure */
- s->pipe = dcerpc_pipe_init(c, ev);
+ s->pipe = dcerpc_pipe_init(c, ev, lp_iconv_convenience(lp_ctx));
if (composite_nomem(s->pipe, c)) return c;
/* store parameters in state structure */
diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c
index 5e8dd955d3..ab98215180 100644
--- a/source4/librpc/rpc/dcerpc_secondary.c
+++ b/source4/librpc/rpc/dcerpc_secondary.c
@@ -71,7 +71,7 @@ struct composite_context* dcerpc_secondary_connection_send(struct dcerpc_pipe *p
s->binding = b;
/* initialise second dcerpc pipe based on primary pipe's event context */
- s->pipe2 = dcerpc_pipe_init(c, s->pipe->conn->event_ctx);
+ s->pipe2 = dcerpc_pipe_init(c, s->pipe->conn->event_ctx, s->pipe->conn->iconv_convenience);
if (composite_nomem(s->pipe2, c)) return c;
/* open second dcerpc pipe using the same transport as for primary pipe */