diff options
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/winsrepl.idl | 2 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_string.c | 34 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 35 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 4 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_connect.c | 3 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_secondary.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_util.c | 5 |
7 files changed, 35 insertions, 50 deletions
diff --git a/source4/librpc/idl/winsrepl.idl b/source4/librpc/idl/winsrepl.idl index cedc70bb03..01b8e32bea 100644 --- a/source4/librpc/idl/winsrepl.idl +++ b/source4/librpc/idl/winsrepl.idl @@ -167,7 +167,7 @@ import "nbt.idl"; } wrepl_packet; typedef [flag(NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { - [value(ndr_size_wrepl_packet(&packet, ndr->iconv_convenience, ndr->flags))] uint32 size; + [value(ndr_size_wrepl_packet(&packet, ndr->flags))] uint32 size; wrepl_packet packet; } wrepl_wrap; diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index dfa72b5262..08c3c7fc6e 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -81,8 +81,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len2 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, chset, CH_UNIX, + if (!convert_string_talloc(ndr->current_mem_ctx, + chset, CH_UNIX, ndr->data+ndr->offset, (len2 + c_len_term)*byte_mul, (void **)&as, &ret, false)) { @@ -117,8 +117,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len1 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, + if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, @@ -155,8 +154,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len1 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, + if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, @@ -189,8 +187,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len3 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, + if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, (len3 + c_len_term)*byte_mul, @@ -221,8 +218,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len3 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, + if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, len3, @@ -241,8 +237,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, } else { len1 = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset); } - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, chset, CH_UNIX, + if (!convert_string_talloc(ndr->current_mem_ctx, + chset, CH_UNIX, ndr->data+ndr->offset, len1, (void **)&as, &ret, false)) { @@ -265,8 +261,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, if (len1 == 0) { as = talloc_strdup(ndr->current_mem_ctx, ""); } else { - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, + if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, len1, @@ -327,7 +322,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, if (!(flags & LIBNDR_FLAG_STR_NOTERM)) { s_len++; } - if (!convert_string_talloc_convenience(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest, &d_len, false)) { + if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len, (void **)&dest, &d_len, false)) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character push conversion with flags 0x%x", flags); } @@ -660,8 +655,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, NDR_PULL_NEED_BYTES(ndr, length*byte_mul); - if (!convert_string_talloc_convenience(ndr->current_mem_ctx, - ndr->iconv_convenience, + if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX, ndr->data+ndr->offset, length*byte_mul, @@ -685,9 +679,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, required = byte_mul * length; NDR_PUSH_NEED_BYTES(ndr, required); - if (!convert_string_convenience(ndr->iconv_convenience, CH_UNIX, chset, - var, strlen(var), - ndr->data+ndr->offset, required, &ret, false)) { + ret = convert_string(CH_UNIX, chset, var, strlen(var), + ndr->data+ndr->offset, required, false); + if (ret == -1) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); } diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 95f83465fc..7265105525 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -55,8 +55,7 @@ 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 tevent_context *ev, - struct smb_iconv_convenience *ic) + struct tevent_context *ev) { struct dcerpc_connection *c; @@ -65,8 +64,6 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, return NULL; } - c->iconv_convenience = talloc_reference(c, ic); - c->event_ctx = ev; if (c->event_ctx == NULL) { @@ -90,8 +87,7 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx, } /* initialise a dcerpc pipe. */ -_PUBLIC_ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct smb_iconv_convenience *ic) +_PUBLIC_ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev) { struct dcerpc_pipe *p; @@ -100,7 +96,7 @@ _PUBLIC_ struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent return NULL; } - p->conn = dcerpc_connection_init(p, ev, ic); + p->conn = dcerpc_connection_init(p, ev); if (p->conn == NULL) { talloc_free(p); return NULL; @@ -177,7 +173,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, c->iconv_convenience); + struct ndr_pull *ndr = ndr_pull_init_blob(blob, mem_ctx); if (ndr == NULL) return ndr; @@ -328,7 +324,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c, /* non-signed packets are simpler */ if (sig_size == 0) { - return ncacn_push_auth(blob, mem_ctx, c->iconv_convenience, pkt, NULL); + return ncacn_push_auth(blob, mem_ctx, pkt, NULL); } switch (c->security_state.auth_info->auth_level) { @@ -338,16 +334,16 @@ static NTSTATUS ncacn_push_request_sign(struct dcerpc_connection *c, case DCERPC_AUTH_LEVEL_CONNECT: /* TODO: let the gensec mech decide if it wants to generate a signature */ - return ncacn_push_auth(blob, mem_ctx, c->iconv_convenience, pkt, NULL); + return ncacn_push_auth(blob, mem_ctx, pkt, NULL); case DCERPC_AUTH_LEVEL_NONE: - return ncacn_push_auth(blob, mem_ctx, c->iconv_convenience, pkt, NULL); + return ncacn_push_auth(blob, mem_ctx, pkt, NULL); default: return NT_STATUS_INVALID_LEVEL; } - ndr = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); + ndr = ndr_push_init_ctx(mem_ctx); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -718,7 +714,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, p->conn->iconv_convenience, &pkt, + c->status = ncacn_push_auth(&blob, c, &pkt, p->conn->security_state.auth_info); if (!composite_is_ok(c)) return c; @@ -789,7 +785,6 @@ NTSTATUS dcerpc_auth3(struct dcerpc_pipe *p, /* construct the NDR form of the packet */ status = ncacn_push_auth(&blob, mem_ctx, - p->conn->iconv_convenience, &pkt, p->conn->security_state.auth_info); if (!NT_STATUS_IS_OK(status)) { @@ -1049,7 +1044,7 @@ static void dcerpc_ship_next_request(struct dcerpc_connection *c) if (req->object) { pkt.u.request.object.object = *req->object; pkt.pfc_flags |= DCERPC_PFC_FLAG_OBJECT_UUID; - chunk_size -= ndr_size_GUID(req->object,NULL,0); + chunk_size -= ndr_size_GUID(req->object,0); } /* we send a series of pdus without waiting for a reply */ @@ -1202,7 +1197,7 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_connection *c, return ndr_map_error2ntstatus(ndr_err); } - push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); + push = ndr_push_init_ctx(mem_ctx); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1260,7 +1255,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, } memcpy(st, struct_ptr, struct_size); - push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); + push = ndr_push_init_ctx(mem_ctx); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1291,7 +1286,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_connection *c, return ndr_map_error2ntstatus(ndr_err); } - push = ndr_push_init_ctx(mem_ctx, c->iconv_convenience); + push = ndr_push_init_ctx(mem_ctx); if (!push) { return NT_STATUS_NO_MEMORY; } @@ -1363,7 +1358,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, p->conn->iconv_convenience); + push = ndr_push_init_ctx(mem_ctx); if (!push) { return NULL; } @@ -1666,7 +1661,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, p->conn->iconv_convenience, &pkt, + c->status = ncacn_push_auth(&blob, mem_ctx, &pkt, p->conn->security_state.auth_info); if (!composite_is_ok(c)) return c; diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index 69de8c5467..b1875045bd 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -64,7 +64,6 @@ struct dcerpc_connection { struct dcerpc_security security_state; const char *binding_string; struct tevent_context *event_ctx; - struct smb_iconv_convenience *iconv_convenience; /** Directory in which to save ndrdump-parseable files */ const char *packet_log_dir; @@ -271,8 +270,7 @@ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, void *r); const char *dcerpc_server_name(struct dcerpc_pipe *p); -struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct smb_iconv_convenience *ic); +struct dcerpc_pipe *dcerpc_pipe_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev); NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe *p, struct smbcli_tree *tree, const char *pipe_name); diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index 1b1f039004..bd371be2d3 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -121,7 +121,6 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT conn->in.service_type = NULL; conn->in.workgroup = lp_workgroup(lp_ctx); conn->in.gensec_settings = lp_gensec_settings(conn, lp_ctx); - conn->in.iconv_convenience = lp_iconv_convenience(lp_ctx); lp_smbcli_options(lp_ctx, &conn->in.options); lp_smbcli_session_options(lp_ctx, &conn->in.session_options); @@ -743,7 +742,7 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent c->private_data = s; /* initialise dcerpc pipe structure */ - s->pipe = dcerpc_pipe_init(c, ev, lp_iconv_convenience(lp_ctx)); + s->pipe = dcerpc_pipe_init(c, ev); if (composite_nomem(s->pipe, c)) return c; if (DEBUGLEVEL >= 10) diff --git a/source4/librpc/rpc/dcerpc_secondary.c b/source4/librpc/rpc/dcerpc_secondary.c index 1d76c65f40..5f355a5937 100644 --- a/source4/librpc/rpc/dcerpc_secondary.c +++ b/source4/librpc/rpc/dcerpc_secondary.c @@ -73,7 +73,7 @@ _PUBLIC_ struct composite_context* dcerpc_secondary_connection_send(struct dcerp 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->pipe->conn->iconv_convenience); + s->pipe2 = dcerpc_pipe_init(c, s->pipe->conn->event_ctx); if (composite_nomem(s->pipe2, c)) return c; if (DEBUGLEVEL >= 10) diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index b71e3060e1..5873e9dd95 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -51,14 +51,13 @@ 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, iconv_convenience); + ndr = ndr_push_init_ctx(mem_ctx); if (!ndr) { return NT_STATUS_NO_MEMORY; } @@ -827,7 +826,7 @@ NTSTATUS dcerpc_pull_auth_trailer(struct ncacn_packet *pkt, *auth_length = pkt_auth_blob->length - pad; - ndr = ndr_pull_init_blob(pkt_auth_blob, mem_ctx, NULL); + ndr = ndr_pull_init_blob(pkt_auth_blob, mem_ctx); if (!ndr) { return NT_STATUS_NO_MEMORY; } |