diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-03 12:10:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:31 -0500 |
commit | 6a2422932bb36183ab2ec8d0909de45c3fc8db35 (patch) | |
tree | 0f47ec124e3f73318b85a8accf31af7ccc01d910 /source4/librpc/ndr/ndr.c | |
parent | 905dd977fa692ef01676b92396f25070a1d194d3 (diff) | |
download | samba-6a2422932bb36183ab2ec8d0909de45c3fc8db35.tar.gz samba-6a2422932bb36183ab2ec8d0909de45c3fc8db35.tar.bz2 samba-6a2422932bb36183ab2ec8d0909de45c3fc8db35.zip |
r2204: added [flag(RELATIVE_CURRENT)] to change [relative] pointer behaviour
for this struct and all sub-structures to be like spoolss relative
pointers (where offset is relative to current position).
volker will test this for me :)
(This used to be commit bd45329a3fb55a5d9f006ad601ae26a80b9a563f)
Diffstat (limited to 'source4/librpc/ndr/ndr.c')
-rw-r--r-- | source4/librpc/ndr/ndr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 1cc96ca976..2f1c9ef47f 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -639,11 +639,11 @@ 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) */ - NDR_CHECK(ndr_pull_set_offset(ndr, ofs)); + if (ndr->flags & LIBNDR_FLAG_RELATIVE_CURRENT) { + NDR_CHECK(ndr_pull_set_offset(ndr, ofs + ndr->offset - 4)); + } else { + NDR_CHECK(ndr_pull_set_offset(ndr, ofs)); + } 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) { @@ -748,7 +748,11 @@ NTSTATUS ndr_push_relative2(struct ndr_push *ndr, const void *p) if (ndr->offset == 0) { return NT_STATUS_INTERNAL_ERROR; } - NDR_CHECK(ndr_push_uint32(ndr, save.offset)); + if (ndr->flags & LIBNDR_FLAG_RELATIVE_CURRENT) { + NDR_CHECK(ndr_push_uint32(ndr, save.offset - ndr->offset)); + } else { + NDR_CHECK(ndr_push_uint32(ndr, save.offset)); + } ndr_push_restore(ndr, &save); return NT_STATUS_OK; } |