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

Stefan (metze) Metzmacher metze at samba.org
Thu Sep 4 03:41:14 MDT 2014


Hi Jeremy,

> +       if (!xconn->smb1.negprot.done) {
> +               if (type != SMBnegprot) {
> +                       exit_server_cleanly("The first request has to be a negprot");
> +               }
> +       }
> 
> instead ? Just looks cleaner (IMHO).

Yes, looks good. I also moved this to the top of the function.

metze
-------------- next part --------------
From 84091cbfdacf7994210515fccb3f523e2869e08a Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
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

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 <metze at samba.org>
---
 source3/smbd/process.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 207a4dd..9ebe140 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1456,6 +1456,12 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req)
 
 	errno = 0;
 
+	if (!xconn->smb1.negprot.done) {
+		if (type != SMBnegprot) {
+			exit_server_cleanly("The first request has to 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);
-- 
1.9.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140904/945e33e2/attachment.pgp>


More information about the samba-technical mailing list