diff options
Diffstat (limited to 'librpc/ndr/ndr.c')
-rw-r--r-- | librpc/ndr/ndr.c | 56 |
1 files changed, 18 insertions, 38 deletions
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 90be787526..1600d51c1c 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -58,7 +58,7 @@ _PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n) /* initialise a ndr parse structure from a data blob */ -_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience) +_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { struct ndr_pull *ndr; @@ -68,7 +68,6 @@ _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, iconv_convenience); return ndr; } @@ -102,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, struct smb_iconv_convenience *iconv_convenience) +_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx) { struct ndr_push *ndr; @@ -117,7 +116,6 @@ _PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx, struct smb_icon if (!ndr->data) { return NULL; } - ndr->iconv_convenience = talloc_reference(ndr, iconv_convenience); return ndr; } @@ -256,14 +254,6 @@ _PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name ndr->depth = 1; ndr->flags = 0; - /* this is a s4 hack until we build up the courage to pass - * this all the way down - */ -#if _SAMBA_BUILD_ == 4 - ndr->iconv_convenience = smb_iconv_convenience_reinit(talloc_autofree_context(), - "ASCII", "UTF-8", true, NULL); -#endif - fn(ndr, name, flags, ptr); talloc_free(ndr); } @@ -286,14 +276,6 @@ _PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, c ndr->depth = 1; ndr->flags = 0; - /* this is a s4 hack until we build up the courage to pass - * this all the way down - */ -#if _SAMBA_BUILD_ == 4 - ndr->iconv_convenience = smb_iconv_convenience_reinit(talloc_autofree_context(), - "ASCII", "UTF-8", true, NULL); -#endif - fn(ndr, name, ptr); ret = talloc_steal(mem_ctx, (char *)ndr->private_data); failed: @@ -555,7 +537,6 @@ _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); if (force_le) { ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN); @@ -591,7 +572,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr, { struct ndr_push *subndr; - subndr = ndr_push_init_ctx(ndr, ndr->iconv_convenience); + subndr = ndr_push_init_ctx(ndr); NDR_ERR_HAVE_NO_MEMORY(subndr); subndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64; @@ -852,11 +833,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, struct smb_iconv_convenience *iconv_convenience, void *p, +_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); + ndr = ndr_pull_init_blob(blob, mem_ctx); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); talloc_free(ndr); @@ -867,12 +848,11 @@ _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, - struct smb_iconv_convenience *iconv_convenience, void *p, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; uint32_t highest_ofs; - ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); + ndr = ndr_pull_init_blob(blob, mem_ctx); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); if (ndr->offset > ndr->relative_highest_offset) { @@ -896,11 +876,11 @@ _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, - struct smb_iconv_convenience *iconv_convenience, void *p, + void *p, uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; - ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); + ndr = ndr_pull_init_blob(blob, mem_ctx); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK_FREE(ndr_pull_set_switch_value(ndr, p, level)); NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); @@ -913,12 +893,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX 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, - struct smb_iconv_convenience *iconv_convenience, void *p, + void *p, uint32_t level, ndr_pull_flags_fn_t fn) { struct ndr_pull *ndr; uint32_t highest_ofs; - ndr = ndr_pull_init_blob(blob, mem_ctx, iconv_convenience); + ndr = ndr_pull_init_blob(blob, mem_ctx); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK_FREE(ndr_pull_set_switch_value(ndr, p, level)); NDR_CHECK_FREE(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); @@ -942,10 +922,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC /* push a struct to a blob using NDR */ -_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn) +_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p, ndr_push_flags_fn_t fn) { struct ndr_push *ndr; - ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience); + ndr = ndr_push_init_ctx(mem_ctx); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p)); @@ -960,11 +940,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, struct smb_iconv_convenience *iconv_convenience, void *p, +_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p, uint32_t level, ndr_push_flags_fn_t fn) { struct ndr_push *ndr; - ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience); + ndr = ndr_push_init_ctx(mem_ctx); NDR_ERR_HAVE_NO_MEMORY(ndr); NDR_CHECK(ndr_push_set_switch_value(ndr, p, level)); @@ -980,7 +960,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ /* generic ndr_size_*() handler for structures */ -_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push, struct smb_iconv_convenience *iconv_convenience) +_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) { struct ndr_push *ndr; enum ndr_err_code status; @@ -989,7 +969,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, iconv_convenience); + ndr = ndr_push_init_ctx(NULL); if (!ndr) return 0; ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE; status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p)); @@ -1005,7 +985,7 @@ _PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t pu /* generic ndr_size_*() handler for unions */ -_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push, struct smb_iconv_convenience *iconv_convenience) +_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push) { struct ndr_push *ndr; enum ndr_err_code status; @@ -1014,7 +994,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, iconv_convenience); + ndr = ndr_push_init_ctx(NULL); if (!ndr) return 0; ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE; |