diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-11-23 16:02:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:28:26 -0500 |
commit | 8d870db811ef4f120d7df3b3f50243b47d94da2f (patch) | |
tree | 987861f5d8ce2ddc7f8bd810f88cc7ae5f8170ef /source4/librpc/ndr/ndr_basic.c | |
parent | 128fe5324b803e0989273c7033ec0b5c8bd3dbae (diff) | |
download | samba-8d870db811ef4f120d7df3b3f50243b47d94da2f.tar.gz samba-8d870db811ef4f120d7df3b3f50243b47d94da2f.tar.bz2 samba-8d870db811ef4f120d7df3b3f50243b47d94da2f.zip |
r19859: Reuse referrent ids when pushing full pointers (still need to
avoid pushing the referred object twice) and add test for full pointers.
(This used to be commit 1638c8d234dbc85298000685e49570f23dfd0bf8)
Diffstat (limited to 'source4/librpc/ndr/ndr_basic.c')
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index b8f2a8115f..a9cfb558f7 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -485,8 +485,13 @@ _PUBLIC_ NTSTATUS ndr_push_full_ptr(struct ndr_push *ndr, const void *p) { uint32_t ptr = 0; if (p) { - ndr->ptr_count++; - ptr = ndr->ptr_count; + /* Check if the pointer already exists and has an id */ + ptr = ndr_token_peek(&ndr->full_ptr_list, p); + if (ptr == 0) { + ndr->ptr_count++; + ptr = ndr->ptr_count; + ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr); + } } return ndr_push_uint32(ndr, NDR_SCALARS, ptr); } |