summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-02-22 18:19:13 +0100
committerJeremy Allison <jra@samba.org>2011-02-28 15:54:13 -0800
commit6c3a49ced333988b21d86e47b2b1dd1a5957e15c (patch)
tree69228281b13e97588f7d0cb1e18f327e644d9b20
parentbd2b0076b4ea0be6e2f6730566736be7e338aafc (diff)
downloadsamba-6c3a49ced333988b21d86e47b2b1dd1a5957e15c.tar.gz
samba-6c3a49ced333988b21d86e47b2b1dd1a5957e15c.tar.bz2
samba-6c3a49ced333988b21d86e47b2b1dd1a5957e15c.zip
TODO test/review librpc/ndr: let ndr_push/pull_DATA_BLOB() look at LIBNDR_FLAG_REMAINING before LIBNDR_ALIGN_FLAGS
metze
-rw-r--r--librpc/ndr/ndr_basic.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index 1d67e11e9d..d8e1cf0f00 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -1157,7 +1157,8 @@ _PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_
*/
_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
{
- if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
+ if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
blob.length = NDR_ALIGN(ndr, 2);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
@@ -1181,7 +1182,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flag
{
uint32_t length = 0;
- if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
+ if (ndr->flags & LIBNDR_FLAG_REMAINING) {
+ length = ndr->data_size - ndr->offset;
+ } else if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
length = NDR_ALIGN(ndr, 2);
} else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
@@ -1192,8 +1195,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flag
if (ndr->data_size - ndr->offset < length) {
length = ndr->data_size - ndr->offset;
}
- } else if (ndr->flags & LIBNDR_FLAG_REMAINING) {
- length = ndr->data_size - ndr->offset;
} else {
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
}