removal of flag NO-ALIGN if a align flag is specified in pidl/ndr

Andrew Bartlett abartlet at samba.org
Thu Sep 8 03:19:19 MDT 2011


On Thu, 2011-09-08 at 10:48 +0200, Matthieu Patou wrote:
> Hello,
> 
> I face a situation with ndr generated code when a top structure is 
> unaligned but one of its substructure can contain a security descriptor 
> that needs to have alignment.
> 
> I'm proposing the following change:
> 
> diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
> index 7cb6e21..0094938 100644
> --- a/librpc/ndr/ndr.c
> +++ b/librpc/ndr/ndr.c
> @@ -381,7 +381,7 @@ _PUBLIC_ void ndr_set_flags(uint32_t *pflags, 
> uint32_t new_flags)
>                  (*pflags) &= ~LIBNDR_ALIGN_FLAGS;
>          }
>          if (new_flags & LIBNDR_ALIGN_FLAGS) {
> -               (*pflags) &= ~LIBNDR_FLAG_REMAINING;
> +               (*pflags) &= ~(LIBNDR_FLAG_REMAINING|LIBNDR_FLAG_NOALIGN);
>          }
>          if (new_flags & LIBNDR_FLAG_NO_RELATIVE_REVERSE) {
>                  (*pflags) &= ~LIBNDR_FLAG_RELATIVE_REVERSE;
> 
> Is there any remarks ?

Mess with NOALIGN at your own peril.  The bug that had domain logons
failing to a Samba 3.6 DC that we fixed just before 3.6.0 was related to
this, and only happened on even-length hostnames.  Bugs introduced
around this flag have been very subtle.

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org



More information about the samba-technical mailing list