From: Noel Power Date: Wed, 20 Nov 2019 16:32:59 +0000 (+0000) Subject: s4/smb_server: Fix handling of SMB2 messages after Netbios session setup X-Git-Tag: ldb-2.1.0~439 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e30607aff3149395ce908d8ebfcac0fe56daa1ae;p=thirdparty%2Fsamba.git s4/smb_server: Fix handling of SMB2 messages after Netbios session setup On receiving a special NBT packet (e.g. session setup) the samba daemon effectively sets up SMB1 as the negotiated protocol (in terms of software handling of the messages) even though no SMB protocol has yet been negotiated. If the next message after the nbt session setup is a SMB2 message it will be handled by the SMB1 callbacks and will be rejected. This is evident when using smbclient (with -p 139) option in an env where SMB1 cannot be negotiated [*] This change doesn't set up the SMB1 callbacks on receipt of NBT special messages but lets the generic callback in place. Once either SMB1 (or) SMB2 is established (by receipt of a 'real' SMB or >=SMB2 message) then the proper callbacks will be set as normal. Signed-off-by: Noel Power Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Dec 5 18:44:40 UTC 2019 on sn-devel-184 --- diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 45641a4f2c9..0b80f2fbd20 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -44,7 +44,6 @@ static NTSTATUS smbsrv_recv_generic_request(void *private_data, DATA_BLOB blob) if (CVAL(blob.data,0) != 0) { status = smbsrv_init_smb_connection(smb_conn, smb_conn->lp_ctx); NT_STATUS_NOT_OK_RETURN(status); - packet_set_callback(smb_conn->packet, smbsrv_recv_smb_request); return smbsrv_recv_smb_request(smb_conn, blob); }