From 60708de658f0b80f7322489a0b6e0c5b9c76a60b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Aug 2004 05:59:40 +0000 Subject: r1644: changed the way [relative] pointers work in pidl, making them much simpler. This doesn't appear to hurt any of the existing uses of [relative], but fixes its use for svcctl that jelmer is working on. (This used to be commit 573f56a44785526d15c0179c5bbdab4c8b9461f1) --- source4/librpc/ndr/ndr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index d2e85f6aec..881a4ab60f 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -661,7 +661,15 @@ NTSTATUS ndr_pull_relative(struct ndr_pull *ndr, const void **buf, size_t size, return NT_STATUS_OK; } ndr_pull_save(ndr, &save); + /* the old way of handling relative pointers appears to be + wrong, and there doesn't seem to be anything relying on it, + but I am keeping the code around in case I missed a + critical use for it (tridge, august 2004) */ +#if OLD_RELATIVE_BEHAVIOUR NDR_CHECK(ndr_pull_set_offset(ndr, ofs + ndr->ofs_list->offset)); +#else + NDR_CHECK(ndr_pull_set_offset(ndr, ofs)); +#endif NDR_CHECK(ndr_pull_subcontext(ndr, &ndr2, ndr->data_size - ndr->offset)); /* strings must be allocated by the backend functions */ if (ndr->flags & LIBNDR_STRING_FLAGS) { @@ -690,7 +698,11 @@ NTSTATUS ndr_push_relative(struct ndr_push *ndr, int ndr_flags, const void *p, NDR_PUSH_ALLOC(ndr, ofs); NDR_CHECK(ndr_push_align(ndr, 4)); ofs->offset = ndr->offset; +#if OLD_RELATIVE_BEHAVIOUR ofs->base = ndr->ofs_list->offset; +#else + ofs->base = 0; +#endif NDR_CHECK(ndr_push_uint32(ndr, 0xFFFFFFFF)); ofs->next = NULL; if (ndr->relative_list_end) { -- cgit