smb2_tcon: only announce SMB3 related share capabilities if SMB3 is used
authorStefan Metzmacher <metze@samba.org>
Thu, 8 Feb 2024 14:31:10 +0000 (15:31 +0100)
committerJule Anger <janger@samba.org>
Mon, 19 Feb 2024 14:31:13 +0000 (14:31 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15577

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 32b84c5bce00c4f91191596dc00d9824e82e0f24)

source3/smbd/smb2_tcon.c

index 8855202d7fd7cd491c031698e719b30c5f05181a..b228036510aa6f233a28e06d96e7963912b91471 100644 (file)
@@ -425,7 +425,9 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
         * For disk shares we can change the client
         * behavior on a cluster...
         */
-       if (*out_share_type == SMB2_SHARE_TYPE_DISK) {
+       if (conn->protocol >= PROTOCOL_SMB3_00 &&
+           *out_share_type == SMB2_SHARE_TYPE_DISK)
+       {
                bool persistent = false; /* persistent handles not implemented yet */
                bool cluster = lp_clustering();
                bool scaleout = cluster;
@@ -486,10 +488,12 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
                 * an isolated transport and witness registration for the
                 * specific share.
                 */
-               announce = lp_parm_bool(SNUM(tcon->compat),
-                                       "smb3 share cap",
-                                       "ASYMMETRIC",
-                                       asymmetric);
+               if (conn->protocol >= PROTOCOL_SMB3_02) {
+                       announce = lp_parm_bool(SNUM(tcon->compat),
+                                               "smb3 share cap",
+                                               "ASYMMETRIC",
+                                               asymmetric);
+               }
                if (announce) {
                        *out_capabilities |= SMB2_SHARE_CAP_ASYMMETRIC;
                }