From ec96a742f7b6ce4cbb4f649dd8aba92ef80f0ff0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 18 Aug 2005 01:24:08 +0000 Subject: r9373: - create a hierachical memory tree with recursiv ndr_pull_* functions - with this it's also possible to talloc_free() the ndr_pull structure and talloc_steal(ndr->current_mem_ctx); to fetch the whole data of the hierachical tree - if the toplevel struct is a valid talloc pointer it's also possible to use NDR_PULL_SET_MEM_CTX(ndr, mem_ctx); to the the toplevel pointer with the struct pointer (NOTE: no callers are using this yet, but they shortly will) metze (This used to be commit 1a2b8369586642cc9bc15d015c1e4256c3a92732) --- source4/librpc/ndr/ndr_krb5pac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4/librpc/ndr/ndr_krb5pac.c') diff --git a/source4/librpc/ndr/ndr_krb5pac.c b/source4/librpc/ndr/ndr_krb5pac.c index 7d7e105e3e..92e3d77707 100644 --- a/source4/librpc/ndr/ndr_krb5pac.c +++ b/source4/librpc/ndr/ndr_krb5pac.c @@ -78,6 +78,7 @@ NTSTATUS ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct P NTSTATUS ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER *r) { uint32_t _ptr_info; + TALLOC_CTX *_mem_save_info_0; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_PAC_TYPE(ndr, NDR_SCALARS, &r->type)); @@ -87,7 +88,7 @@ NTSTATUS ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUF ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); if (_ptr_info) { - NDR_ALLOC(ndr, r->info); + NDR_PULL_ALLOC(ndr, r->info); NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->info, _ptr_info)); } else { r->info = NULL; @@ -104,6 +105,8 @@ NTSTATUS ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUF struct ndr_pull_save _relative_save; ndr_pull_save(ndr, &_relative_save); NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->info)); + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->info, 0); { struct ndr_pull *_ndr_info; NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info, 0, r->_ndr_size)); @@ -111,6 +114,7 @@ NTSTATUS ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUF NDR_CHECK(ndr_pull_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info)); NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info, 0, r->_ndr_size)); } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); ndr_pull_restore(ndr, &_relative_save); } ndr->flags = _flags_save_PAC_INFO; -- cgit