The branch, master has been updated
       via  be2e2044b8e s3: libsmbclient: Cope with SMB2 servers that return 
STATUS_USER_SESSION_DELETED on a SMB2_ECHO (SMB2_OP_KEEPALIVE) call with a NULL 
session.
      from  0b214d666a9 gitignore: Add .ropeproject for pylsp-rope plugin

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit be2e2044b8ef56112162a42ac19b3791c787916b
Author: Jeremy Allison <j...@samba.org>
Date:   Wed Dec 11 15:06:40 2019 -0800

    s3: libsmbclient: Cope with SMB2 servers that return 
STATUS_USER_SESSION_DELETED on a SMB2_ECHO (SMB2_OP_KEEPALIVE) call with a NULL 
session.
    
    This is already tested by smb2.session.expire which
    shows that Windows and Samba servers don't need this,
    but some third party server are returning STATUS_USER_SESSION_DELETED
    with a NULL sessionid.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13218
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Bjoern Jacke <bja...@samba.org>
    
    Autobuild-User(master): Björn Jacke <bja...@samba.org>
    Autobuild-Date(master): Wed May 11 18:06:42 UTC 2022 on sn-devel-184

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/libsmb_server.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 09d27868c0e..ce17e4fed09 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -61,14 +61,33 @@ SMBC_check_server(SMBCCTX * context,
                                        1,
                                        data_blob_const(data, sizeof(data)));
                if (!NT_STATUS_IS_OK(status)) {
+                       bool ok = false;
+                       /*
+                        * Some SMB2 servers (not Samba or Windows)
+                        * check the session status on SMB2_ECHO and return
+                        * NT_STATUS_USER_SESSION_DELETED
+                        * if the session was not set. That's OK, they still
+                        * replied.
+                        * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13218
+                        */
+                       if (smbXcli_conn_protocol(server->cli->conn) >=
+                                       PROTOCOL_SMB2_02) {
+                               if (NT_STATUS_EQUAL(status,
+                                           NT_STATUS_USER_SESSION_DELETED)) {
+                                       ok = true;
+                               }
+                       }
                        /*
                         * Some NetApp servers return
                         * NT_STATUS_INVALID_PARAMETER.That's OK, they still
                         * replied.
                         * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13007
                         */
-                       if (!NT_STATUS_EQUAL(status,
+                       if (NT_STATUS_EQUAL(status,
                                        NT_STATUS_INVALID_PARAMETER)) {
+                               ok = true;
+                       }
+                       if (!ok) {
                                return 1;
                        }
                }


-- 
Samba Shared Repository

Reply via email to