diff options
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r-- | source4/librpc/ndr/libndr.h | 4 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr.c | 3 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_string.c | 23 |
3 files changed, 19 insertions, 11 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 2ac0b86f57..1ecc6f3c38 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -52,6 +52,8 @@ struct ndr_pull { uint32_t data_size; uint32_t offset; + struct smb_iconv_convenience *iconv_convenience; + uint32_t relative_base_offset; struct ndr_token_list *relative_base_list; @@ -84,6 +86,8 @@ struct ndr_push { /* this is used to ensure we generate unique reference IDs */ uint32_t ptr_count; + + struct smb_iconv_convenience *iconv_convenience; }; /* structure passed to functions that print IDL structures */ diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 40afeacebf..a1535d3043 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -66,6 +66,7 @@ _PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX * ndr->data = blob->data; ndr->data_size = blob->length; + ndr->iconv_convenience = talloc_reference(ndr, global_smb_iconv_convenience); return ndr; } @@ -114,6 +115,7 @@ _PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) if (!ndr->data) { return NULL; } + ndr->iconv_convenience = talloc_reference(ndr, global_smb_iconv_convenience); return ndr; } @@ -438,6 +440,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr, subndr->data = ndr->data + ndr->offset; subndr->offset = 0; subndr->data_size = r_content_size; + subndr->iconv_convenience = talloc_reference(subndr, ndr->iconv_convenience); *_subndr = subndr; return NDR_ERR_SUCCESS; diff --git a/source4/librpc/ndr/ndr_string.c b/source4/librpc/ndr/ndr_string.c index 7e84211e87..69a7eca1a8 100644 --- a/source4/librpc/ndr/ndr_string.c +++ b/source4/librpc/ndr/ndr_string.c @@ -82,7 +82,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, as = talloc_strdup(ndr->current_mem_ctx, ""); } else { ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, chset, CH_UNIX, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len2 + c_len_term)*byte_mul, (void **)&as); @@ -119,7 +119,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, as = talloc_strdup(ndr->current_mem_ctx, ""); } else { ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, @@ -158,7 +158,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, as = talloc_strdup(ndr->current_mem_ctx, ""); } else { ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len1 + c_len_term)*byte_mul, @@ -193,7 +193,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, as = talloc_strdup(ndr->current_mem_ctx, ""); } else { ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, (len3 + c_len_term)*byte_mul, @@ -226,7 +226,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, as = talloc_strdup(ndr->current_mem_ctx, ""); } else { ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len3, @@ -247,7 +247,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, len1 = utf16_len_n(ndr->data+ndr->offset, ndr->data_size - ndr->offset); } ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, chset, CH_UNIX, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len1, (void **)&as); @@ -264,7 +264,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, len1 = (flags & LIBNDR_FLAG_STR_FIXLEN32)?32:15; NDR_PULL_NEED_BYTES(ndr, len1*byte_mul); ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len1*byte_mul, @@ -290,7 +290,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, as = talloc_strdup(ndr->current_mem_ctx, ""); } else { ret = convert_string_talloc(ndr->current_mem_ctx, - global_smb_iconv_convenience, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, len1, @@ -355,7 +355,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, LIBNDR_FLAG_STR_FIXLEN32))) { s_len++; } - d_len = convert_string_talloc(ndr, global_smb_iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest); + d_len = convert_string_talloc(ndr, ndr->iconv_convenience, CH_UNIX, chset, s, s_len, (void **)&dest); if (d_len == -1) { return ndr_push_error(ndr, NDR_ERR_CHARCNV, "Bad character conversion"); @@ -689,7 +689,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, NDR_PULL_NEED_BYTES(ndr, length*byte_mul); - ret = convert_string_talloc(ndr->current_mem_ctx, global_smb_iconv_convenience, + ret = convert_string_talloc(ndr->current_mem_ctx, + ndr->iconv_convenience, chset, CH_UNIX, ndr->data+ndr->offset, length*byte_mul, @@ -714,7 +715,7 @@ _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); - ret = convert_string(global_smb_iconv_convenience, CH_UNIX, chset, + ret = convert_string(ndr->iconv_convenience, CH_UNIX, chset, var, strlen(var), ndr->data+ndr->offset, required); if (ret == -1) { |