diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-09-21 21:58:05 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-11 16:02:14 +0100 |
commit | 53e0ceddff7a4e668242a2db53764fa962c71163 (patch) | |
tree | 9b2b6a95aa2d914bb4ad163b33595332658a432e /librpc/ndr | |
parent | ef5e0b7339ace6d5bf4771d196f8868171c02103 (diff) | |
download | samba-53e0ceddff7a4e668242a2db53764fa962c71163.tar.gz samba-53e0ceddff7a4e668242a2db53764fa962c71163.tar.xz samba-53e0ceddff7a4e668242a2db53764fa962c71163.zip |
librpc/ndr: add support for a shallow copy to ndr_pull_subcontext_start/end
This will be usefull to try parsing DCERPC pipe chunks for
LIBNDR_FLAG_INCOMPLETE_BUFFER.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc/ndr')
-rw-r--r-- | librpc/ndr/ndr.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 99e9fe4d8fd..367a9cde937 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -616,6 +616,23 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr, NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &reserved)); break; } + case 0xFFFFFFFF: + /* + * a shallow copy like subcontext + * useful for DCERPC pipe chunks. + */ + subndr = talloc_zero(ndr, struct ndr_pull); + NDR_ERR_HAVE_NO_MEMORY(subndr); + + subndr->flags = ndr->flags; + subndr->current_mem_ctx = ndr->current_mem_ctx; + subndr->data = ndr->data; + subndr->offset = ndr->offset; + subndr->data_size = ndr->data_size; + + *_subndr = subndr; + return NDR_ERR_SUCCESS; + default: return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d", (int)header_size); @@ -650,7 +667,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr, uint32_t advance; uint32_t highest_ofs; - if (size_is >= 0) { + if (header_size == 0xFFFFFFFF) { + advance = subndr->offset - ndr->offset; + } else if (size_is >= 0) { advance = size_is; } else if (header_size > 0) { advance = subndr->data_size; |