2 * Unix SMB/CIFS implementation.
5 * Copyright (C) Steven Danneman, 2008
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 #include "oplock_onefs.h"
26 #include <sys/isi_acl.h>
28 /* OneFS Module smb.conf parameters and defaults */
31 * Specifies when ACLs presented to Windows should be canonicalized
32 * into the ordering which Explorer expects.
34 enum onefs_acl_wire_format
36 ACL_FORMAT_RAW, /**< Never canonicalize */
37 ACL_FORMAT_WINDOWS_SD, /**< Only canonicalize synthetic ACLs */
38 ACL_FORMAT_ALWAYS /**< Always canonicalize */
41 #define PARM_ONEFS_TYPE "onefs"
42 #define PARM_ACL_WIRE_FORMAT "acl wire format"
43 #define PARM_ACL_WIRE_FORMAT_DEFAULT ACL_FORMAT_WINDOWS_SD
44 #define PARM_ATIME_NOW "atime now files"
45 #define PARM_ATIME_STATIC "atime static files"
46 #define PARM_ATIME_SLOP "atime now slop"
47 #define PARM_CREATOR_OWNER_GETS_FULL_CONTROL "creator owner gets full control"
48 #define PARM_CREATOR_OWNER_GETS_FULL_CONTROL_DEFAULT true
49 #define PARM_CTIME_NOW "ctime now files"
50 #define PARM_CTIME_SLOP "ctime now slop"
51 #define PARM_IGNORE_SACLS "ignore sacls"
52 #define PARM_IGNORE_SACLS_DEFAULT false
53 #define PARM_MTIME_NOW "mtime now files"
54 #define PARM_MTIME_STATIC "mtime static files"
55 #define PARM_MTIME_SLOP "mtime now slop"
56 #define PARM_USE_READDIRPLUS "use readdirplus"
57 #define PARM_USE_READDIRPLUS_DEFAULT true
58 #define PARM_SIMPLE_FILE_SHARING_COMPATIBILITY_MODE "simple file sharing compatibility mode"
59 #define PARM_SIMPLE_FILE_SHARING_COMPATIBILITY_MODE_DEFAULT false
60 #define PARM_UNMAPPABLE_SIDS_DENY_EVERYONE "unmappable sids deny everyone"
61 #define PARM_UNMAPPABLE_SIDS_DENY_EVERYONE_DEFAULT false
62 #define PARM_UNMAPPABLE_SIDS_IGNORE "ignore unmappable sids"
63 #define PARM_UNMAPPABLE_SIDS_IGNORE_DEFAULT false
64 #define PARM_UNMAPPABLE_SIDS_IGNORE_LIST "unmappable sids ignore list"
65 #define PARM_UNMAPPABLE_SIDS_IGNORE_LIST_DEFAULT NULL
67 #define IS_CTIME_NOW_PATH(conn,cfg,path) ((conn) && is_in_path((path),\
68 (cfg)->ctime_now_list,(conn)->case_sensitive))
69 #define IS_MTIME_NOW_PATH(conn,cfg,path) ((conn) && is_in_path((path),\
70 (cfg)->mtime_now_list,(conn)->case_sensitive))
71 #define IS_ATIME_NOW_PATH(conn,cfg,path) ((conn) && is_in_path((path),\
72 (cfg)->atime_now_list,(conn)->case_sensitive))
73 #define IS_MTIME_STATIC_PATH(conn,cfg,path) ((conn) && is_in_path((path),\
74 (cfg)->mtime_static_list,(conn)->case_sensitive))
75 #define IS_ATIME_STATIC_PATH(conn,cfg,path) ((conn) && is_in_path((path),\
76 (cfg)->atime_static_list,(conn)->case_sensitive))
79 * Store some commonly evaluated parameters to avoid loadparm pain.
82 #define ONEFS_VFS_CONFIG_INITIALIZED 0x00010000
84 #define ONEFS_VFS_CONFIG_FAKETIMESTAMPS 0x00000001
86 struct onefs_vfs_config
90 /* data for fake timestamps */
95 /* Per-share list of files to fake the create time for. */
96 name_compare_entry *ctime_now_list;
98 /* Per-share list of files to fake the modification time for. */
99 name_compare_entry *mtime_now_list;
101 /* Per-share list of files to fake the access time for. */
102 name_compare_entry *atime_now_list;
104 /* Per-share list of files to fake the modification time for. */
105 name_compare_entry *mtime_static_list;
107 /* The access time will equal the create time. */
108 /* The modification time will equal the create time.*/
110 /* Per-share list of files to fake the access time for. */
111 name_compare_entry *atime_static_list;
115 * vfs interface handlers
117 SMB_STRUCT_DIR *onefs_opendir(struct vfs_handle_struct *handle,
118 const char *fname, const char *mask,
121 SMB_STRUCT_DIRENT *onefs_readdir(struct vfs_handle_struct *handle,
122 SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf);
124 void onefs_seekdir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp,
127 long onefs_telldir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
129 void onefs_rewinddir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp);
131 int onefs_closedir(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir);
133 void onefs_init_search_op(struct vfs_handle_struct *handle,
134 SMB_STRUCT_DIR *dirp);
136 NTSTATUS onefs_create_file(vfs_handle_struct *handle,
137 struct smb_request *req,
138 uint16_t root_dir_fid,
140 uint32_t create_file_flags,
141 uint32_t access_mask,
142 uint32_t share_access,
143 uint32_t create_disposition,
144 uint32_t create_options,
145 uint32_t file_attributes,
146 uint32_t oplock_request,
147 uint64_t allocation_size,
148 struct security_descriptor *sd,
149 struct ea_list *ea_list,
150 files_struct **result,
152 SMB_STRUCT_STAT *psbuf);
154 int onefs_close(vfs_handle_struct *handle, struct files_struct *fsp);
156 int onefs_rename(vfs_handle_struct *handle, const char *oldname,
157 const char *newname);
159 int onefs_stat(vfs_handle_struct *handle, const char *fname,
160 SMB_STRUCT_STAT *sbuf);
162 int onefs_fstat(vfs_handle_struct *handle, struct files_struct *fsp,
163 SMB_STRUCT_STAT *sbuf);
165 int onefs_lstat(vfs_handle_struct *handle, const char *path,
166 SMB_STRUCT_STAT *sbuf);
168 int onefs_unlink(vfs_handle_struct *handle, const char *path);
170 int onefs_chflags(vfs_handle_struct *handle, const char *path,
173 NTSTATUS onefs_streaminfo(vfs_handle_struct *handle,
174 struct files_struct *fsp,
177 unsigned int *num_streams,
178 struct stream_struct **streams);
180 int onefs_vtimes_streams(vfs_handle_struct *handle, const char *fname,
181 int flags, struct timespec times[3]);
183 NTSTATUS onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
184 uint32 security_info, SEC_DESC **ppdesc);
186 NTSTATUS onefs_get_nt_acl(vfs_handle_struct *handle, const char* name,
187 uint32 security_info, SEC_DESC **ppdesc);
189 NTSTATUS onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
190 uint32 security_info_sent, SEC_DESC *psd);
194 NTSTATUS onefs_samba_sd_to_sd(uint32 security_info_sent, SEC_DESC *psd,
195 struct ifs_security_descriptor *sd, int snum);
197 NTSTATUS onefs_split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname,
198 char **pbase, char **pstream);
200 bool onefs_get_config(int snum, int config_type,
201 struct onefs_vfs_config *cfg);
205 int onefs_sys_create_file(connection_struct *conn,
208 uint32_t access_mask,
209 uint32_t open_access_mask,
210 uint32_t share_access,
211 uint32_t create_options,
216 struct security_descriptor *sd,
218 int *granted_oplock);
222 #endif /* _ONEFS_H */