s3/smbd: Server responds incorrectly if no SMB protocol chosen
authorTim Beale <timbeale@catalyst.net.nz>
Wed, 26 Sep 2018 21:46:41 +0000 (09:46 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 28 Sep 2018 06:30:22 +0000 (08:30 +0200)
commit378706266496ce79c1887fe96ab3b15f56770244
treebb626a9ecb21abbfdbae86cfab6ac5dd3f9220e6
parent0122f45f053ecc545950c31bf1fb33fba143478c
s3/smbd: Server responds incorrectly if no SMB protocol chosen

The SMBnegprot response from the server contains the DialectIndex of the
selected protocol from the client's request message. Currently, if no
protocol is selected, the server is responding with a DialectIndex=zero,
which is a valid index (PROTOCOL_CORE by default). The Windows spec, and
historically the code, should return DialectIndex=0xffff if no protocol
is chosen. The following commit changed it recently (presumably
inadvertently), so that it now returns DialectIndex=zero.

06940155f315529c5b5 s3:smbd: Fix size types in reply_negprot()

This results in somewhat confusing error messages on the client side:
ERROR(runtime): uncaught exception - (3221225997, 'The transport
connection has been reset.')

or, when signing is configured as mandatory:
smbXcli_negprot: SMB signing is mandatory and the selected protocol
level (1) doesn't support it.
ERROR(runtime): uncaught exception - (3221225506, '{Access Denied} A
process has requested access to an object but has not been granted those
access rights.')

This patch restores the old behaviour of returning 0xffff.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13621

Pair-Programmed-With: Ralph Boehme <slow@samba.org>
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/negprot.c