smbd: Change protocol selection to not use "sconn->using_smb2"
authorVolker Lendecke <vl@samba.org>
Tue, 13 Feb 2024 11:56:17 +0000 (12:56 +0100)
committerMartin Schwenke <martins@samba.org>
Wed, 17 Apr 2024 07:57:36 +0000 (07:57 +0000)
To me this is pretty confusing, it seems to overload this struct
element.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
source3/smbd/smb2_process.c

index 4a6cda39a2f47af2618a1deb2f65cbee7912f123..5b113d4d219e7fb66e41a9c92741866f0ff49e8f 100644 (file)
@@ -587,7 +587,7 @@ void process_smb(struct smbXsrv_connection *xconn,
        }
 
 #if defined(WITH_SMB1SERVER)
-       if (sconn->using_smb2) {
+       if (lp_server_max_protocol() >= PROTOCOL_SMB2_02) {
                /* At this point we're not really using smb2,
                 * we make the decision here.. */
                if (smbd_is_smb2_header(inbuf, nread)) {
@@ -605,7 +605,7 @@ void process_smb(struct smbXsrv_connection *xconn,
                                && CVAL(inbuf, smb_com) != 0x72) {
                        /* This is a non-negprot SMB1 packet.
                           Disable SMB2 from now on. */
-                       sconn->using_smb2 = false;
+                       lp_do_parameter(-1, "server max protocol", "NT1");
                }
        }
        process_smb1(xconn, inbuf, nread, unread_bytes, seqnum, encrypted);
@@ -1876,21 +1876,6 @@ void smbd_process(struct tevent_context *ev_ctx,
                exit_server("pthreadpool_tevent_init() failed.");
        }
 
-#if defined(WITH_SMB1SERVER)
-       if (lp_server_max_protocol() >= PROTOCOL_SMB2_02) {
-#endif
-               /*
-                * We're not making the decision here,
-                * we're just allowing the client
-                * to decide between SMB1 and SMB2
-                * with the first negprot
-                * packet.
-                */
-               sconn->using_smb2 = true;
-#if defined(WITH_SMB1SERVER)
-       }
-#endif
-
        if (!interactive) {
                smbd_setup_sig_term_handler(sconn);
                smbd_setup_sig_hup_handler(sconn);