the endpoint mapper now works in bigendian mode
authorAndrew Tridgell <tridge@samba.org>
Wed, 31 Dec 2003 01:32:33 +0000 (01:32 +0000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 31 Dec 2003 01:32:33 +0000 (01:32 +0000)
source/librpc/idl/epmapper.idl
source/librpc/idl/idl_types.h
source/librpc/ndr/libndr.h
source/librpc/ndr/ndr_basic.c

index fff05b9bc3ac0d9c6a7bbbcb30599fb664897758..5db65cd7cf0caa5cbb54cdf833b9eac2d10b945a 100644 (file)
@@ -70,7 +70,7 @@ interface epmapper
           non-aligned. I wonder what sort of wicked substance these
           guys were smoking?
        */
-       typedef [flag(NDR_NOALIGN)] struct {
+       typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
                uint16 num_floors;
                epm_floor floors[num_floors];
        } epm_towers;
index f684ba7dd72dd0bc36f762fd4416a42028dd311a..434dfb8c649c58ba7c59739d753943e1f23d886e 100644 (file)
 #define ascstr3       [flag(STR_ASCII|STR_SIZE2)]            string
 
 
-#define NDR_NOALIGN   LIBNDR_FLAG_NOALIGN
-#define NDR_REMAINING LIBNDR_FLAG_REMAINING
-#define NDR_ALIGN2    LIBNDR_FLAG_ALIGN2
-#define NDR_ALIGN4    LIBNDR_FLAG_ALIGN4
-#define NDR_ALIGN8    LIBNDR_FLAG_ALIGN8
+#define NDR_NOALIGN       LIBNDR_FLAG_NOALIGN
+#define NDR_REMAINING     LIBNDR_FLAG_REMAINING
+#define NDR_ALIGN2        LIBNDR_FLAG_ALIGN2
+#define NDR_ALIGN4        LIBNDR_FLAG_ALIGN4
+#define NDR_ALIGN8        LIBNDR_FLAG_ALIGN8
+
+/* this flag is used to force a section of IDL as little endian. It is
+   needed for the epmapper IDL, which is defined as always being LE */
+#define NDR_LITTLE_ENDIAN LIBNDR_FLAG_LITTLE_ENDIAN
 
 
 /*
index 8e57d0fb73b018c6ab1ef4cc013fd095833367a8..97f36b78d0c47a4814aa8fec0e331a5f8fa054d8 100644 (file)
@@ -113,6 +113,9 @@ struct ndr_print {
 #define LIBNDR_PRINT_ARRAY_HEX   (1<<15)
 #define LIBNDR_PRINT_SET_VALUES  (1<<16)
 
+/* used to force a section of IDL to be little-endian */
+#define LIBNDR_FLAG_LITTLE_ENDIAN (1<<17)
+
 
 /* useful macro for debugging */
 #define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
index be4f16e89bc69be29fd8465c8439fda5a715c19a..0c63faf347d990d8740c1560f8338a99379a9651 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "includes.h"
 
-#define NDR_BE(ndr) ((ndr)->flags & LIBNDR_FLAG_BIGENDIAN)
+#define NDR_BE(ndr) (((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN)
 #define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
 #define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
 #define NDR_SSVAL(ndr, ofs, v) do { if (NDR_BE(ndr))  { RSSVAL(ndr->data,ofs,v); } else SSVAL(ndr->data,ofs,v); } while (0)
@@ -350,7 +350,7 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
                return NT_STATUS_OK;
        }
 
-       if (ndr->flags & LIBNDR_FLAG_BIGENDIAN) {
+       if (NDR_BE(ndr)) {
                chset = CH_UCS2BE;
        }
 
@@ -472,7 +472,7 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
                return NT_STATUS_OK;
        }
 
-       if (ndr->flags & LIBNDR_FLAG_BIGENDIAN) {
+       if (NDR_BE(ndr)) {
                chset = CH_UCS2BE;
        }