]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmbclient: Cope with SMB2 servers that return STATUS_USER_SESSION_DELETED...
authorJeremy Allison <jra@samba.org>
Wed, 11 Dec 2019 23:06:40 +0000 (15:06 -0800)
committerBjoern Jacke <bjacke@samba.org>
Wed, 11 May 2022 18:06:42 +0000 (18:06 +0000)
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 <jra@samba.org>
Reviewed-by: Bjoern Jacke <bjacke@samba.org>
Autobuild-User(master): Björn Jacke <bjacke@samba.org>
Autobuild-Date(master): Wed May 11 18:06:42 UTC 2022 on sn-devel-184

source3/libsmb/libsmb_server.c

index 09d27868c0e0285fe470f53674d638b4f6b28ea3..ce17e4fed090ee1c5ac26f1ffadf8299e6c53265 100644 (file)
@@ -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;
                        }
                }