From 2f262aa627ad7dd7d592385bfc8594f109d1d1c7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 19 Aug 2014 00:15:34 +0200 Subject: [PATCH] s3:smbd: close the connection if the client doesn't start with a SMB1 Negprot or old messaging call. The case where the client starts with a SMB2 Negprot is already handled in smbd_smb2_request_dispatch(). Bug: https://bugzilla.samba.org/show_bug.cgi?id=10766 Signed-off-by: Stefan Metzmacher Signed-off-by: Jeremy Allison --- source3/smbd/process.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 207a4dd..da36ed1 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1456,6 +1456,24 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req) errno = 0; + if (!xconn->smb1.negprot.done) { + switch (type) { + /* + * Without a negprot the request must + * either be a negprot, or one of the + * evil old SMB mailslot messaging types. + */ + case SMBnegprot: + case SMBsendstrt: + case SMBsendend: + case SMBsendtxt: + break; + default: + exit_server_cleanly("The first request " + "should be a negprot"); + } + } + if (smb_messages[type].fn == NULL) { DEBUG(0,("Unknown message type %d!\n",type)); smb_dump("Unknown", 1, (const char *)req->inbuf); -- 2.1.0.rc2.206.gedb03e5