User Manager for Domains on Win9x

Andrew Tridgell tridge at samba.org
Tue Mar 13 23:42:06 GMT 2001


Please be careful with code like the following:

> +		} else {
> +			SIVAL(outbuf, smb_flg2, FLAGS2_32_BIT_ERROR_CODES);
> +			SIVAL(outbuf, smb_rcls, 0x80000000 | STATUS_BUFFER_OVERFLOW);
> +		}

note that it sets flg2 to an absolute value. I just finished going
through the code removing all of these. If you ever set flg2 to an
absolute value then we cannot do unicode on the wire. If you wish to
set a particular bit in flg2 then just set that bit - don't clobber
all the other bits that have been carefully setup by other parts of
the code. For example:

  SIVAL(outbuf, smb_flg2, SVAL(outbuf, smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);

would just set that bit. You may be thinking "this doesn't matter when
we are returning an error" but you'd be wrong - think about chained
packets that fail on the 2nd part of the chain.

And while we are discussing chained packets you need to remember that
the flg2 field is shared between all parts of the chain. This means
that setting FLAGS2_32_BIT_ERROR_CODES affects earlier segments of the
chain as well, which is probably not what you want.

Cheers, Tridge




More information about the samba-technical mailing list