s3 OneFS: Add a parameter that unconditionally allows execute access
authorTim Prouty <tprouty@samba.org>
Mon, 23 Feb 2009 04:50:30 +0000 (20:50 -0800)
committerTim Prouty <tprouty@samba.org>
Tue, 24 Feb 2009 07:21:48 +0000 (23:21 -0800)
source3/modules/onefs.h
source3/modules/onefs_system.c

index a70664bbf38e7c4f9e6613d9b1ec733f669b327d..418e13d9d2b8c8121118386417d38214fe3ed3a8 100644 (file)
@@ -41,6 +41,8 @@ enum onefs_acl_wire_format
 #define PARM_ONEFS_TYPE "onefs"
 #define PARM_ACL_WIRE_FORMAT "acl wire format"
 #define PARM_ACL_WIRE_FORMAT_DEFAULT ACL_FORMAT_WINDOWS_SD
+#define PARM_ALLOW_EXECUTE_ALWAYS "allow execute always"
+#define PARM_ALLOW_EXECUTE_ALWAYS_DEFAULT false
 #define PARM_ATIME_NOW         "atime now files"
 #define PARM_ATIME_NOW_DEFAULT  NULL
 #define PARM_ATIME_STATIC      "atime static files"
index 10802895cd5ddac82871a1101c5e52cceea2a8e8..76df006d82d93769920a2180074d434aaa741c2f 100644 (file)
@@ -132,6 +132,30 @@ int onefs_sys_create_file(connection_struct *conn,
        if (lp_nt_acl_support(SNUM(conn)) && !lp_inherit_perms(SNUM(conn)))
                cf_flags = cf_flags_or(cf_flags, CF_FLAGS_DEFAULT_ACL);
 
+       /*
+        * Some customer workflows require the execute bit to be ignored.
+        */
+       if (lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_ALLOW_EXECUTE_ALWAYS,
+                        PARM_ALLOW_EXECUTE_ALWAYS_DEFAULT) &&
+           (open_access_mask & FILE_EXECUTE)) {
+
+               DEBUG(3, ("Stripping execute bit from %s: (0x%x)\n", path,
+                         open_access_mask));
+
+               /* Strip execute. */
+               open_access_mask &= ~FILE_EXECUTE;
+
+               /*
+                * Add READ_DATA, so we're not left with desired_access=0. An
+                * execute call should imply the client will read the data.
+                */
+               open_access_mask |= FILE_READ_DATA;
+
+               DEBUGADD(3, ("New stripped access mask: 0x%x\n",
+                            open_access_mask));
+       }
+
        DEBUG(10,("onefs_sys_create_file: base_fd = %d, "
                  "open_access_mask = 0x%x, flags = 0x%x, mode = 0%o, "
                  "desired_oplock = %s, id = 0x%x, secinfo = 0x%x, sd = %p, "