Fix bug 7442 - Samba returns incorrect SMB2 QFS device info.
authorJeremy Allison <jra@samba.org>
Thu, 20 May 2010 04:28:08 +0000 (21:28 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 20 May 2010 04:28:08 +0000 (21:28 -0700)
Add the correct devicetype and characteristics for this info level.

Jeremy.

source3/include/trans2.h
source3/smbd/trans2.c

index d42554551a7e95da04116252163f36f85ffc00ea..8152a7be94683d2e2ade1ed26f65da4c53f5ab50 100644 (file)
@@ -334,6 +334,20 @@ Byte offset   Type     name                description
 #define SMB_FS_FULL_SIZE_INFORMATION                   1007
 #define SMB_FS_OBJECTID_INFORMATION                    1008
 
+/* SMB_FS_DEVICE_INFORMATION device types. */
+#define FILE_DEVICE_CD_ROM             0x2
+#define FILE_DEVICE_DISK               0x7
+
+/* SMB_FS_DEVICE_INFORMATION characteristics. */
+#define FILE_REMOVABLE_MEDIA           0x001
+#define FILE_READ_ONLY_DEVICE          0x002
+#define FILE_FLOPPY_DISKETTE           0x004
+#define FILE_WRITE_ONCE_MEDIA          0x008
+#define FILE_REMOTE_DEVICE             0x010
+#define FILE_DEVICE_IS_MOUNTED         0x020
+#define FILE_VIRTUAL_VOLUME            0x040
+#define FILE_DEVICE_SECURE_OPEN                0x100
+
 /* flags on trans2 findfirst/findnext that control search */
 #define FLAG_TRANS2_FIND_CLOSE          0x1
 #define FLAG_TRANS2_FIND_CLOSE_IF_END   0x2
index dec9d7f8f977ac9d02a8833ccbd9ba3c43805657..6e1defaac2c4bb9e726fc9b27df6a4867fe710f5 100644 (file)
@@ -3123,10 +3123,17 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
 
                case SMB_QUERY_FS_DEVICE_INFO:
                case SMB_FS_DEVICE_INFORMATION:
+               {
+                       uint32_t characteristics = FILE_DEVICE_IS_MOUNTED;
+
+                       if (!CAN_WRITE(conn)) {
+                               characteristics |= FILE_READ_ONLY_DEVICE;
+                       }
                        data_len = 8;
-                       SIVAL(pdata,0,0); /* dev type */
-                       SIVAL(pdata,4,0); /* characteristics */
+                       SIVAL(pdata,0,FILE_DEVICE_DISK); /* dev type */
+                       SIVAL(pdata,4,characteristics);
                        break;
+               }
 
 #ifdef HAVE_SYS_QUOTAS
                case SMB_FS_QUOTA_INFORMATION: