From f1bb46ad4e8b0b43ead60c70a463709892fd1779 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 13 Feb 2024 12:56:17 +0100 Subject: [PATCH] smbd: Change protocol selection to not use "sconn->using_smb2" To me this is pretty confusing, it seems to overload this struct element. Signed-off-by: Volker Lendecke Reviewed-by: Martin Schwenke --- source3/smbd/smb2_process.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/source3/smbd/smb2_process.c b/source3/smbd/smb2_process.c index 4a6cda39a2f..5b113d4d219 100644 --- a/source3/smbd/smb2_process.c +++ b/source3/smbd/smb2_process.c @@ -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); -- 2.34.1