Fix bug #8373 - Can't join XP Pro workstations to 3.6.1 DC.
authorJeremy Allison <jra@samba.org>
Fri, 25 May 2012 16:16:50 +0000 (09:16 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 31 May 2012 19:02:06 +0000 (21:02 +0200)
Treat LIBNDR_FLAG_NOALIGN and LIBNDR_FLAG_REMAINING the same as the
other align flags - make them mutually exclusive.

Combined work from Metze, Günther and Jeremy.
(cherry picked from commit 035342c11719d1daa647c0b2ae7cec27a969f83a)

librpc/ndr/libndr.h
librpc/ndr/ndr.c

index f4b7db9ae3f43352aaa3c015fc183d12d60d29ab..1e40779c4b7e66c5dc963232f7f89be2de17de7f 100644 (file)
@@ -136,7 +136,13 @@ struct ndr_print {
 #define LIBNDR_FLAG_ALIGN4       (1<<23)
 #define LIBNDR_FLAG_ALIGN8       (1<<24)
 
-#define LIBNDR_ALIGN_FLAGS (LIBNDR_FLAG_ALIGN2|LIBNDR_FLAG_ALIGN4|LIBNDR_FLAG_ALIGN8)
+#define LIBNDR_ALIGN_FLAGS ( 0        | \
+               LIBNDR_FLAG_NOALIGN   | \
+               LIBNDR_FLAG_REMAINING | \
+               LIBNDR_FLAG_ALIGN2    | \
+               LIBNDR_FLAG_ALIGN4    | \
+               LIBNDR_FLAG_ALIGN8    | \
+               0)
 
 #define LIBNDR_PRINT_ARRAY_HEX   (1<<25)
 #define LIBNDR_PRINT_SET_VALUES  (1<<26)
index 56d1fab05e4b2b778f558eb84d8eff204dfeacc5..8b442b6f5bae6d9a04964c99e7a2658e0a30a267 100644 (file)
@@ -380,11 +380,11 @@ _PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags)
                (*pflags) &= ~LIBNDR_FLAG_LITTLE_ENDIAN;
                (*pflags) &= ~LIBNDR_FLAG_NDR64;
        }
-       if (new_flags & LIBNDR_FLAG_REMAINING) {
-               (*pflags) &= ~LIBNDR_ALIGN_FLAGS;
-       }
        if (new_flags & LIBNDR_ALIGN_FLAGS) {
-               (*pflags) &= ~LIBNDR_FLAG_REMAINING;
+               /* Ensure we only have the passed-in
+                  align flag set in the new_flags,
+                  remove any old align flag. */
+               (*pflags) &= ~LIBNDR_ALIGN_FLAGS;
        }
        if (new_flags & LIBNDR_FLAG_NO_RELATIVE_REVERSE) {
                (*pflags) &= ~LIBNDR_FLAG_RELATIVE_REVERSE;