diff options
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r-- | source4/librpc/ndr/libndr.h | 1 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_basic.c | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h index 1076936c1d..fb151e4120 100644 --- a/source4/librpc/ndr/libndr.h +++ b/source4/librpc/ndr/libndr.h @@ -88,6 +88,7 @@ struct ndr_push { struct ndr_token_list *switch_list; struct ndr_token_list *relative_list; struct ndr_token_list *nbt_string_list; + struct ndr_token_list *full_ptr_list; /* this is used to ensure we generate unique reference IDs */ uint32_t ptr_count; 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); } |