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)
committerKarolin Seeger <kseeger@samba.org>
Mon, 5 Nov 2018 11:44:29 +0000 (12:44 +0100)
commit4b42e0ee4c19f042c27e786d28ee5465e00c8a4c
treef2f0e609d72898e872508490a7374921b6270fcb
parentd3be8e21e66f98dce8c4989b01159e6099cf7ee4
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>
(cherry picked from commit 378706266496ce79c1887fe96ab3b15f56770244)
source3/smbd/negprot.c