]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Implement SMB2_FS_POSIX_INFORMATION_INTERNAL
authorDavid Mulder <dmulder@samba.org>
Mon, 12 Sep 2022 23:09:50 +0000 (16:09 -0700)
committerVolker Lendecke <vl@samba.org>
Tue, 29 Nov 2022 10:26:37 +0000 (10:26 +0000)
Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/include/trans2.h
source3/smbd/smb2_trans2.c

index dfc5980084652c343a6df978aed9884326c968f3..3ed42a3f0b96c7a620ef9e5c27fb43664ebf41a0 100644 (file)
@@ -412,6 +412,7 @@ Byte offset   Type     name                description
 #define SMB2_FILE_FULL_EA_INFORMATION                  (FSCC_FILE_FULL_EA_INFORMATION + SMB2_INFO_SPECIAL)
 #define SMB2_FILE_ALL_INFORMATION                      (FSCC_FILE_ALL_INFORMATION + SMB2_INFO_SPECIAL)
 #define SMB2_FILE_POSIX_INFORMATION_INTERNAL           (SMB2_FILE_POSIX_INFORMATION + SMB2_INFO_SPECIAL)
+#define SMB2_FS_POSIX_INFORMATION_INTERNAL             1100
 
 /* NT passthrough levels for qfsinfo. */
 
index a58341477c4d09c60706ab40ba700cc280d7cb6a..e2724dc0e88931b408d212ce9a431d8f9decca88 100644 (file)
@@ -2184,6 +2184,23 @@ static void samba_extended_info_version(struct smb_extended_info *extended_info)
                  "%s", samba_version_string());
 }
 
+static bool fsinfo_unix_valid_level(connection_struct *conn,
+                                   uint16_t info_level)
+{
+       if (conn->sconn->using_smb2 &&
+                       lp_smb3_unix_extensions() &&
+                       info_level == SMB2_FS_POSIX_INFORMATION_INTERNAL) {
+               return true;
+       }
+#if defined(SMB1SERVER)
+       if (lp_smb1_unix_extensions() &&
+                       info_level == SMB_QUERY_POSIX_FS_INFO) {
+               return true;
+       }
+#endif
+       return false;
+}
+
 NTSTATUS smbd_do_qfsinfo(struct smbXsrv_connection *xconn,
                         connection_struct *conn,
                         TALLOC_CTX *mem_ctx,
@@ -2682,11 +2699,12 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
 #endif
 
                case SMB_QUERY_POSIX_FS_INFO:
+               case SMB2_FS_POSIX_INFORMATION_INTERNAL:
                {
                        int rc;
                        struct vfs_statvfs_struct svfs;
 
-                       if (!lp_smb1_unix_extensions()) {
+                       if (!fsinfo_unix_valid_level(conn, info_level)) {
                                return NT_STATUS_INVALID_LEVEL;
                        }