diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-08-18 01:24:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:33:29 -0500 |
commit | ec96a742f7b6ce4cbb4f649dd8aba92ef80f0ff0 (patch) | |
tree | 79de41fa761ca1854c1054161173bec374d371eb /source4/librpc/ndr/ndr_krb5pac.c | |
parent | a8d31eac00cf13c20343374f11224778e470e849 (diff) | |
download | samba-ec96a742f7b6ce4cbb4f649dd8aba92ef80f0ff0.tar.gz samba-ec96a742f7b6ce4cbb4f649dd8aba92ef80f0ff0.tar.xz samba-ec96a742f7b6ce4cbb4f649dd8aba92ef80f0ff0.zip |
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)
Diffstat (limited to 'source4/librpc/ndr/ndr_krb5pac.c')
-rw-r--r-- | source4/librpc/ndr/ndr_krb5pac.c | 6 |
1 files changed, 5 insertions, 1 deletions
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; |