Merge branch 'master' of git://git.samba.org/samba into convenience
authorJelmer Vernooij <jelmer@samba.org>
Mon, 2 Mar 2009 03:15:11 +0000 (04:15 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 2 Mar 2009 03:15:11 +0000 (04:15 +0100)
15 files changed:
source3/Makefile.in
source3/lib/util_reg_api.c
source3/libgpo/gpo_ini.c
source3/modules/onefs.h
source3/modules/onefs_acl.c
source3/modules/onefs_cbrl.c
source3/modules/onefs_config.c [new file with mode: 0644]
source3/modules/onefs_config.h [new file with mode: 0644]
source3/modules/onefs_dir.c
source3/modules/onefs_notify.c
source3/modules/onefs_open.c
source3/modules/onefs_streams.c
source3/modules/onefs_system.c
source3/modules/vfs_onefs.c
source3/rpc_server/srv_eventlog_lib.c

index abf6cfb5f7c76372be79e04886e6fa6b73045506..28b543783841c4054c457d1d4a1d0d61dc6e1c01 100644 (file)
@@ -672,8 +672,8 @@ VFS_ACL_XATTR_OBJ = modules/vfs_acl_xattr.o
 VFS_ACL_TDB_OBJ = modules/vfs_acl_tdb.o
 VFS_SMB_TRAFFIC_ANALYZER_OBJ = modules/vfs_smb_traffic_analyzer.o
 VFS_ONEFS_OBJ = modules/vfs_onefs.o modules/onefs_acl.o modules/onefs_system.o \
-               modules/onefs_open.o modules/onefs_streams.o modules/onefs_dir.c \
-               modules/onefs_cbrl.o modules/onefs_notify.o
+               modules/onefs_open.o modules/onefs_streams.o modules/onefs_dir.o \
+               modules/onefs_cbrl.o modules/onefs_notify.o modules/onefs_config.o
 VFS_ONEFS_SHADOW_COPY_OBJ = modules/vfs_onefs_shadow_copy.o modules/onefs_shadow_copy.o
 PERFCOUNT_ONEFS_OBJ = modules/perfcount_onefs.o
 PERFCOUNT_TEST_OBJ = modules/perfcount_test.o
index 8f28e9c282f2cb52e680bc5a8aa01aa5564c0bd5..9313193f10e3c75ca2f52df52017286e30bb472f 100644 (file)
@@ -92,7 +92,7 @@ WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
                }
 
                if (!convert_string_talloc(value, CH_UTF16LE, CH_UNIX, tmp,
-                                          length+2, &value->v.sz.str,
+                                          length+2, (void **)&value->v.sz.str,
                                           &value->v.sz.len, False)) {
                        SAFE_FREE(tmp);
                        err = WERR_INVALID_PARAM;
index aa8f7c77700a2fd6b27e8ef81f029d14c4920c6c..edca85530bf57baf88db253aed657cc164eff8e9 100644 (file)
@@ -83,7 +83,7 @@ static NTSTATUS convert_file_from_ucs2(TALLOC_CTX *mem_ctx,
        }
 
        if (!convert_string_talloc(mem_ctx, CH_UTF16LE, CH_UNIX, data_in, n,
-                                  &data_out, &converted_size, False))
+                                  (void **)&data_out, &converted_size, False))
        {
                status = NT_STATUS_INVALID_BUFFER_SIZE;
                goto out;
index a0f4fe37dee0da4734ddc067355f91cd9c6ead8a..ebeece40adbd2ce1e49ba3b99062f64ce920d02b 100644 (file)
 #ifndef _ONEFS_H
 #define _ONEFS_H
 
-#include "includes.h"
-#include "oplock_onefs.h"
-#include <sys/isi_acl.h>
-
-/* OneFS Module smb.conf parameters and defaults */
-
-/**
-* Specifies when ACLs presented to Windows should be canonicalized
-* into the ordering which Explorer expects.
-*/
-enum onefs_acl_wire_format
-{
-       ACL_FORMAT_RAW, /**< Never canonicalize */
-       ACL_FORMAT_WINDOWS_SD, /**< Only canonicalize synthetic ACLs */
-       ACL_FORMAT_ALWAYS /**< Always canonicalize */
-};
-
-#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"
-#define PARM_ATIME_STATIC_DEFAULT NULL
-#define PARM_ATIME_SLOP                "atime now slop"
-#define PARM_ATIME_SLOP_DEFAULT         0
-#define PARM_ATOMIC_SENDFILE "atomic sendfile"
-#define PARM_ATOMIC_SENDFILE_DEFAULT true
-#define PARM_CREATOR_OWNER_GETS_FULL_CONTROL "creator owner gets full control"
-#define PARM_CREATOR_OWNER_GETS_FULL_CONTROL_DEFAULT true
-#define PARM_CTIME_NOW         "ctime now files"
-#define PARM_CTIME_NOW_DEFAULT  NULL
-#define PARM_CTIME_SLOP                "ctime now slop"
-#define PARM_CTIME_SLOP_DEFAULT        0
-#define PARM_DOT_SNAP_CHILD_ACCESSIBLE "dot snap child accessible"
-#define PARM_DOT_SNAP_CHILD_ACCESSIBLE_DEFAULT true
-#define PARM_DOT_SNAP_CHILD_VISIBLE "dot snap child visible"
-#define PARM_DOT_SNAP_CHILD_VISIBLE_DEFAULT false
-#define PARM_DOT_SNAP_ROOT_ACCESSIBLE "dot snap root accessible"
-#define PARM_DOT_SNAP_ROOT_ACCESSIBLE_DEFAULT true
-#define PARM_DOT_SNAP_ROOT_VISIBLE "dot snap root visible"
-#define PARM_DOT_SNAP_ROOT_VISIBLE_DEFAULT true
-#define PARM_DOT_SNAP_TILDE "dot snap tilde"
-#define PARM_DOT_SNAP_TILDE_DEFAULT true
-#define PARM_IGNORE_SACLS "ignore sacls"
-#define PARM_IGNORE_SACLS_DEFAULT false
-#define PARM_MTIME_NOW         "mtime now files"
-#define PARM_MTIME_NOW_DEFAULT NULL
-#define PARM_MTIME_STATIC      "mtime static files"
-#define PARM_MTIME_STATIC_DEFAULT NULL
-#define PARM_MTIME_SLOP                "mtime now slop"
-#define PARM_MTIME_SLOP_DEFAULT        0
-#define PARM_USE_READDIRPLUS "use readdirplus"
-#define PARM_USE_READDIRPLUS_DEFAULT true
-#define PARM_SENDFILE_LARGE_READS "sendfile large reads"
-#define PARM_SENDFILE_LARGE_READS_DEFAULT false
-#define PARM_SENDFILE_SAFE "sendfile safe"
-#define PARM_SENDFILE_SAFE_DEFAULT true
-#define PARM_SIMPLE_FILE_SHARING_COMPATIBILITY_MODE "simple file sharing compatibility mode"
-#define PARM_SIMPLE_FILE_SHARING_COMPATIBILITY_MODE_DEFAULT false
-#define PARM_UNMAPPABLE_SIDS_DENY_EVERYONE "unmappable sids deny everyone"
-#define PARM_UNMAPPABLE_SIDS_DENY_EVERYONE_DEFAULT false
-#define PARM_UNMAPPABLE_SIDS_IGNORE "ignore unmappable sids"
-#define PARM_UNMAPPABLE_SIDS_IGNORE_DEFAULT false
-#define PARM_UNMAPPABLE_SIDS_IGNORE_LIST "unmappable sids ignore list"
-#define PARM_UNMAPPABLE_SIDS_IGNORE_LIST_DEFAULT NULL
-
-#define IS_CTIME_NOW_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
-       (cfg)->ctime_now_list,(conn)->case_sensitive))
-#define IS_MTIME_NOW_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
-       (cfg)->mtime_now_list,(conn)->case_sensitive))
-#define IS_ATIME_NOW_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
-       (cfg)->atime_now_list,(conn)->case_sensitive))
-#define IS_MTIME_STATIC_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
-       (cfg)->mtime_static_list,(conn)->case_sensitive))
-#define IS_ATIME_STATIC_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
-       (cfg)->atime_static_list,(conn)->case_sensitive))
-
-/*
- * Store some commonly evaluated parameters to avoid loadparm pain.
- */
-
-#define ONEFS_VFS_CONFIG_INITIALIZED   0x00010000
-
-#define ONEFS_VFS_CONFIG_FAKETIMESTAMPS        0x00000001
-
-struct onefs_vfs_share_config
-{
-       uint32_t init_flags;
-
-       /* data for fake timestamps */
-       int atime_slop;
-       int ctime_slop;
-       int mtime_slop;
-
-       /* Per-share list of files to fake the create time for. */
-        name_compare_entry *ctime_now_list;
-
-       /* Per-share list of files to fake the modification time for. */
-       name_compare_entry *mtime_now_list;
-
-       /* Per-share list of files to fake the access time for. */
-       name_compare_entry *atime_now_list;
-
-       /* Per-share list of files to fake the modification time for. */
-       name_compare_entry *mtime_static_list;
-
-       /* The access  time  will  equal  the  create  time.  */
-       /* The  modification  time  will  equal  the  create  time.*/
-
-       /* Per-share list of files to fake the access time for. */
-       name_compare_entry *atime_static_list;
-};
-
-struct onefs_vfs_global_config
-{
-       uint32_t init_flags;
-
-       /* Snapshot options */
-       bool dot_snap_child_accessible;
-       bool dot_snap_child_visible;
-       bool dot_snap_root_accessible;
-       bool dot_snap_root_visible;
-       bool dot_snap_tilde;
-};
-
 /*
  * vfs interface handlers
  */
@@ -255,15 +127,13 @@ NTSTATUS onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
 /*
  * Utility functions
  */
+struct ifs_security_descriptor;
 NTSTATUS onefs_samba_sd_to_sd(uint32 security_info_sent, SEC_DESC *psd,
                              struct ifs_security_descriptor *sd, int snum);
 
 NTSTATUS onefs_split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
                                      char **pbase, char **pstream);
 
-bool onefs_get_config(int snum, int config_type,
-                     struct onefs_vfs_share_config *cfg);
-
 int onefs_rdp_add_dir_state(connection_struct *conn, SMB_STRUCT_DIR *dirp);
 
 /*
@@ -291,8 +161,4 @@ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd,
 ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset,
                           size_t count);
 
-void onefs_sys_config_enc(void);
-void onefs_sys_config_snap_opt(struct onefs_vfs_global_config *global_config);
-void onefs_sys_config_tilde(struct onefs_vfs_global_config *global_config);
-
 #endif /* _ONEFS_H */
index a1bfa6e121e19659605d2a53fbf1d696374ac478..6f23d608d46da0a298f3bc1d0152e1cb8c22405e 100644 (file)
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "includes.h"
 #include "onefs.h"
+#include "onefs_config.h"
 
 #include <isi_acl/isi_acl_util.h>
 #include <ifs/ifs_syscalls.h>
+#include <sys/isi_acl.h>
 
 const struct enum_list enum_onefs_acl_wire_format[] = {
        {ACL_FORMAT_RAW,  "No Format"},
index 2c5e39c3596192ce63411c4ef9427fa92cded60a..7311e1961e47ac9103667409657990fcb16452fa 100644 (file)
@@ -18,6 +18,7 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "includes.h"
 #include "onefs.h"
 
 #include <ifs/ifs_syscalls.h>
diff --git a/source3/modules/onefs_config.c b/source3/modules/onefs_config.c
new file mode 100644 (file)
index 0000000..06f4b16
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Support for OneFS
+ *
+ * Copyright (C) Todd Stecher, 2009
+ * Copyright (C) Tim Prouty, 2009
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "onefs_config.h"
+
+#include <ifs/ifs_syscalls.h>
+
+#define ONEFS_DATA_FASTBUF     10
+
+struct onefs_vfs_share_config vfs_share_config[ONEFS_DATA_FASTBUF];
+struct onefs_vfs_share_config *pvfs_share_config;
+
+static void onefs_load_faketimestamp_config(struct connection_struct *conn,
+                                           struct onefs_vfs_share_config *cfg)
+{
+       const char **parm;
+       int snum = SNUM(conn);
+
+       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_ATIME_NOW,
+                                  PARM_ATIME_NOW_DEFAULT);
+
+       if (parm) {
+               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
+               set_namearray(&cfg->atime_now_list,*parm);
+       }
+
+       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_CTIME_NOW,
+                                  PARM_CTIME_NOW_DEFAULT);
+
+       if (parm) {
+               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
+               set_namearray(&cfg->ctime_now_list,*parm);
+       }
+
+       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_MTIME_NOW,
+                                  PARM_MTIME_NOW_DEFAULT);
+
+       if (parm) {
+               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
+               set_namearray(&cfg->mtime_now_list,*parm);
+       }
+
+       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_ATIME_STATIC,
+                                  PARM_ATIME_STATIC_DEFAULT);
+
+       if (parm) {
+               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
+               set_namearray(&cfg->atime_static_list,*parm);
+       }
+
+       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_MTIME_STATIC,
+                                  PARM_MTIME_STATIC_DEFAULT);
+
+       if (parm) {
+               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
+               set_namearray(&cfg->mtime_static_list,*parm);
+       }
+
+       cfg->atime_slop = lp_parm_int(snum, PARM_ONEFS_TYPE, PARM_ATIME_SLOP,
+                                     PARM_ATIME_SLOP_DEFAULT);
+       cfg->ctime_slop = lp_parm_int(snum, PARM_ONEFS_TYPE, PARM_CTIME_SLOP,
+                                     PARM_CTIME_SLOP_DEFAULT);
+       cfg->mtime_slop = lp_parm_int(snum, PARM_ONEFS_TYPE, PARM_MTIME_SLOP,
+                                     PARM_MTIME_SLOP_DEFAULT);
+}
+
+/**
+ * Set onefs-specific vfs global config parameters.
+ *
+ * Since changes in these parameters require calling syscalls, we only want to
+ * call them when the configuration actually changes.
+ */
+static void onefs_load_global_config(connection_struct *conn)
+{
+       static struct onefs_vfs_global_config global_config;
+       bool dot_snap_child_accessible;
+       bool dot_snap_child_visible;
+       bool dot_snap_root_accessible;
+       bool dot_snap_root_visible;
+       bool dot_snap_tilde;
+       bool reconfig_dso = false;
+       bool reconfig_tilde = false;
+
+       /* Check if this is the first time setting the config options. */
+       if (!(global_config.init_flags & ONEFS_VFS_CONFIG_INITIALIZED)) {
+               global_config.init_flags |= ONEFS_VFS_CONFIG_INITIALIZED;
+
+               /* Set process encoding */
+               onefs_sys_config_enc();
+
+               reconfig_dso = true;
+               reconfig_tilde = true;
+       }
+
+       /* Get the dot snap options from the conf. */
+       dot_snap_child_accessible =
+           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_DOT_SNAP_CHILD_ACCESSIBLE,
+                        PARM_DOT_SNAP_CHILD_ACCESSIBLE_DEFAULT);
+       dot_snap_child_visible =
+           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_DOT_SNAP_CHILD_VISIBLE,
+                        PARM_DOT_SNAP_CHILD_VISIBLE_DEFAULT);
+       dot_snap_root_accessible =
+           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_DOT_SNAP_ROOT_ACCESSIBLE,
+                        PARM_DOT_SNAP_ROOT_ACCESSIBLE_DEFAULT);
+       dot_snap_root_visible =
+           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_DOT_SNAP_ROOT_VISIBLE,
+                        PARM_DOT_SNAP_ROOT_VISIBLE_DEFAULT);
+       dot_snap_tilde =
+           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
+                        PARM_DOT_SNAP_TILDE,
+                        PARM_DOT_SNAP_TILDE_DEFAULT);
+
+       /* Check if any of the dot snap options need updating. */
+       if (dot_snap_child_accessible !=
+           global_config.dot_snap_child_accessible) {
+               global_config.dot_snap_child_accessible =
+                   dot_snap_child_accessible;
+               reconfig_dso = true;
+       }
+       if (dot_snap_child_visible !=
+           global_config.dot_snap_child_visible) {
+               global_config.dot_snap_child_visible =
+                   dot_snap_child_visible;
+               reconfig_dso = true;
+       }
+       if (dot_snap_root_accessible !=
+           global_config.dot_snap_root_accessible) {
+               global_config.dot_snap_root_accessible =
+                   dot_snap_root_accessible;
+               reconfig_dso = true;
+       }
+       if (dot_snap_root_visible !=
+           global_config.dot_snap_root_visible) {
+               global_config.dot_snap_root_visible =
+                   dot_snap_root_visible;
+               reconfig_dso = true;
+       }
+       if (dot_snap_tilde != global_config.dot_snap_tilde) {
+               global_config.dot_snap_tilde = dot_snap_tilde;
+               reconfig_tilde = true;
+       }
+
+       /* If a dot snap option has changed update the process.  */
+       if (reconfig_dso) {
+               onefs_sys_config_snap_opt(&global_config);
+       }
+
+       /* If the dot snap tilde option has changed update the process.  */
+       if (reconfig_tilde) {
+               onefs_sys_config_tilde(&global_config);
+       }
+}
+
+int onefs_load_config(connection_struct *conn)
+{
+       int snum = SNUM(conn);
+       int share_count = lp_numservices();
+
+       /* Share config */
+       if (!pvfs_share_config) {
+
+               if (share_count <= ONEFS_DATA_FASTBUF)
+                       pvfs_share_config = vfs_share_config;
+               else {
+                       pvfs_share_config =
+                           SMB_MALLOC_ARRAY(struct onefs_vfs_share_config,
+                                            share_count);
+                       if (!pvfs_share_config) {
+                               errno = ENOMEM;
+                               return -1;
+                       }
+
+                       memset(pvfs_share_config, 0,
+                           (sizeof(struct onefs_vfs_share_config) *
+                                   share_count));
+               }
+       }
+
+       if ((pvfs_share_config[snum].init_flags &
+               ONEFS_VFS_CONFIG_INITIALIZED) == 0) {
+                       pvfs_share_config[snum].init_flags =
+                           ONEFS_VFS_CONFIG_INITIALIZED;
+                       onefs_load_faketimestamp_config(conn,
+                                                       &pvfs_share_config[snum]);
+       }
+
+       /* Global config */
+       onefs_load_global_config(conn);
+
+       return 0;
+}
+
+bool onefs_get_config(int snum, int config_type,
+                     struct onefs_vfs_share_config *cfg)
+{
+       if (vfs_share_config[snum].init_flags & config_type)
+               *cfg = vfs_share_config[snum];
+       else
+               return false;
+
+       return true;
+}
+
+
+/**
+ * Set the per-process encoding, ignoring errors.
+ */
+void onefs_sys_config_enc(void)
+{
+       int ret;
+
+       ret = enc_set_proc(ENC_UTF8);
+       if (ret) {
+               DEBUG(0, ("Setting process encoding failed: %s",
+                       strerror(errno)));
+       }
+}
+
+/**
+ * Set the per-process .snpashot directory options, ignoring errors.
+ */
+void onefs_sys_config_snap_opt(struct onefs_vfs_global_config *global_config)
+{
+       struct ifs_dotsnap_options dso;
+       int ret;
+
+       dso.per_proc = 1;
+       dso.sub_accessible = global_config->dot_snap_child_accessible;
+       dso.sub_visible = global_config->dot_snap_child_visible;
+       dso.root_accessible = global_config->dot_snap_root_accessible;
+       dso.root_visible = global_config->dot_snap_root_visible;
+
+       ret = ifs_set_dotsnap_options(&dso);
+       if (ret) {
+               DEBUG(0, ("Setting snapshot visibility/accessibility "
+                       "failed: %s", strerror(errno)));
+       }
+}
+
+/**
+ * Set the per-process flag saying whether or not to accept ~snapshot
+ * as an alternative name for .snapshot directories.
+ */
+void onefs_sys_config_tilde(struct onefs_vfs_global_config *global_config)
+{
+       int ret;
+
+       ret = ifs_tilde_snapshot(global_config->dot_snap_tilde);
+       if (ret) {
+               DEBUG(0, ("Setting snapshot tilde failed: %s",
+                       strerror(errno)));
+       }
+}
diff --git a/source3/modules/onefs_config.h b/source3/modules/onefs_config.h
new file mode 100644 (file)
index 0000000..27cbb0a
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * OneFS vfs module configuration and defaults
+ *
+ * Copyright (C) Steven Danneman, 2008
+ * Copyright (C) Tim Prouty, 2009
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _ONEFS_CONFIG_H
+#define _ONEFS_CONFIG_H
+
+/**
+* Specifies when ACLs presented to Windows should be canonicalized
+* into the ordering which Explorer expects.
+*/
+enum onefs_acl_wire_format
+{
+       ACL_FORMAT_RAW, /**< Never canonicalize */
+       ACL_FORMAT_WINDOWS_SD, /**< Only canonicalize synthetic ACLs */
+       ACL_FORMAT_ALWAYS /**< Always canonicalize */
+};
+
+#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"
+#define PARM_ATIME_STATIC_DEFAULT NULL
+#define PARM_ATIME_SLOP                "atime now slop"
+#define PARM_ATIME_SLOP_DEFAULT         0
+#define PARM_ATOMIC_SENDFILE "atomic sendfile"
+#define PARM_ATOMIC_SENDFILE_DEFAULT true
+#define PARM_CREATOR_OWNER_GETS_FULL_CONTROL "creator owner gets full control"
+#define PARM_CREATOR_OWNER_GETS_FULL_CONTROL_DEFAULT true
+#define PARM_CTIME_NOW         "ctime now files"
+#define PARM_CTIME_NOW_DEFAULT  NULL
+#define PARM_CTIME_SLOP                "ctime now slop"
+#define PARM_CTIME_SLOP_DEFAULT        0
+#define PARM_DOT_SNAP_CHILD_ACCESSIBLE "dot snap child accessible"
+#define PARM_DOT_SNAP_CHILD_ACCESSIBLE_DEFAULT true
+#define PARM_DOT_SNAP_CHILD_VISIBLE "dot snap child visible"
+#define PARM_DOT_SNAP_CHILD_VISIBLE_DEFAULT false
+#define PARM_DOT_SNAP_ROOT_ACCESSIBLE "dot snap root accessible"
+#define PARM_DOT_SNAP_ROOT_ACCESSIBLE_DEFAULT true
+#define PARM_DOT_SNAP_ROOT_VISIBLE "dot snap root visible"
+#define PARM_DOT_SNAP_ROOT_VISIBLE_DEFAULT true
+#define PARM_DOT_SNAP_TILDE "dot snap tilde"
+#define PARM_DOT_SNAP_TILDE_DEFAULT true
+#define PARM_IGNORE_SACLS "ignore sacls"
+#define PARM_IGNORE_SACLS_DEFAULT false
+#define PARM_MTIME_NOW         "mtime now files"
+#define PARM_MTIME_NOW_DEFAULT NULL
+#define PARM_MTIME_STATIC      "mtime static files"
+#define PARM_MTIME_STATIC_DEFAULT NULL
+#define PARM_MTIME_SLOP                "mtime now slop"
+#define PARM_MTIME_SLOP_DEFAULT        0
+#define PARM_USE_READDIRPLUS "use readdirplus"
+#define PARM_USE_READDIRPLUS_DEFAULT true
+#define PARM_SENDFILE_LARGE_READS "sendfile large reads"
+#define PARM_SENDFILE_LARGE_READS_DEFAULT false
+#define PARM_SENDFILE_SAFE "sendfile safe"
+#define PARM_SENDFILE_SAFE_DEFAULT true
+#define PARM_SIMPLE_FILE_SHARING_COMPATIBILITY_MODE "simple file sharing compatibility mode"
+#define PARM_SIMPLE_FILE_SHARING_COMPATIBILITY_MODE_DEFAULT false
+#define PARM_UNMAPPABLE_SIDS_DENY_EVERYONE "unmappable sids deny everyone"
+#define PARM_UNMAPPABLE_SIDS_DENY_EVERYONE_DEFAULT false
+#define PARM_UNMAPPABLE_SIDS_IGNORE "ignore unmappable sids"
+#define PARM_UNMAPPABLE_SIDS_IGNORE_DEFAULT false
+#define PARM_UNMAPPABLE_SIDS_IGNORE_LIST "unmappable sids ignore list"
+#define PARM_UNMAPPABLE_SIDS_IGNORE_LIST_DEFAULT NULL
+
+#define IS_CTIME_NOW_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
+       (cfg)->ctime_now_list,(conn)->case_sensitive))
+#define IS_MTIME_NOW_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
+       (cfg)->mtime_now_list,(conn)->case_sensitive))
+#define IS_ATIME_NOW_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
+       (cfg)->atime_now_list,(conn)->case_sensitive))
+#define IS_MTIME_STATIC_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
+       (cfg)->mtime_static_list,(conn)->case_sensitive))
+#define IS_ATIME_STATIC_PATH(conn,cfg,path)  ((conn) && is_in_path((path),\
+       (cfg)->atime_static_list,(conn)->case_sensitive))
+
+/*
+ * Store some commonly evaluated parameters to avoid loadparm pain.
+ */
+
+#define ONEFS_VFS_CONFIG_INITIALIZED   0x00010000
+
+#define ONEFS_VFS_CONFIG_FAKETIMESTAMPS        0x00000001
+
+struct onefs_vfs_share_config
+{
+       uint32_t init_flags;
+
+       /* data for fake timestamps */
+       int atime_slop;
+       int ctime_slop;
+       int mtime_slop;
+
+       /* Per-share list of files to fake the create time for. */
+        name_compare_entry *ctime_now_list;
+
+       /* Per-share list of files to fake the modification time for. */
+       name_compare_entry *mtime_now_list;
+
+       /* Per-share list of files to fake the access time for. */
+       name_compare_entry *atime_now_list;
+
+       /* Per-share list of files to fake the modification time for. */
+       name_compare_entry *mtime_static_list;
+
+       /* The access  time  will  equal  the  create  time.  */
+       /* The  modification  time  will  equal  the  create  time.*/
+
+       /* Per-share list of files to fake the access time for. */
+       name_compare_entry *atime_static_list;
+};
+
+struct onefs_vfs_global_config
+{
+       uint32_t init_flags;
+
+       /* Snapshot options */
+       bool dot_snap_child_accessible;
+       bool dot_snap_child_visible;
+       bool dot_snap_root_accessible;
+       bool dot_snap_root_visible;
+       bool dot_snap_tilde;
+};
+
+int onefs_load_config(connection_struct *conn);
+
+bool onefs_get_config(int snum, int config_type,
+                     struct onefs_vfs_share_config *cfg);
+
+void onefs_sys_config_enc(void);
+
+void onefs_sys_config_snap_opt(struct onefs_vfs_global_config *global_config);
+
+void onefs_sys_config_tilde(struct onefs_vfs_global_config *global_config);
+
+#endif /* _ONEFS_CONFIG_H */
index 83622b2bcdabb848e32f452152edfefbabfe139d..68a58b3bb256a9d32f9ad1d8596150ab15c874d3 100644 (file)
@@ -19,7 +19,9 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "includes.h"
 #include "onefs.h"
+#include "onefs_config.h"
 
 #include <ifs/ifs_syscalls.h>
 
index 40f690876d5fd2cfeab64436ff937b85c483baf6..3455afd4ab42cd54bba82617d80273466fdd9d15 100644 (file)
@@ -33,6 +33,7 @@
  * CompletionFilter and WatchTree of open SMB requests, and return notify
  * events back to the proper SMB requests */
 
+#include "includes.h"
 #include "onefs.h"
 
 #include <ifs/ifs_types.h>
index 382ecc60a33e8393c8a2be2dcf83c25aa599e0aa..9043be8e19bf64993e18c6ad0170ebb38f0ef5b6 100644 (file)
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "includes.h"
 #include "onefs.h"
+#include "onefs_config.h"
+#include "oplock_onefs.h"
 #include "smbd/globals.h"
 
 extern const struct generic_mapping file_generic_mapping;
index 6e2794399d8afe9fad4aec282c137f969a4c3e02..9f5d5e22843a6289905bd46d0e430684c4e696b2 100644 (file)
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "includes.h"
 #include "onefs.h"
+#include "onefs_config.h"
+
 #include <sys/isi_enc.h>
 
 /*
index 43ebed8d443c3c7ccd23a86931415d22e32add8d..b8b059bce9504737ae36924c6337ab21294ea92a 100644 (file)
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "includes.h"
 #include "onefs.h"
+#include "onefs_config.h"
+#include "oplock_onefs.h"
 
 #include <ifs/ifs_syscalls.h>
 #include <isi_acl/isi_acl_util.h>
+#include <sys/isi_acl.h>
 
 /*
  * Initialize the sm_lock struct before passing it to ifs_createfile.
@@ -656,53 +660,3 @@ out:
 
        return ret;
 }
-
-/**
- * Set the per-process encoding, ignoring errors.
- */
-void onefs_sys_config_enc(void)
-{
-       int ret;
-
-       ret = enc_set_proc(ENC_UTF8);
-       if (ret) {
-               DEBUG(0, ("Setting process encoding failed: %s",
-                       strerror(errno)));
-       }
-}
-
-/**
- * Set the per-process .snpashot directory options, ignoring errors.
- */
-void onefs_sys_config_snap_opt(struct onefs_vfs_global_config *global_config)
-{
-       struct ifs_dotsnap_options dso;
-       int ret;
-
-       dso.per_proc = 1;
-       dso.sub_accessible = global_config->dot_snap_child_accessible;
-       dso.sub_visible = global_config->dot_snap_child_visible;
-       dso.root_accessible = global_config->dot_snap_root_accessible;
-       dso.root_visible = global_config->dot_snap_root_visible;
-
-       ret = ifs_set_dotsnap_options(&dso);
-       if (ret) {
-               DEBUG(0, ("Setting snapshot visibility/accessibility "
-                       "failed: %s", strerror(errno)));
-       }
-}
-
-/**
- * Set the per-process flag saying whether or not to accept ~snapshot
- * as an alternative name for .snapshot directories.
- */
-void onefs_sys_config_tilde(struct onefs_vfs_global_config *global_config)
-{
-       int ret;
-
-       ret = ifs_tilde_snapshot(global_config->dot_snap_tilde);
-       if (ret) {
-               DEBUG(0, ("Setting snapshot tilde failed: %s",
-                       strerror(errno)));
-       }
-}
index f81134909f8329b6f80808a6415f617c32555ccb..f277245bdc040feaaebd5352a09a8e3353e19794 100644 (file)
 
 #include "includes.h"
 #include "onefs.h"
+#include "onefs_config.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
-#define ONEFS_DATA_FASTBUF     10
-
-struct onefs_vfs_share_config vfs_share_config[ONEFS_DATA_FASTBUF];
-struct onefs_vfs_share_config *pvfs_share_config;
-
-static void onefs_load_faketimestamp_config(struct connection_struct *conn,
-                                           struct onefs_vfs_share_config *cfg)
-{
-       const char **parm;
-       int snum = SNUM(conn);
-
-       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_ATIME_NOW,
-                                  PARM_ATIME_NOW_DEFAULT);
-
-       if (parm) {
-               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
-               set_namearray(&cfg->atime_now_list,*parm);
-       }
-
-       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_CTIME_NOW,
-                                  PARM_CTIME_NOW_DEFAULT);
-
-       if (parm) {
-               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
-               set_namearray(&cfg->ctime_now_list,*parm);
-       }
-
-       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_MTIME_NOW,
-                                  PARM_MTIME_NOW_DEFAULT);
-
-       if (parm) {
-               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
-               set_namearray(&cfg->mtime_now_list,*parm);
-       }
-
-       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_ATIME_STATIC,
-                                  PARM_ATIME_STATIC_DEFAULT);
-
-       if (parm) {
-               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
-               set_namearray(&cfg->atime_static_list,*parm);
-       }
-
-       parm = lp_parm_string_list(snum, PARM_ONEFS_TYPE, PARM_MTIME_STATIC,
-                                  PARM_MTIME_STATIC_DEFAULT);
-
-       if (parm) {
-               cfg->init_flags |= ONEFS_VFS_CONFIG_FAKETIMESTAMPS;
-               set_namearray(&cfg->mtime_static_list,*parm);
-       }
-
-       cfg->atime_slop = lp_parm_int(snum, PARM_ONEFS_TYPE, PARM_ATIME_SLOP,
-                                     PARM_ATIME_SLOP_DEFAULT);
-       cfg->ctime_slop = lp_parm_int(snum, PARM_ONEFS_TYPE, PARM_CTIME_SLOP,
-                                     PARM_CTIME_SLOP_DEFAULT);
-       cfg->mtime_slop = lp_parm_int(snum, PARM_ONEFS_TYPE, PARM_MTIME_SLOP,
-                                     PARM_MTIME_SLOP_DEFAULT);
-}
-
-/**
- * Set onefs-specific vfs global config parameters.
- *
- * Since changes in these parameters require calling syscalls, we only want to
- * call them when the configuration actually changes.
- */
-static void onefs_load_global_config(connection_struct *conn)
-{
-       static struct onefs_vfs_global_config global_config;
-       bool dot_snap_child_accessible;
-       bool dot_snap_child_visible;
-       bool dot_snap_root_accessible;
-       bool dot_snap_root_visible;
-       bool dot_snap_tilde;
-       bool reconfig_dso = false;
-       bool reconfig_tilde = false;
-
-       /* Check if this is the first time setting the config options. */
-       if (!(global_config.init_flags & ONEFS_VFS_CONFIG_INITIALIZED)) {
-               global_config.init_flags |= ONEFS_VFS_CONFIG_INITIALIZED;
-
-               /* Set process encoding */
-               onefs_sys_config_enc();
-
-               reconfig_dso = true;
-               reconfig_tilde = true;
-       }
-
-       /* Get the dot snap options from the conf. */
-       dot_snap_child_accessible =
-           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
-                        PARM_DOT_SNAP_CHILD_ACCESSIBLE,
-                        PARM_DOT_SNAP_CHILD_ACCESSIBLE_DEFAULT);
-       dot_snap_child_visible =
-           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
-                        PARM_DOT_SNAP_CHILD_VISIBLE,
-                        PARM_DOT_SNAP_CHILD_VISIBLE_DEFAULT);
-       dot_snap_root_accessible =
-           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
-                        PARM_DOT_SNAP_ROOT_ACCESSIBLE,
-                        PARM_DOT_SNAP_ROOT_ACCESSIBLE_DEFAULT);
-       dot_snap_root_visible =
-           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
-                        PARM_DOT_SNAP_ROOT_VISIBLE,
-                        PARM_DOT_SNAP_ROOT_VISIBLE_DEFAULT);
-       dot_snap_tilde =
-           lp_parm_bool(SNUM(conn), PARM_ONEFS_TYPE,
-                        PARM_DOT_SNAP_TILDE,
-                        PARM_DOT_SNAP_TILDE_DEFAULT);
-
-       /* Check if any of the dot snap options need updating. */
-       if (dot_snap_child_accessible !=
-           global_config.dot_snap_child_accessible) {
-               global_config.dot_snap_child_accessible =
-                   dot_snap_child_accessible;
-               reconfig_dso = true;
-       }
-       if (dot_snap_child_visible !=
-           global_config.dot_snap_child_visible) {
-               global_config.dot_snap_child_visible =
-                   dot_snap_child_visible;
-               reconfig_dso = true;
-       }
-       if (dot_snap_root_accessible !=
-           global_config.dot_snap_root_accessible) {
-               global_config.dot_snap_root_accessible =
-                   dot_snap_root_accessible;
-               reconfig_dso = true;
-       }
-       if (dot_snap_root_visible !=
-           global_config.dot_snap_root_visible) {
-               global_config.dot_snap_root_visible =
-                   dot_snap_root_visible;
-               reconfig_dso = true;
-       }
-       if (dot_snap_tilde != global_config.dot_snap_tilde) {
-               global_config.dot_snap_tilde = dot_snap_tilde;
-               reconfig_tilde = true;
-       }
-
-       /* If a dot snap option has changed update the process.  */
-       if (reconfig_dso) {
-               onefs_sys_config_snap_opt(&global_config);
-       }
-
-       /* If the dot snap tilde option has changed update the process.  */
-       if (reconfig_tilde) {
-               onefs_sys_config_tilde(&global_config);
-       }
-}
-
-static int onefs_load_config(connection_struct *conn)
-{
-       int snum = SNUM(conn);
-       int share_count = lp_numservices();
-
-       /* Share config */
-       if (!pvfs_share_config) {
-
-               if (share_count <= ONEFS_DATA_FASTBUF)
-                       pvfs_share_config = vfs_share_config;
-               else {
-                       pvfs_share_config =
-                           SMB_MALLOC_ARRAY(struct onefs_vfs_share_config,
-                                            share_count);
-                       if (!pvfs_share_config) {
-                               errno = ENOMEM;
-                               return -1;
-                       }
-
-                       memset(pvfs_share_config, 0,
-                           (sizeof(struct onefs_vfs_share_config) *
-                                   share_count));
-               }
-       }
-
-       if ((pvfs_share_config[snum].init_flags &
-               ONEFS_VFS_CONFIG_INITIALIZED) == 0) {
-                       pvfs_share_config[snum].init_flags =
-                           ONEFS_VFS_CONFIG_INITIALIZED;
-                       onefs_load_faketimestamp_config(conn,
-                                                       &pvfs_share_config[snum]);
-       }
-
-       /* Global config */
-       onefs_load_global_config(conn);
-
-       return 0;
-}
-
-bool onefs_get_config(int snum, int config_type,
-                     struct onefs_vfs_share_config *cfg)
-{
-       if (vfs_share_config[snum].init_flags & config_type)
-               *cfg = vfs_share_config[snum];
-       else
-               return false;
-
-       return true;
-}
-
 static int onefs_connect(struct vfs_handle_struct *handle, const char *service,
                         const char *user)
 {
index edd1cfacb829a1fe9638a646656a87b852cccd2d..f83c4fc3b83fa868cd5a2a101b771c9873cb060d 100644 (file)
@@ -936,7 +936,7 @@ NTSTATUS evlog_tdb_entry_to_evt_entry(TALLOC_CTX *mem_ctx,
                size_t len;
                if (!convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX,
                                           t->sid.data, t->sid.length,
-                                          &sid_str, &len, false)) {
+                                          (void **)&sid_str, &len, false)) {
                        return NT_STATUS_INVALID_SID;
                }
                if (len > 0) {