r2968: fixed the byte order problem with the new RHS parsing on ncacn_ip_tcp
authorAndrew Tridgell <tridge@samba.org>
Thu, 14 Oct 2004 09:07:41 +0000 (09:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:53 +0000 (12:59 -0500)
(This used to be commit cc00f9b6b87783d189df00de0ce9ae92b907e21a)

source4/build/pidl/parser.pm
source4/librpc/idl/epmapper.idl
source4/librpc/idl/idl_types.h
source4/librpc/ndr/ndr.c

index abf5785a458776828f3f97296248e434b9a68cae..28926b7208db4a358c9f59ca737fc576b0688e94 100644 (file)
@@ -135,7 +135,7 @@ sub start_flags($)
        my $flags = util::has_property($e, "flag");
        if (defined $flags) {
                pidl "\t{ uint32_t _flags_save_$e->{TYPE} = ndr->flags;\n";
-               pidl "\tndr->flags |= $flags;\n";
+               pidl "\tndr_set_flags(&ndr->flags, $flags);\n";
        }
 }
 
index fffd2606c06cd0cbb34748cd0213438c15de8188..7ea58e354fe67b5e0a4298837c0f083a71519421 100644 (file)
@@ -149,7 +149,7 @@ interface epmapper
        typedef struct {
        } epm_rhs_ncalrpc;
 
-       typedef [nodiscriminant] union {
+       typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union {
                [case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp;
                [case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4;
                [case(EPM_PROTOCOL_OSI_CLNS)] epm_rhs_osi_clns osi_clns;
index 86f4e179596140c62cddb73397dd9962ec16aff4..d2d32245f3fd5b371f4c0b3a51ea141ff141d20e 100644 (file)
@@ -66,6 +66,7 @@
 /* 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
+#define NDR_BIG_ENDIAN LIBNDR_FLAG_BIGENDIAN
 
 
 /*
index 959616fc787a8d8a8601e87692d2f2c4ef5218b9..4f6f135cd6a7383ed437cb7f8bfe6742eb50ae0e 100644 (file)
@@ -350,6 +350,17 @@ void ndr_print_function_debug(void (*fn)(struct ndr_print *, const char *, int ,
        talloc_free(ndr);
 }
 
+void ndr_set_flags(uint32_t *pflags, uint32_t new_flags)
+{
+       /* the big/little endian flags are inter-dependent */
+       if (new_flags & LIBNDR_FLAG_LITTLE_ENDIAN) {
+               (*pflags) &= ~LIBNDR_FLAG_BIGENDIAN;
+       }
+       if (new_flags & LIBNDR_FLAG_BIGENDIAN) {
+               (*pflags) &= ~LIBNDR_FLAG_LITTLE_ENDIAN;
+       }
+       (*pflags) |= new_flags;
+}
 
 static NTSTATUS ndr_map_error(enum ndr_err_code err)
 {