diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-03-02 04:15:11 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-03-02 04:15:11 +0100 |
commit | 2d7a3748b2063c4137ee98ceca85361651ef8ee7 (patch) | |
tree | 2fd585a487b3d4af7056022bbf02c61910fe92c6 /source3 | |
parent | c7b9757b8ac3ac6baa478655a4d2f77dff8240a8 (diff) | |
parent | 9b0df441e1bd836c433e11582650fa0171791485 (diff) | |
download | samba-2d7a3748b2063c4137ee98ceca85361651ef8ee7.tar.gz samba-2d7a3748b2063c4137ee98ceca85361651ef8ee7.tar.bz2 samba-2d7a3748b2063c4137ee98ceca85361651ef8ee7.zip |
Merge branch 'master' of git://git.samba.org/samba into convenience
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 4 | ||||
-rw-r--r-- | source3/lib/util_reg_api.c | 2 | ||||
-rw-r--r-- | source3/libgpo/gpo_ini.c | 2 | ||||
-rw-r--r-- | source3/modules/onefs.h | 136 | ||||
-rw-r--r-- | source3/modules/onefs_acl.c | 3 | ||||
-rw-r--r-- | source3/modules/onefs_cbrl.c | 1 | ||||
-rw-r--r-- | source3/modules/onefs_config.c | 276 | ||||
-rw-r--r-- | source3/modules/onefs_config.h | 158 | ||||
-rw-r--r-- | source3/modules/onefs_dir.c | 2 | ||||
-rw-r--r-- | source3/modules/onefs_notify.c | 1 | ||||
-rw-r--r-- | source3/modules/onefs_open.c | 3 | ||||
-rw-r--r-- | source3/modules/onefs_streams.c | 3 | ||||
-rw-r--r-- | source3/modules/onefs_system.c | 54 | ||||
-rw-r--r-- | source3/modules/vfs_onefs.c | 201 | ||||
-rw-r--r-- | source3/rpc_server/srv_eventlog_lib.c | 2 |
15 files changed, 458 insertions, 390 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index abf6cfb5f7..28b5437838 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -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 diff --git a/source3/lib/util_reg_api.c b/source3/lib/util_reg_api.c index 8f28e9c282..9313193f10 100644 --- a/source3/lib/util_reg_api.c +++ b/source3/lib/util_reg_api.c @@ -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; diff --git a/source3/libgpo/gpo_ini.c b/source3/libgpo/gpo_ini.c index aa8f7c7770..edca85530b 100644 --- a/source3/libgpo/gpo_ini.c +++ b/source3/libgpo/gpo_ini.c @@ -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; diff --git a/source3/modules/onefs.h b/source3/modules/onefs.h index a0f4fe37de..ebeece40ad 100644 --- a/source3/modules/onefs.h +++ b/source3/modules/onefs.h @@ -21,134 +21,6 @@ #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 */ diff --git a/source3/modules/onefs_acl.c b/source3/modules/onefs_acl.c index a1bfa6e121..6f23d608d4 100644 --- a/source3/modules/onefs_acl.c +++ b/source3/modules/onefs_acl.c @@ -19,10 +19,13 @@ * 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"}, diff --git a/source3/modules/onefs_cbrl.c b/source3/modules/onefs_cbrl.c index 2c5e39c359..7311e1961e 100644 --- a/source3/modules/onefs_cbrl.c +++ b/source3/modules/onefs_cbrl.c @@ -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 index 0000000000..06f4b16ac1 --- /dev/null +++ b/source3/modules/onefs_config.c @@ -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 index 0000000000..27cbb0ad74 --- /dev/null +++ b/source3/modules/onefs_config.h @@ -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 */ diff --git a/source3/modules/onefs_dir.c b/source3/modules/onefs_dir.c index 83622b2bcd..68a58b3bb2 100644 --- a/source3/modules/onefs_dir.c +++ b/source3/modules/onefs_dir.c @@ -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> diff --git a/source3/modules/onefs_notify.c b/source3/modules/onefs_notify.c index 40f690876d..3455afd4ab 100644 --- a/source3/modules/onefs_notify.c +++ b/source3/modules/onefs_notify.c @@ -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> diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c index 382ecc60a3..9043be8e19 100644 --- a/source3/modules/onefs_open.c +++ b/source3/modules/onefs_open.c @@ -32,7 +32,10 @@ * 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; diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c index 6e2794399d..9f5d5e2284 100644 --- a/source3/modules/onefs_streams.c +++ b/source3/modules/onefs_streams.c @@ -19,7 +19,10 @@ * 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> /* diff --git a/source3/modules/onefs_system.c b/source3/modules/onefs_system.c index 43ebed8d44..b8b059bce9 100644 --- a/source3/modules/onefs_system.c +++ b/source3/modules/onefs_system.c @@ -18,10 +18,14 @@ * 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))); - } -} diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c index f81134909f..f277245bdc 100644 --- a/source3/modules/vfs_onefs.c +++ b/source3/modules/vfs_onefs.c @@ -20,210 +20,11 @@ #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) { diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c index edd1cfacb8..f83c4fc3b8 100644 --- a/source3/rpc_server/srv_eventlog_lib.c +++ b/source3/rpc_server/srv_eventlog_lib.c @@ -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) { |