r5084: - handle arbitrary data in the NULL record reply type for nbt name queries
authorAndrew Tridgell <tridge@samba.org>
Sat, 29 Jan 2005 03:17:14 +0000 (03:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:09:20 +0000 (13:09 -0500)
- fixed unaligned pulls at the end of the packet in the ndr lib

source/librpc/idl/nbt.idl
source/librpc/ndr/libndr.h
source/librpc/ndr/ndr.c

index e12ec6290a865c78299b5f7ca170651de9b60d03..429a35267c01bfd171c7538f303721fbb1687151 100644 (file)
@@ -142,13 +142,13 @@ interface nbt
        } nbt_rdata_status;
 
        typedef struct {
-               nbt_operation operation;
-       } nbt_rdata_wack;
+               [flag(NDR_REMAINING)] DATA_BLOB data;
+       } nbt_rdata_data;
 
        typedef [nodiscriminant] union {
                [case(NBT_QTYPE_NETBIOS)] nbt_rdata_netbios netbios;
                [case(NBT_QTYPE_STATUS)]  nbt_rdata_status status;
-               [case(NBT_QTYPE_NULL)]    nbt_rdata_wack wack;
+               [default]                 nbt_rdata_data   data;
        } nbt_rdata;
 
        typedef [flag(LIBNDR_PRINT_ARRAY_HEX)] struct {
index 7070ae80ec36df6d05fe68d688e82b4d1ed56023..5485c232b42e5d5d2c8d91b6b2bcc557ca2f0ba9 100644 (file)
@@ -185,7 +185,7 @@ enum ndr_err_code {
                } \
                ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
        } \
-       if (ndr->offset >= ndr->data_size) { \
+       if (ndr->offset > ndr->data_size) { \
                return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", n); \
        } \
 } while(0)
index 6947cc8ee674be71f758d90b550e3db68a61b4d1..032c743befd79fdd4dc89598bb6bb3f4b6bc782e 100644 (file)
@@ -436,6 +436,8 @@ static NTSTATUS ndr_pull_subcontext_header(struct ndr_pull *ndr,
                                           size_t sub_size,
                                           struct ndr_pull *ndr2)
 {
+       ndr2->flags = ndr->flags;
+
        switch (sub_size) {
        case 0: {
                uint32_t size = ndr->data_size - ndr->offset;