Some patches that help Samba respond more like Windows (based on smbtorture tests run against Server 2008

Richard Sharpe realrichardsharpe at gmail.com
Thu Feb 7 18:08:25 MST 2013


--- smb.h        2012-06-24 10:21:16.000000000 -0700
+++ smb.h       2013-02-08 00:12:40.906492891 -0800
@@ -1083,6 +1083,7 @@
 #define FILE_ATTRIBUTE_VOLUME          0x008L
 #define FILE_ATTRIBUTE_DIRECTORY       0x010L
 #define FILE_ATTRIBUTE_ARCHIVE         0x020L
+#define FILE_ATTRIBUTE_DEVICE          0x040L
 #define FILE_ATTRIBUTE_NORMAL          0x080L
 #define FILE_ATTRIBUTE_TEMPORARY       0x100L
 #define FILE_ATTRIBUTE_SPARSE          0x200L

--- open.c  2013-02-08 01:02:20.103540281 -0800
+++ open.c      2013-02-08 00:36:09.626544462 -0800
@@ -3132,7 +3132,7 @@
                  (unsigned int)private_flags,
                  ea_list, sd, smb_fname_str_dbg(smb_fname)));

-       if (create_options & FILE_OPEN_BY_FILE_ID) {
+       if (create_options & (FILE_OPEN_BY_FILE_ID | 0x100080)) {
                status = NT_STATUS_NOT_SUPPORTED;
                goto fail;
        }
@@ -3142,6 +3142,18 @@
                goto fail;
        }

+       /* Test for these access bits before file attributes */
+       /* Should test for the order of these tests */
+       if (access_mask & 0x0C000000) {
+               status = NT_STATUS_ACCESS_DENIED;
+               goto fail;
+       }
+
+       if (file_attributes & (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_VOLUME)) {
+               status = NT_STATUS_INVALID_PARAMETER;
+               goto fail;
+       }
+
        if (req == NULL) {
                oplock_request |= INTERNAL_OPEN_ONLY;
        }

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list