2 * Auditing VFS module for samba. Log selected file operations to syslog
5 * Copyright (C) Tim Potter, 1999-2000
6 * Copyright (C) Alexander Bokovoy, 2002
7 * Copyright (C) John H Terpstra, 2003
8 * Copyright (C) Stefan (metze) Metzmacher, 2003
9 * Copyright (C) Volker Lendecke, 2004
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <http://www.gnu.org/licenses/>.
26 * This module implements parseable logging for all Samba VFS operations.
28 * You use it as follows:
32 * vfs objects = full_audit
33 * full_audit:prefix = %u|%I
34 * full_audit:success = open opendir
35 * full_audit:failure = all
37 * vfs op can be "all" which means log all operations.
38 * vfs op can be "none" which means no logging.
40 * This leads to syslog entries of the form:
41 * smbd_audit: nobody|192.168.234.1|opendir|ok|.
42 * smbd_audit: nobody|192.168.234.1|open|fail (File not found)|r|x.txt
44 * where "nobody" is the connected username and "192.168.234.1" is the
45 * client's IP address.
49 * prefix: A macro expansion template prepended to the syslog entry.
51 * success: A list of VFS operations for which a successful completion should
52 * be logged. Defaults to no logging at all. The special operation "all" logs
53 * - you guessed it - everything.
55 * failure: A list of VFS operations for which failure to complete should be
56 * logged. Defaults to logging everything.
62 static int vfs_full_audit_debug_level
= DBGC_VFS
;
64 struct vfs_full_audit_private_data
{
65 struct bitmap
*success_ops
;
66 struct bitmap
*failure_ops
;
70 #define DBGC_CLASS vfs_full_audit_debug_level
72 /* Function prototypes */
74 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
75 const char *svc
, const char *user
);
76 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
);
77 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
79 bool small_query
, uint64_t *bsize
,
80 uint64_t *dfree
, uint64_t *dsize
);
81 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
82 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
84 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
85 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
87 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
88 struct files_struct
*fsp
,
89 SHADOW_COPY_DATA
*shadow_copy_data
, bool labels
);
90 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
92 struct vfs_statvfs_struct
*statbuf
);
93 static int smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
);
94 static SMB_STRUCT_DIR
*smb_full_audit_opendir(vfs_handle_struct
*handle
,
95 const char *fname
, const char *mask
, uint32 attr
);
96 static SMB_STRUCT_DIRENT
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
98 SMB_STRUCT_STAT
*sbuf
);
99 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
100 SMB_STRUCT_DIR
*dirp
, long offset
);
101 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
102 SMB_STRUCT_DIR
*dirp
);
103 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
104 SMB_STRUCT_DIR
*dirp
);
105 static int smb_full_audit_mkdir(vfs_handle_struct
*handle
,
106 const char *path
, mode_t mode
);
107 static int smb_full_audit_rmdir(vfs_handle_struct
*handle
,
109 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
110 SMB_STRUCT_DIR
*dirp
);
111 static void smb_full_audit_init_search_op(vfs_handle_struct
*handle
,
112 SMB_STRUCT_DIR
*dirp
);
113 static int smb_full_audit_open(vfs_handle_struct
*handle
,
114 const char *fname
, files_struct
*fsp
, int flags
, mode_t mode
);
115 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
116 struct smb_request
*req
,
117 uint16_t root_dir_fid
,
118 struct smb_filename
*smb_fname
,
119 uint32_t access_mask
,
120 uint32_t share_access
,
121 uint32_t create_disposition
,
122 uint32_t create_options
,
123 uint32_t file_attributes
,
124 uint32_t oplock_request
,
125 uint64_t allocation_size
,
126 struct security_descriptor
*sd
,
127 struct ea_list
*ea_list
,
128 files_struct
**result
,
130 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
);
131 static ssize_t
smb_full_audit_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
132 void *data
, size_t n
);
133 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
134 void *data
, size_t n
, SMB_OFF_T offset
);
135 static ssize_t
smb_full_audit_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
136 const void *data
, size_t n
);
137 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
138 const void *data
, size_t n
,
140 static SMB_OFF_T
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
141 SMB_OFF_T offset
, int whence
);
142 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
143 files_struct
*fromfsp
,
144 const DATA_BLOB
*hdr
, SMB_OFF_T offset
,
146 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
150 static int smb_full_audit_rename(vfs_handle_struct
*handle
,
151 const char *oldname
, const char *newname
);
152 static int smb_full_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
);
153 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
154 const char *fname
, SMB_STRUCT_STAT
*sbuf
);
155 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
156 SMB_STRUCT_STAT
*sbuf
);
157 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
158 const char *path
, SMB_STRUCT_STAT
*sbuf
);
159 static int smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
160 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
);
161 static int smb_full_audit_unlink(vfs_handle_struct
*handle
,
163 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
164 const char *path
, mode_t mode
);
165 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
167 static int smb_full_audit_chown(vfs_handle_struct
*handle
,
168 const char *path
, uid_t uid
, gid_t gid
);
169 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
170 uid_t uid
, gid_t gid
);
171 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
172 const char *path
, uid_t uid
, gid_t gid
);
173 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
175 static char *smb_full_audit_getwd(vfs_handle_struct
*handle
,
177 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
178 const char *path
, struct smb_file_time
*ft
);
179 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
181 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
182 int op
, SMB_OFF_T offset
, SMB_OFF_T count
, int type
);
183 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
184 struct files_struct
*fsp
,
186 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
188 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
189 SMB_OFF_T
*poffset
, SMB_OFF_T
*pcount
, int *ptype
, pid_t
*ppid
);
190 static int smb_full_audit_symlink(vfs_handle_struct
*handle
,
191 const char *oldpath
, const char *newpath
);
192 static int smb_full_audit_readlink(vfs_handle_struct
*handle
,
193 const char *path
, char *buf
, size_t bufsiz
);
194 static int smb_full_audit_link(vfs_handle_struct
*handle
,
195 const char *oldpath
, const char *newpath
);
196 static int smb_full_audit_mknod(vfs_handle_struct
*handle
,
197 const char *pathname
, mode_t mode
, SMB_DEV_T dev
);
198 static char *smb_full_audit_realpath(vfs_handle_struct
*handle
,
199 const char *path
, char *resolved_path
);
200 static NTSTATUS
smb_full_audit_notify_watch(struct vfs_handle_struct
*handle
,
201 struct sys_notify_context
*ctx
,
202 struct notify_entry
*e
,
203 void (*callback
)(struct sys_notify_context
*ctx
,
205 struct notify_event
*ev
),
206 void *private_data
, void *handle_p
);
207 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
208 const char *path
, unsigned int flags
);
209 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
210 const SMB_STRUCT_STAT
*sbuf
);
211 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
212 struct files_struct
*fsp
,
215 unsigned int *pnum_streams
,
216 struct stream_struct
**pstreams
);
217 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
222 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
224 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
225 struct byte_range_lock
*br_lck
,
226 struct lock_struct
*plock
,
228 struct blocking_lock_record
*blr
);
229 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
230 struct messaging_context
*msg_ctx
,
231 struct byte_range_lock
*br_lck
,
232 const struct lock_struct
*plock
);
233 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
234 struct byte_range_lock
*br_lck
,
235 struct lock_struct
*plock
,
236 struct blocking_lock_record
*blr
);
237 static bool smb_full_audit_strict_lock(struct vfs_handle_struct
*handle
,
238 struct files_struct
*fsp
,
239 struct lock_struct
*plock
);
240 static void smb_full_audit_strict_unlock(struct vfs_handle_struct
*handle
,
241 struct files_struct
*fsp
,
242 struct lock_struct
*plock
);
243 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
244 uint32 security_info
,
246 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
247 const char *name
, uint32 security_info
,
249 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
250 uint32 security_info_sent
,
251 const SEC_DESC
*psd
);
252 static int smb_full_audit_chmod_acl(vfs_handle_struct
*handle
,
253 const char *path
, mode_t mode
);
254 static int smb_full_audit_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
256 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct
*handle
,
257 SMB_ACL_T theacl
, int entry_id
,
258 SMB_ACL_ENTRY_T
*entry_p
);
259 static int smb_full_audit_sys_acl_get_tag_type(vfs_handle_struct
*handle
,
260 SMB_ACL_ENTRY_T entry_d
,
261 SMB_ACL_TAG_T
*tag_type_p
);
262 static int smb_full_audit_sys_acl_get_permset(vfs_handle_struct
*handle
,
263 SMB_ACL_ENTRY_T entry_d
,
264 SMB_ACL_PERMSET_T
*permset_p
);
265 static void * smb_full_audit_sys_acl_get_qualifier(vfs_handle_struct
*handle
,
266 SMB_ACL_ENTRY_T entry_d
);
267 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
269 SMB_ACL_TYPE_T type
);
270 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
272 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct
*handle
,
273 SMB_ACL_PERMSET_T permset
);
274 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct
*handle
,
275 SMB_ACL_PERMSET_T permset
,
276 SMB_ACL_PERM_T perm
);
277 static char * smb_full_audit_sys_acl_to_text(vfs_handle_struct
*handle
,
280 static SMB_ACL_T
smb_full_audit_sys_acl_init(vfs_handle_struct
*handle
,
282 static int smb_full_audit_sys_acl_create_entry(vfs_handle_struct
*handle
,
284 SMB_ACL_ENTRY_T
*pentry
);
285 static int smb_full_audit_sys_acl_set_tag_type(vfs_handle_struct
*handle
,
286 SMB_ACL_ENTRY_T entry
,
287 SMB_ACL_TAG_T tagtype
);
288 static int smb_full_audit_sys_acl_set_qualifier(vfs_handle_struct
*handle
,
289 SMB_ACL_ENTRY_T entry
,
291 static int smb_full_audit_sys_acl_set_permset(vfs_handle_struct
*handle
,
292 SMB_ACL_ENTRY_T entry
,
293 SMB_ACL_PERMSET_T permset
);
294 static int smb_full_audit_sys_acl_valid(vfs_handle_struct
*handle
,
296 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
297 const char *name
, SMB_ACL_TYPE_T acltype
,
299 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
301 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
303 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct
*handle
,
304 SMB_ACL_PERMSET_T permset
,
305 SMB_ACL_PERM_T perm
);
306 static int smb_full_audit_sys_acl_free_text(vfs_handle_struct
*handle
,
308 static int smb_full_audit_sys_acl_free_acl(vfs_handle_struct
*handle
,
309 SMB_ACL_T posix_acl
);
310 static int smb_full_audit_sys_acl_free_qualifier(vfs_handle_struct
*handle
,
312 SMB_ACL_TAG_T tagtype
);
313 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
315 const char *name
, void *value
, size_t size
);
316 static ssize_t
smb_full_audit_lgetxattr(struct vfs_handle_struct
*handle
,
317 const char *path
, const char *name
,
318 void *value
, size_t size
);
319 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
320 struct files_struct
*fsp
,
321 const char *name
, void *value
, size_t size
);
322 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
323 const char *path
, char *list
, size_t size
);
324 static ssize_t
smb_full_audit_llistxattr(struct vfs_handle_struct
*handle
,
325 const char *path
, char *list
, size_t size
);
326 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
327 struct files_struct
*fsp
, char *list
,
329 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
332 static int smb_full_audit_lremovexattr(struct vfs_handle_struct
*handle
,
335 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
336 struct files_struct
*fsp
,
338 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
340 const char *name
, const void *value
, size_t size
,
342 static int smb_full_audit_lsetxattr(struct vfs_handle_struct
*handle
,
344 const char *name
, const void *value
, size_t size
,
346 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
347 struct files_struct
*fsp
, const char *name
,
348 const void *value
, size_t size
, int flags
);
350 static int smb_full_audit_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
);
351 static int smb_full_audit_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
);
352 static ssize_t
smb_full_audit_aio_return(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
);
353 static int smb_full_audit_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
);
354 static int smb_full_audit_aio_error(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
);
355 static int smb_full_audit_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
);
356 static int smb_full_audit_aio_suspend(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const SMB_STRUCT_AIOCB
* const aiocb
[], int n
, const struct timespec
*ts
);
357 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
358 struct files_struct
*fsp
);
362 static vfs_op_tuple audit_op_tuples
[] = {
364 /* Disk operations */
366 {SMB_VFS_OP(smb_full_audit_connect
), SMB_VFS_OP_CONNECT
,
367 SMB_VFS_LAYER_LOGGER
},
368 {SMB_VFS_OP(smb_full_audit_disconnect
), SMB_VFS_OP_DISCONNECT
,
369 SMB_VFS_LAYER_LOGGER
},
370 {SMB_VFS_OP(smb_full_audit_disk_free
), SMB_VFS_OP_DISK_FREE
,
371 SMB_VFS_LAYER_LOGGER
},
372 {SMB_VFS_OP(smb_full_audit_get_quota
), SMB_VFS_OP_GET_QUOTA
,
373 SMB_VFS_LAYER_LOGGER
},
374 {SMB_VFS_OP(smb_full_audit_set_quota
), SMB_VFS_OP_SET_QUOTA
,
375 SMB_VFS_LAYER_LOGGER
},
376 {SMB_VFS_OP(smb_full_audit_get_shadow_copy_data
), SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
377 SMB_VFS_LAYER_LOGGER
},
378 {SMB_VFS_OP(smb_full_audit_statvfs
), SMB_VFS_OP_STATVFS
,
379 SMB_VFS_LAYER_LOGGER
},
380 {SMB_VFS_OP(smb_full_audit_fs_capabilities
), SMB_VFS_OP_FS_CAPABILITIES
,
381 SMB_VFS_LAYER_LOGGER
},
383 /* Directory operations */
385 {SMB_VFS_OP(smb_full_audit_opendir
), SMB_VFS_OP_OPENDIR
,
386 SMB_VFS_LAYER_LOGGER
},
387 {SMB_VFS_OP(smb_full_audit_readdir
), SMB_VFS_OP_READDIR
,
388 SMB_VFS_LAYER_LOGGER
},
389 {SMB_VFS_OP(smb_full_audit_seekdir
), SMB_VFS_OP_SEEKDIR
,
390 SMB_VFS_LAYER_LOGGER
},
391 {SMB_VFS_OP(smb_full_audit_telldir
), SMB_VFS_OP_TELLDIR
,
392 SMB_VFS_LAYER_LOGGER
},
393 {SMB_VFS_OP(smb_full_audit_rewinddir
), SMB_VFS_OP_REWINDDIR
,
394 SMB_VFS_LAYER_LOGGER
},
395 {SMB_VFS_OP(smb_full_audit_mkdir
), SMB_VFS_OP_MKDIR
,
396 SMB_VFS_LAYER_LOGGER
},
397 {SMB_VFS_OP(smb_full_audit_rmdir
), SMB_VFS_OP_RMDIR
,
398 SMB_VFS_LAYER_LOGGER
},
399 {SMB_VFS_OP(smb_full_audit_closedir
), SMB_VFS_OP_CLOSEDIR
,
400 SMB_VFS_LAYER_LOGGER
},
401 {SMB_VFS_OP(smb_full_audit_init_search_op
), SMB_VFS_OP_INIT_SEARCH_OP
,
402 SMB_VFS_LAYER_LOGGER
},
404 /* File operations */
406 {SMB_VFS_OP(smb_full_audit_open
), SMB_VFS_OP_OPEN
,
407 SMB_VFS_LAYER_LOGGER
},
408 {SMB_VFS_OP(smb_full_audit_create_file
),SMB_VFS_OP_CREATE_FILE
,
409 SMB_VFS_LAYER_LOGGER
},
410 {SMB_VFS_OP(smb_full_audit_close
), SMB_VFS_OP_CLOSE
,
411 SMB_VFS_LAYER_LOGGER
},
412 {SMB_VFS_OP(smb_full_audit_read
), SMB_VFS_OP_READ
,
413 SMB_VFS_LAYER_LOGGER
},
414 {SMB_VFS_OP(smb_full_audit_pread
), SMB_VFS_OP_PREAD
,
415 SMB_VFS_LAYER_LOGGER
},
416 {SMB_VFS_OP(smb_full_audit_write
), SMB_VFS_OP_WRITE
,
417 SMB_VFS_LAYER_LOGGER
},
418 {SMB_VFS_OP(smb_full_audit_pwrite
), SMB_VFS_OP_PWRITE
,
419 SMB_VFS_LAYER_LOGGER
},
420 {SMB_VFS_OP(smb_full_audit_lseek
), SMB_VFS_OP_LSEEK
,
421 SMB_VFS_LAYER_LOGGER
},
422 {SMB_VFS_OP(smb_full_audit_sendfile
), SMB_VFS_OP_SENDFILE
,
423 SMB_VFS_LAYER_LOGGER
},
424 {SMB_VFS_OP(smb_full_audit_recvfile
), SMB_VFS_OP_RECVFILE
,
425 SMB_VFS_LAYER_LOGGER
},
426 {SMB_VFS_OP(smb_full_audit_rename
), SMB_VFS_OP_RENAME
,
427 SMB_VFS_LAYER_LOGGER
},
428 {SMB_VFS_OP(smb_full_audit_fsync
), SMB_VFS_OP_FSYNC
,
429 SMB_VFS_LAYER_LOGGER
},
430 {SMB_VFS_OP(smb_full_audit_stat
), SMB_VFS_OP_STAT
,
431 SMB_VFS_LAYER_LOGGER
},
432 {SMB_VFS_OP(smb_full_audit_fstat
), SMB_VFS_OP_FSTAT
,
433 SMB_VFS_LAYER_LOGGER
},
434 {SMB_VFS_OP(smb_full_audit_lstat
), SMB_VFS_OP_LSTAT
,
435 SMB_VFS_LAYER_LOGGER
},
436 {SMB_VFS_OP(smb_full_audit_get_alloc_size
), SMB_VFS_OP_GET_ALLOC_SIZE
,
437 SMB_VFS_LAYER_LOGGER
},
438 {SMB_VFS_OP(smb_full_audit_unlink
), SMB_VFS_OP_UNLINK
,
439 SMB_VFS_LAYER_LOGGER
},
440 {SMB_VFS_OP(smb_full_audit_chmod
), SMB_VFS_OP_CHMOD
,
441 SMB_VFS_LAYER_LOGGER
},
442 {SMB_VFS_OP(smb_full_audit_fchmod
), SMB_VFS_OP_FCHMOD
,
443 SMB_VFS_LAYER_LOGGER
},
444 {SMB_VFS_OP(smb_full_audit_chown
), SMB_VFS_OP_CHOWN
,
445 SMB_VFS_LAYER_LOGGER
},
446 {SMB_VFS_OP(smb_full_audit_fchown
), SMB_VFS_OP_FCHOWN
,
447 SMB_VFS_LAYER_LOGGER
},
448 {SMB_VFS_OP(smb_full_audit_lchown
), SMB_VFS_OP_LCHOWN
,
449 SMB_VFS_LAYER_LOGGER
},
450 {SMB_VFS_OP(smb_full_audit_chdir
), SMB_VFS_OP_CHDIR
,
451 SMB_VFS_LAYER_LOGGER
},
452 {SMB_VFS_OP(smb_full_audit_getwd
), SMB_VFS_OP_GETWD
,
453 SMB_VFS_LAYER_LOGGER
},
454 {SMB_VFS_OP(smb_full_audit_ntimes
), SMB_VFS_OP_NTIMES
,
455 SMB_VFS_LAYER_LOGGER
},
456 {SMB_VFS_OP(smb_full_audit_ftruncate
), SMB_VFS_OP_FTRUNCATE
,
457 SMB_VFS_LAYER_LOGGER
},
458 {SMB_VFS_OP(smb_full_audit_lock
), SMB_VFS_OP_LOCK
,
459 SMB_VFS_LAYER_LOGGER
},
460 {SMB_VFS_OP(smb_full_audit_kernel_flock
), SMB_VFS_OP_KERNEL_FLOCK
,
461 SMB_VFS_LAYER_LOGGER
},
462 {SMB_VFS_OP(smb_full_audit_linux_setlease
), SMB_VFS_OP_LINUX_SETLEASE
,
463 SMB_VFS_LAYER_LOGGER
},
464 {SMB_VFS_OP(smb_full_audit_getlock
), SMB_VFS_OP_GETLOCK
,
465 SMB_VFS_LAYER_LOGGER
},
466 {SMB_VFS_OP(smb_full_audit_symlink
), SMB_VFS_OP_SYMLINK
,
467 SMB_VFS_LAYER_LOGGER
},
468 {SMB_VFS_OP(smb_full_audit_readlink
), SMB_VFS_OP_READLINK
,
469 SMB_VFS_LAYER_LOGGER
},
470 {SMB_VFS_OP(smb_full_audit_link
), SMB_VFS_OP_LINK
,
471 SMB_VFS_LAYER_LOGGER
},
472 {SMB_VFS_OP(smb_full_audit_mknod
), SMB_VFS_OP_MKNOD
,
473 SMB_VFS_LAYER_LOGGER
},
474 {SMB_VFS_OP(smb_full_audit_realpath
), SMB_VFS_OP_REALPATH
,
475 SMB_VFS_LAYER_LOGGER
},
476 {SMB_VFS_OP(smb_full_audit_notify_watch
),SMB_VFS_OP_NOTIFY_WATCH
,
477 SMB_VFS_LAYER_LOGGER
},
478 {SMB_VFS_OP(smb_full_audit_chflags
), SMB_VFS_OP_CHFLAGS
,
479 SMB_VFS_LAYER_LOGGER
},
480 {SMB_VFS_OP(smb_full_audit_file_id_create
), SMB_VFS_OP_FILE_ID_CREATE
,
481 SMB_VFS_LAYER_LOGGER
},
482 {SMB_VFS_OP(smb_full_audit_streaminfo
), SMB_VFS_OP_STREAMINFO
,
483 SMB_VFS_LAYER_LOGGER
},
484 {SMB_VFS_OP(smb_full_audit_get_real_filename
), SMB_VFS_OP_GET_REAL_FILENAME
,
485 SMB_VFS_LAYER_LOGGER
},
486 {SMB_VFS_OP(smb_full_audit_connectpath
), SMB_VFS_OP_CONNECTPATH
,
487 SMB_VFS_LAYER_LOGGER
},
488 {SMB_VFS_OP(smb_full_audit_brl_lock_windows
), SMB_VFS_OP_BRL_LOCK_WINDOWS
,
489 SMB_VFS_LAYER_LOGGER
},
490 {SMB_VFS_OP(smb_full_audit_brl_unlock_windows
), SMB_VFS_OP_BRL_UNLOCK_WINDOWS
,
491 SMB_VFS_LAYER_LOGGER
},
492 {SMB_VFS_OP(smb_full_audit_brl_cancel_windows
), SMB_VFS_OP_BRL_CANCEL_WINDOWS
,
493 SMB_VFS_LAYER_LOGGER
},
494 {SMB_VFS_OP(smb_full_audit_strict_lock
), SMB_VFS_OP_STRICT_LOCK
,
495 SMB_VFS_LAYER_LOGGER
},
496 {SMB_VFS_OP(smb_full_audit_strict_unlock
), SMB_VFS_OP_STRICT_UNLOCK
,
497 SMB_VFS_LAYER_LOGGER
},
499 /* NT ACL operations. */
501 {SMB_VFS_OP(smb_full_audit_fget_nt_acl
), SMB_VFS_OP_FGET_NT_ACL
,
502 SMB_VFS_LAYER_LOGGER
},
503 {SMB_VFS_OP(smb_full_audit_get_nt_acl
), SMB_VFS_OP_GET_NT_ACL
,
504 SMB_VFS_LAYER_LOGGER
},
505 {SMB_VFS_OP(smb_full_audit_fset_nt_acl
), SMB_VFS_OP_FSET_NT_ACL
,
506 SMB_VFS_LAYER_LOGGER
},
508 /* POSIX ACL operations. */
510 {SMB_VFS_OP(smb_full_audit_chmod_acl
), SMB_VFS_OP_CHMOD_ACL
,
511 SMB_VFS_LAYER_LOGGER
},
512 {SMB_VFS_OP(smb_full_audit_fchmod_acl
), SMB_VFS_OP_FCHMOD_ACL
,
513 SMB_VFS_LAYER_LOGGER
},
514 {SMB_VFS_OP(smb_full_audit_sys_acl_get_entry
), SMB_VFS_OP_SYS_ACL_GET_ENTRY
,
515 SMB_VFS_LAYER_LOGGER
},
516 {SMB_VFS_OP(smb_full_audit_sys_acl_get_tag_type
), SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
,
517 SMB_VFS_LAYER_LOGGER
},
518 {SMB_VFS_OP(smb_full_audit_sys_acl_get_permset
), SMB_VFS_OP_SYS_ACL_GET_PERMSET
,
519 SMB_VFS_LAYER_LOGGER
},
520 {SMB_VFS_OP(smb_full_audit_sys_acl_get_qualifier
), SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
,
521 SMB_VFS_LAYER_LOGGER
},
522 {SMB_VFS_OP(smb_full_audit_sys_acl_get_file
), SMB_VFS_OP_SYS_ACL_GET_FILE
,
523 SMB_VFS_LAYER_LOGGER
},
524 {SMB_VFS_OP(smb_full_audit_sys_acl_get_fd
), SMB_VFS_OP_SYS_ACL_GET_FD
,
525 SMB_VFS_LAYER_LOGGER
},
526 {SMB_VFS_OP(smb_full_audit_sys_acl_clear_perms
), SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
,
527 SMB_VFS_LAYER_LOGGER
},
528 {SMB_VFS_OP(smb_full_audit_sys_acl_add_perm
), SMB_VFS_OP_SYS_ACL_ADD_PERM
,
529 SMB_VFS_LAYER_LOGGER
},
530 {SMB_VFS_OP(smb_full_audit_sys_acl_to_text
), SMB_VFS_OP_SYS_ACL_TO_TEXT
,
531 SMB_VFS_LAYER_LOGGER
},
532 {SMB_VFS_OP(smb_full_audit_sys_acl_init
), SMB_VFS_OP_SYS_ACL_INIT
,
533 SMB_VFS_LAYER_LOGGER
},
534 {SMB_VFS_OP(smb_full_audit_sys_acl_create_entry
), SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
,
535 SMB_VFS_LAYER_LOGGER
},
536 {SMB_VFS_OP(smb_full_audit_sys_acl_set_tag_type
), SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
,
537 SMB_VFS_LAYER_LOGGER
},
538 {SMB_VFS_OP(smb_full_audit_sys_acl_set_qualifier
), SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
,
539 SMB_VFS_LAYER_LOGGER
},
540 {SMB_VFS_OP(smb_full_audit_sys_acl_set_permset
), SMB_VFS_OP_SYS_ACL_SET_PERMSET
,
541 SMB_VFS_LAYER_LOGGER
},
542 {SMB_VFS_OP(smb_full_audit_sys_acl_valid
), SMB_VFS_OP_SYS_ACL_VALID
,
543 SMB_VFS_LAYER_LOGGER
},
544 {SMB_VFS_OP(smb_full_audit_sys_acl_set_file
), SMB_VFS_OP_SYS_ACL_SET_FILE
,
545 SMB_VFS_LAYER_LOGGER
},
546 {SMB_VFS_OP(smb_full_audit_sys_acl_set_fd
), SMB_VFS_OP_SYS_ACL_SET_FD
,
547 SMB_VFS_LAYER_LOGGER
},
548 {SMB_VFS_OP(smb_full_audit_sys_acl_delete_def_file
), SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
549 SMB_VFS_LAYER_LOGGER
},
550 {SMB_VFS_OP(smb_full_audit_sys_acl_get_perm
), SMB_VFS_OP_SYS_ACL_GET_PERM
,
551 SMB_VFS_LAYER_LOGGER
},
552 {SMB_VFS_OP(smb_full_audit_sys_acl_free_text
), SMB_VFS_OP_SYS_ACL_FREE_TEXT
,
553 SMB_VFS_LAYER_LOGGER
},
554 {SMB_VFS_OP(smb_full_audit_sys_acl_free_acl
), SMB_VFS_OP_SYS_ACL_FREE_ACL
,
555 SMB_VFS_LAYER_LOGGER
},
556 {SMB_VFS_OP(smb_full_audit_sys_acl_free_qualifier
), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
,
557 SMB_VFS_LAYER_LOGGER
},
561 {SMB_VFS_OP(smb_full_audit_getxattr
), SMB_VFS_OP_GETXATTR
,
562 SMB_VFS_LAYER_LOGGER
},
563 {SMB_VFS_OP(smb_full_audit_lgetxattr
), SMB_VFS_OP_LGETXATTR
,
564 SMB_VFS_LAYER_LOGGER
},
565 {SMB_VFS_OP(smb_full_audit_fgetxattr
), SMB_VFS_OP_FGETXATTR
,
566 SMB_VFS_LAYER_LOGGER
},
567 {SMB_VFS_OP(smb_full_audit_listxattr
), SMB_VFS_OP_LISTXATTR
,
568 SMB_VFS_LAYER_LOGGER
},
569 {SMB_VFS_OP(smb_full_audit_llistxattr
), SMB_VFS_OP_LLISTXATTR
,
570 SMB_VFS_LAYER_LOGGER
},
571 {SMB_VFS_OP(smb_full_audit_flistxattr
), SMB_VFS_OP_FLISTXATTR
,
572 SMB_VFS_LAYER_LOGGER
},
573 {SMB_VFS_OP(smb_full_audit_removexattr
), SMB_VFS_OP_REMOVEXATTR
,
574 SMB_VFS_LAYER_LOGGER
},
575 {SMB_VFS_OP(smb_full_audit_lremovexattr
), SMB_VFS_OP_LREMOVEXATTR
,
576 SMB_VFS_LAYER_LOGGER
},
577 {SMB_VFS_OP(smb_full_audit_fremovexattr
), SMB_VFS_OP_FREMOVEXATTR
,
578 SMB_VFS_LAYER_LOGGER
},
579 {SMB_VFS_OP(smb_full_audit_setxattr
), SMB_VFS_OP_SETXATTR
,
580 SMB_VFS_LAYER_LOGGER
},
581 {SMB_VFS_OP(smb_full_audit_lsetxattr
), SMB_VFS_OP_LSETXATTR
,
582 SMB_VFS_LAYER_LOGGER
},
583 {SMB_VFS_OP(smb_full_audit_fsetxattr
), SMB_VFS_OP_FSETXATTR
,
584 SMB_VFS_LAYER_LOGGER
},
586 {SMB_VFS_OP(smb_full_audit_aio_read
), SMB_VFS_OP_AIO_READ
,
587 SMB_VFS_LAYER_LOGGER
},
588 {SMB_VFS_OP(smb_full_audit_aio_write
), SMB_VFS_OP_AIO_WRITE
,
589 SMB_VFS_LAYER_LOGGER
},
590 {SMB_VFS_OP(smb_full_audit_aio_return
), SMB_VFS_OP_AIO_RETURN
,
591 SMB_VFS_LAYER_LOGGER
},
592 {SMB_VFS_OP(smb_full_audit_aio_cancel
), SMB_VFS_OP_AIO_CANCEL
,
593 SMB_VFS_LAYER_LOGGER
},
594 {SMB_VFS_OP(smb_full_audit_aio_error
), SMB_VFS_OP_AIO_ERROR
,
595 SMB_VFS_LAYER_LOGGER
},
596 {SMB_VFS_OP(smb_full_audit_aio_fsync
), SMB_VFS_OP_AIO_FSYNC
,
597 SMB_VFS_LAYER_LOGGER
},
598 {SMB_VFS_OP(smb_full_audit_aio_suspend
),SMB_VFS_OP_AIO_SUSPEND
,
599 SMB_VFS_LAYER_LOGGER
},
600 {SMB_VFS_OP(smb_full_audit_aio_force
),SMB_VFS_OP_AIO_FORCE
,
601 SMB_VFS_LAYER_LOGGER
},
603 /* Finish VFS operations definition */
605 {SMB_VFS_OP(NULL
), SMB_VFS_OP_NOOP
,
609 /* The following array *must* be in the same order as defined in vfs.h */
615 { SMB_VFS_OP_CONNECT
, "connect" },
616 { SMB_VFS_OP_DISCONNECT
, "disconnect" },
617 { SMB_VFS_OP_DISK_FREE
, "disk_free" },
618 { SMB_VFS_OP_GET_QUOTA
, "get_quota" },
619 { SMB_VFS_OP_SET_QUOTA
, "set_quota" },
620 { SMB_VFS_OP_GET_SHADOW_COPY_DATA
, "get_shadow_copy_data" },
621 { SMB_VFS_OP_STATVFS
, "statvfs" },
622 { SMB_VFS_OP_FS_CAPABILITIES
, "fs_capabilities" },
623 { SMB_VFS_OP_OPENDIR
, "opendir" },
624 { SMB_VFS_OP_READDIR
, "readdir" },
625 { SMB_VFS_OP_SEEKDIR
, "seekdir" },
626 { SMB_VFS_OP_TELLDIR
, "telldir" },
627 { SMB_VFS_OP_REWINDDIR
, "rewinddir" },
628 { SMB_VFS_OP_MKDIR
, "mkdir" },
629 { SMB_VFS_OP_RMDIR
, "rmdir" },
630 { SMB_VFS_OP_CLOSEDIR
, "closedir" },
631 { SMB_VFS_OP_INIT_SEARCH_OP
, "init_search_op" },
632 { SMB_VFS_OP_OPEN
, "open" },
633 { SMB_VFS_OP_CREATE_FILE
, "create_file" },
634 { SMB_VFS_OP_CLOSE
, "close" },
635 { SMB_VFS_OP_READ
, "read" },
636 { SMB_VFS_OP_PREAD
, "pread" },
637 { SMB_VFS_OP_WRITE
, "write" },
638 { SMB_VFS_OP_PWRITE
, "pwrite" },
639 { SMB_VFS_OP_LSEEK
, "lseek" },
640 { SMB_VFS_OP_SENDFILE
, "sendfile" },
641 { SMB_VFS_OP_RECVFILE
, "recvfile" },
642 { SMB_VFS_OP_RENAME
, "rename" },
643 { SMB_VFS_OP_FSYNC
, "fsync" },
644 { SMB_VFS_OP_STAT
, "stat" },
645 { SMB_VFS_OP_FSTAT
, "fstat" },
646 { SMB_VFS_OP_LSTAT
, "lstat" },
647 { SMB_VFS_OP_GET_ALLOC_SIZE
, "get_alloc_size" },
648 { SMB_VFS_OP_UNLINK
, "unlink" },
649 { SMB_VFS_OP_CHMOD
, "chmod" },
650 { SMB_VFS_OP_FCHMOD
, "fchmod" },
651 { SMB_VFS_OP_CHOWN
, "chown" },
652 { SMB_VFS_OP_FCHOWN
, "fchown" },
653 { SMB_VFS_OP_LCHOWN
, "lchown" },
654 { SMB_VFS_OP_CHDIR
, "chdir" },
655 { SMB_VFS_OP_GETWD
, "getwd" },
656 { SMB_VFS_OP_NTIMES
, "ntimes" },
657 { SMB_VFS_OP_FTRUNCATE
, "ftruncate" },
658 { SMB_VFS_OP_LOCK
, "lock" },
659 { SMB_VFS_OP_KERNEL_FLOCK
, "kernel_flock" },
660 { SMB_VFS_OP_LINUX_SETLEASE
, "linux_setlease" },
661 { SMB_VFS_OP_GETLOCK
, "getlock" },
662 { SMB_VFS_OP_SYMLINK
, "symlink" },
663 { SMB_VFS_OP_READLINK
, "readlink" },
664 { SMB_VFS_OP_LINK
, "link" },
665 { SMB_VFS_OP_MKNOD
, "mknod" },
666 { SMB_VFS_OP_REALPATH
, "realpath" },
667 { SMB_VFS_OP_NOTIFY_WATCH
, "notify_watch" },
668 { SMB_VFS_OP_CHFLAGS
, "chflags" },
669 { SMB_VFS_OP_FILE_ID_CREATE
, "file_id_create" },
670 { SMB_VFS_OP_STREAMINFO
, "streaminfo" },
671 { SMB_VFS_OP_GET_REAL_FILENAME
, "get_real_filename" },
672 { SMB_VFS_OP_CONNECTPATH
, "connectpath" },
673 { SMB_VFS_OP_BRL_LOCK_WINDOWS
, "brl_lock_windows" },
674 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, "brl_unlock_windows" },
675 { SMB_VFS_OP_BRL_CANCEL_WINDOWS
, "brl_cancel_windows" },
676 { SMB_VFS_OP_STRICT_LOCK
, "strict_lock" },
677 { SMB_VFS_OP_STRICT_UNLOCK
, "strict_unlock" },
678 { SMB_VFS_OP_FGET_NT_ACL
, "fget_nt_acl" },
679 { SMB_VFS_OP_GET_NT_ACL
, "get_nt_acl" },
680 { SMB_VFS_OP_FSET_NT_ACL
, "fset_nt_acl" },
681 { SMB_VFS_OP_CHMOD_ACL
, "chmod_acl" },
682 { SMB_VFS_OP_FCHMOD_ACL
, "fchmod_acl" },
683 { SMB_VFS_OP_SYS_ACL_GET_ENTRY
, "sys_acl_get_entry" },
684 { SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, "sys_acl_get_tag_type" },
685 { SMB_VFS_OP_SYS_ACL_GET_PERMSET
, "sys_acl_get_permset" },
686 { SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, "sys_acl_get_qualifier" },
687 { SMB_VFS_OP_SYS_ACL_GET_FILE
, "sys_acl_get_file" },
688 { SMB_VFS_OP_SYS_ACL_GET_FD
, "sys_acl_get_fd" },
689 { SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, "sys_acl_clear_perms" },
690 { SMB_VFS_OP_SYS_ACL_ADD_PERM
, "sys_acl_add_perm" },
691 { SMB_VFS_OP_SYS_ACL_TO_TEXT
, "sys_acl_to_text" },
692 { SMB_VFS_OP_SYS_ACL_INIT
, "sys_acl_init" },
693 { SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, "sys_acl_create_entry" },
694 { SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, "sys_acl_set_tag_type" },
695 { SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, "sys_acl_set_qualifier" },
696 { SMB_VFS_OP_SYS_ACL_SET_PERMSET
, "sys_acl_set_permset" },
697 { SMB_VFS_OP_SYS_ACL_VALID
, "sys_acl_valid" },
698 { SMB_VFS_OP_SYS_ACL_SET_FILE
, "sys_acl_set_file" },
699 { SMB_VFS_OP_SYS_ACL_SET_FD
, "sys_acl_set_fd" },
700 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, "sys_acl_delete_def_file" },
701 { SMB_VFS_OP_SYS_ACL_GET_PERM
, "sys_acl_get_perm" },
702 { SMB_VFS_OP_SYS_ACL_FREE_TEXT
, "sys_acl_free_text" },
703 { SMB_VFS_OP_SYS_ACL_FREE_ACL
, "sys_acl_free_acl" },
704 { SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, "sys_acl_free_qualifier" },
705 { SMB_VFS_OP_GETXATTR
, "getxattr" },
706 { SMB_VFS_OP_LGETXATTR
, "lgetxattr" },
707 { SMB_VFS_OP_FGETXATTR
, "fgetxattr" },
708 { SMB_VFS_OP_LISTXATTR
, "listxattr" },
709 { SMB_VFS_OP_LLISTXATTR
, "llistxattr" },
710 { SMB_VFS_OP_FLISTXATTR
, "flistxattr" },
711 { SMB_VFS_OP_REMOVEXATTR
, "removexattr" },
712 { SMB_VFS_OP_LREMOVEXATTR
, "lremovexattr" },
713 { SMB_VFS_OP_FREMOVEXATTR
, "fremovexattr" },
714 { SMB_VFS_OP_SETXATTR
, "setxattr" },
715 { SMB_VFS_OP_LSETXATTR
, "lsetxattr" },
716 { SMB_VFS_OP_FSETXATTR
, "fsetxattr" },
717 { SMB_VFS_OP_AIO_READ
, "aio_read" },
718 { SMB_VFS_OP_AIO_WRITE
, "aio_write" },
719 { SMB_VFS_OP_AIO_RETURN
,"aio_return" },
720 { SMB_VFS_OP_AIO_CANCEL
,"aio_cancel" },
721 { SMB_VFS_OP_AIO_ERROR
, "aio_error" },
722 { SMB_VFS_OP_AIO_FSYNC
, "aio_fsync" },
723 { SMB_VFS_OP_AIO_SUSPEND
,"aio_suspend" },
724 { SMB_VFS_OP_AIO_FORCE
, "aio_force" },
725 { SMB_VFS_OP_IS_OFFLINE
, "aio_is_offline" },
726 { SMB_VFS_OP_SET_OFFLINE
, "aio_set_offline" },
727 { SMB_VFS_OP_LAST
, NULL
}
730 static int audit_syslog_facility(vfs_handle_struct
*handle
)
732 static const struct enum_list enum_log_facilities
[] = {
733 { LOG_USER
, "USER" },
734 { LOG_LOCAL0
, "LOCAL0" },
735 { LOG_LOCAL1
, "LOCAL1" },
736 { LOG_LOCAL2
, "LOCAL2" },
737 { LOG_LOCAL3
, "LOCAL3" },
738 { LOG_LOCAL4
, "LOCAL4" },
739 { LOG_LOCAL5
, "LOCAL5" },
740 { LOG_LOCAL6
, "LOCAL6" },
741 { LOG_LOCAL7
, "LOCAL7" }
746 facility
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "facility", enum_log_facilities
, LOG_USER
);
751 static int audit_syslog_priority(vfs_handle_struct
*handle
)
753 static const struct enum_list enum_log_priorities
[] = {
754 { LOG_EMERG
, "EMERG" },
755 { LOG_ALERT
, "ALERT" },
756 { LOG_CRIT
, "CRIT" },
758 { LOG_WARNING
, "WARNING" },
759 { LOG_NOTICE
, "NOTICE" },
760 { LOG_INFO
, "INFO" },
761 { LOG_DEBUG
, "DEBUG" }
766 priority
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "priority",
767 enum_log_priorities
, LOG_NOTICE
);
768 if (priority
== -1) {
769 priority
= LOG_WARNING
;
775 static char *audit_prefix(TALLOC_CTX
*ctx
, connection_struct
*conn
)
780 prefix
= talloc_strdup(ctx
,
781 lp_parm_const_string(SNUM(conn
), "full_audit",
786 result
= talloc_sub_advanced(ctx
,
787 lp_servicename(SNUM(conn
)),
788 conn
->server_info
->unix_name
,
790 conn
->server_info
->utok
.gid
,
791 conn
->server_info
->sanitized_username
,
792 pdb_get_domain(conn
->server_info
->sam_account
),
798 static bool log_success(vfs_handle_struct
*handle
, vfs_op_type op
)
800 struct vfs_full_audit_private_data
*pd
= NULL
;
802 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
803 struct vfs_full_audit_private_data
,
806 if (pd
->success_ops
== NULL
) {
810 return bitmap_query(pd
->success_ops
, op
);
813 static bool log_failure(vfs_handle_struct
*handle
, vfs_op_type op
)
815 struct vfs_full_audit_private_data
*pd
= NULL
;
817 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
818 struct vfs_full_audit_private_data
,
821 if (pd
->failure_ops
== NULL
)
824 return bitmap_query(pd
->failure_ops
, op
);
827 static void init_bitmap(struct bitmap
**bm
, const char **ops
)
829 bool log_all
= False
;
834 *bm
= bitmap_allocate(SMB_VFS_OP_LAST
);
837 DEBUG(0, ("Could not alloc bitmap -- "
838 "defaulting to logging everything\n"));
842 while (*ops
!= NULL
) {
846 if (strequal(*ops
, "all")) {
851 if (strequal(*ops
, "none")) {
855 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
856 if (vfs_op_names
[i
].name
== NULL
) {
857 smb_panic("vfs_full_audit.c: name table not "
858 "in sync with vfs.h\n");
861 if (strequal(*ops
, vfs_op_names
[i
].name
)) {
867 DEBUG(0, ("Could not find opname %s, logging all\n",
876 /* The query functions default to True */
882 static const char *audit_opname(vfs_op_type op
)
884 if (op
>= SMB_VFS_OP_LAST
)
885 return "INVALID VFS OP";
886 return vfs_op_names
[op
].name
;
889 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
890 const char *format
, ...)
893 char *audit_pre
= NULL
;
897 if (success
&& (!log_success(handle
, op
)))
900 if (!success
&& (!log_failure(handle
, op
)))
904 fstrcpy(err_msg
, "ok");
906 fstr_sprintf(err_msg
, "fail (%s)", strerror(errno
));
908 va_start(ap
, format
);
909 op_msg
= talloc_vasprintf(talloc_tos(), format
, ap
);
916 audit_pre
= audit_prefix(talloc_tos(), handle
->conn
);
917 syslog(audit_syslog_priority(handle
), "%s|%s|%s|%s\n",
918 audit_pre
? audit_pre
: "",
919 audit_opname(op
), err_msg
, op_msg
);
921 TALLOC_FREE(audit_pre
);
927 /* Free function for the private data. */
929 static void free_private_data(void **p_data
)
931 struct vfs_full_audit_private_data
*pd
= *(struct vfs_full_audit_private_data
**)p_data
;
933 if (pd
->success_ops
) {
934 bitmap_free(pd
->success_ops
);
936 if (pd
->failure_ops
) {
937 bitmap_free(pd
->failure_ops
);
943 /* Implementation of vfs_ops. Pass everything on to the default
944 operation but log event first. */
946 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
947 const char *svc
, const char *user
)
950 struct vfs_full_audit_private_data
*pd
= NULL
;
951 const char *none
[] = { NULL
};
952 const char *all
[] = { "all" };
958 pd
= SMB_MALLOC_P(struct vfs_full_audit_private_data
);
964 openlog("smbd_audit", 0, audit_syslog_facility(handle
));
966 init_bitmap(&pd
->success_ops
,
967 lp_parm_string_list(SNUM(handle
->conn
), "full_audit", "success",
969 init_bitmap(&pd
->failure_ops
,
970 lp_parm_string_list(SNUM(handle
->conn
), "full_audit", "failure",
973 /* Store the private data. */
974 SMB_VFS_HANDLE_SET_DATA(handle
, pd
, free_private_data
,
975 struct vfs_full_audit_private_data
, return -1);
977 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
979 do_log(SMB_VFS_OP_CONNECT
, True
, handle
,
985 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
)
987 SMB_VFS_NEXT_DISCONNECT(handle
);
989 do_log(SMB_VFS_OP_DISCONNECT
, True
, handle
,
990 "%s", lp_servicename(SNUM(handle
->conn
)));
992 /* The bitmaps will be disconnected when the private
998 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
1000 bool small_query
, uint64_t *bsize
,
1001 uint64_t *dfree
, uint64_t *dsize
)
1005 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
1008 /* Don't have a reasonable notion of failure here */
1010 do_log(SMB_VFS_OP_DISK_FREE
, True
, handle
, "%s", path
);
1015 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
1016 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
1021 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
1023 do_log(SMB_VFS_OP_GET_QUOTA
, (result
>= 0), handle
, "");
1029 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
1030 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
1035 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
1037 do_log(SMB_VFS_OP_SET_QUOTA
, (result
>= 0), handle
, "");
1042 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
1043 struct files_struct
*fsp
,
1044 SHADOW_COPY_DATA
*shadow_copy_data
, bool labels
)
1048 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
, labels
);
1050 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA
, (result
>= 0), handle
, "");
1055 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
1057 struct vfs_statvfs_struct
*statbuf
)
1061 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
1063 do_log(SMB_VFS_OP_STATVFS
, (result
>= 0), handle
, "");
1068 static int smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
)
1072 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
);
1074 do_log(SMB_VFS_OP_FS_CAPABILITIES
, true, handle
, "");
1079 static SMB_STRUCT_DIR
*smb_full_audit_opendir(vfs_handle_struct
*handle
,
1080 const char *fname
, const char *mask
, uint32 attr
)
1082 SMB_STRUCT_DIR
*result
;
1084 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
1086 do_log(SMB_VFS_OP_OPENDIR
, (result
!= NULL
), handle
, "%s", fname
);
1091 static SMB_STRUCT_DIRENT
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
1092 SMB_STRUCT_DIR
*dirp
, SMB_STRUCT_STAT
*sbuf
)
1094 SMB_STRUCT_DIRENT
*result
;
1096 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
1098 /* This operation has no reasonable error condition
1099 * (End of dir is also failure), so always succeed.
1101 do_log(SMB_VFS_OP_READDIR
, True
, handle
, "");
1106 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
1107 SMB_STRUCT_DIR
*dirp
, long offset
)
1109 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
1111 do_log(SMB_VFS_OP_SEEKDIR
, True
, handle
, "");
1115 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
1116 SMB_STRUCT_DIR
*dirp
)
1120 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
1122 do_log(SMB_VFS_OP_TELLDIR
, True
, handle
, "");
1127 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
1128 SMB_STRUCT_DIR
*dirp
)
1130 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
1132 do_log(SMB_VFS_OP_REWINDDIR
, True
, handle
, "");
1136 static int smb_full_audit_mkdir(vfs_handle_struct
*handle
,
1137 const char *path
, mode_t mode
)
1141 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
1143 do_log(SMB_VFS_OP_MKDIR
, (result
>= 0), handle
, "%s", path
);
1148 static int smb_full_audit_rmdir(vfs_handle_struct
*handle
,
1153 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
1155 do_log(SMB_VFS_OP_RMDIR
, (result
>= 0), handle
, "%s", path
);
1160 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
1161 SMB_STRUCT_DIR
*dirp
)
1165 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
1167 do_log(SMB_VFS_OP_CLOSEDIR
, (result
>= 0), handle
, "");
1172 static void smb_full_audit_init_search_op(vfs_handle_struct
*handle
,
1173 SMB_STRUCT_DIR
*dirp
)
1175 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
1177 do_log(SMB_VFS_OP_INIT_SEARCH_OP
, True
, handle
, "");
1181 static int smb_full_audit_open(vfs_handle_struct
*handle
,
1182 const char *fname
, files_struct
*fsp
, int flags
, mode_t mode
)
1186 result
= SMB_VFS_NEXT_OPEN(handle
, fname
, fsp
, flags
, mode
);
1188 do_log(SMB_VFS_OP_OPEN
, (result
>= 0), handle
, "%s|%s",
1189 ((flags
& O_WRONLY
) || (flags
& O_RDWR
))?"w":"r",
1195 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
1196 struct smb_request
*req
,
1197 uint16_t root_dir_fid
,
1198 struct smb_filename
*smb_fname
,
1199 uint32_t access_mask
,
1200 uint32_t share_access
,
1201 uint32_t create_disposition
,
1202 uint32_t create_options
,
1203 uint32_t file_attributes
,
1204 uint32_t oplock_request
,
1205 uint64_t allocation_size
,
1206 struct security_descriptor
*sd
,
1207 struct ea_list
*ea_list
,
1208 files_struct
**result_fsp
,
1213 result
= SMB_VFS_NEXT_CREATE_FILE(
1214 handle
, /* handle */
1216 root_dir_fid
, /* root_dir_fid */
1217 smb_fname
, /* fname */
1218 access_mask
, /* access_mask */
1219 share_access
, /* share_access */
1220 create_disposition
, /* create_disposition*/
1221 create_options
, /* create_options */
1222 file_attributes
, /* file_attributes */
1223 oplock_request
, /* oplock_request */
1224 allocation_size
, /* allocation_size */
1226 ea_list
, /* ea_list */
1227 result_fsp
, /* result */
1230 do_log(SMB_VFS_OP_CREATE_FILE
, (NT_STATUS_IS_OK(result
)), handle
, "0x%x|%s",
1231 access_mask
, smb_fname_str_dbg(smb_fname
));
1236 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
1240 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
1242 do_log(SMB_VFS_OP_CLOSE
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1247 static ssize_t
smb_full_audit_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
1248 void *data
, size_t n
)
1252 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
1254 do_log(SMB_VFS_OP_READ
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1259 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
1260 void *data
, size_t n
, SMB_OFF_T offset
)
1264 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
1266 do_log(SMB_VFS_OP_PREAD
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1271 static ssize_t
smb_full_audit_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
1272 const void *data
, size_t n
)
1276 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
1278 do_log(SMB_VFS_OP_WRITE
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1283 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
1284 const void *data
, size_t n
,
1289 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
1291 do_log(SMB_VFS_OP_PWRITE
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1296 static SMB_OFF_T
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
1297 SMB_OFF_T offset
, int whence
)
1301 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
1303 do_log(SMB_VFS_OP_LSEEK
, (result
!= (ssize_t
)-1), handle
,
1304 "%s", fsp
->fsp_name
);
1309 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
1310 files_struct
*fromfsp
,
1311 const DATA_BLOB
*hdr
, SMB_OFF_T offset
,
1316 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
1318 do_log(SMB_VFS_OP_SENDFILE
, (result
>= 0), handle
,
1319 "%s", fromfsp
->fsp_name
);
1324 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
1325 files_struct
*tofsp
,
1331 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
1333 do_log(SMB_VFS_OP_RECVFILE
, (result
>= 0), handle
,
1334 "%s", tofsp
->fsp_name
);
1339 static int smb_full_audit_rename(vfs_handle_struct
*handle
,
1340 const char *oldname
, const char *newname
)
1344 result
= SMB_VFS_NEXT_RENAME(handle
, oldname
, newname
);
1346 do_log(SMB_VFS_OP_RENAME
, (result
>= 0), handle
, "%s|%s", oldname
, newname
);
1351 static int smb_full_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
1355 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
1357 do_log(SMB_VFS_OP_FSYNC
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1362 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
1363 const char *fname
, SMB_STRUCT_STAT
*sbuf
)
1367 result
= SMB_VFS_NEXT_STAT(handle
, fname
, sbuf
);
1369 do_log(SMB_VFS_OP_STAT
, (result
>= 0), handle
, "%s", fname
);
1374 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1375 SMB_STRUCT_STAT
*sbuf
)
1379 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1381 do_log(SMB_VFS_OP_FSTAT
, (result
>= 0), handle
, "%s", fsp
->fsp_name
);
1386 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
1387 const char *path
, SMB_STRUCT_STAT
*sbuf
)
1391 result
= SMB_VFS_NEXT_LSTAT(handle
, path
, sbuf
);
1393 do_log(SMB_VFS_OP_LSTAT
, (result
>= 0), handle
, "%s", path
);
1398 static int smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
1399 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
1403 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1405 do_log(SMB_VFS_OP_GET_ALLOC_SIZE
, (result
>= 0), handle
, "%d", result
);
1410 static int smb_full_audit_unlink(vfs_handle_struct
*handle
,
1415 result
= SMB_VFS_NEXT_UNLINK(handle
, path
);
1417 do_log(SMB_VFS_OP_UNLINK
, (result
>= 0), handle
, "%s", path
);
1422 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
1423 const char *path
, mode_t mode
)
1427 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1429 do_log(SMB_VFS_OP_CHMOD
, (result
>= 0), handle
, "%s|%o", path
, mode
);
1434 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1439 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1441 do_log(SMB_VFS_OP_FCHMOD
, (result
>= 0), handle
,
1442 "%s|%o", fsp
->fsp_name
, mode
);
1447 static int smb_full_audit_chown(vfs_handle_struct
*handle
,
1448 const char *path
, uid_t uid
, gid_t gid
)
1452 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1454 do_log(SMB_VFS_OP_CHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1455 path
, (long int)uid
, (long int)gid
);
1460 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1461 uid_t uid
, gid_t gid
)
1465 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1467 do_log(SMB_VFS_OP_FCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1468 fsp
->fsp_name
, (long int)uid
, (long int)gid
);
1473 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
1474 const char *path
, uid_t uid
, gid_t gid
)
1478 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1480 do_log(SMB_VFS_OP_LCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1481 path
, (long int)uid
, (long int)gid
);
1486 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
1491 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
1493 do_log(SMB_VFS_OP_CHDIR
, (result
>= 0), handle
, "chdir|%s", path
);
1498 static char *smb_full_audit_getwd(vfs_handle_struct
*handle
,
1503 result
= SMB_VFS_NEXT_GETWD(handle
, path
);
1505 do_log(SMB_VFS_OP_GETWD
, (result
!= NULL
), handle
, "%s", path
);
1510 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
1511 const char *path
, struct smb_file_time
*ft
)
1515 result
= SMB_VFS_NEXT_NTIMES(handle
, path
, ft
);
1517 do_log(SMB_VFS_OP_NTIMES
, (result
>= 0), handle
, "%s", path
);
1522 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1527 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1529 do_log(SMB_VFS_OP_FTRUNCATE
, (result
>= 0), handle
,
1530 "%s", fsp
->fsp_name
);
1535 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1536 int op
, SMB_OFF_T offset
, SMB_OFF_T count
, int type
)
1540 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1542 do_log(SMB_VFS_OP_LOCK
, result
, handle
, "%s", fsp
->fsp_name
);
1547 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1548 struct files_struct
*fsp
,
1553 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
);
1555 do_log(SMB_VFS_OP_KERNEL_FLOCK
, (result
>= 0), handle
, "%s",
1561 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1566 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1568 do_log(SMB_VFS_OP_LINUX_SETLEASE
, (result
>= 0), handle
, "%s",
1574 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1575 SMB_OFF_T
*poffset
, SMB_OFF_T
*pcount
, int *ptype
, pid_t
*ppid
)
1579 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
1581 do_log(SMB_VFS_OP_GETLOCK
, result
, handle
, "%s", fsp
->fsp_name
);
1586 static int smb_full_audit_symlink(vfs_handle_struct
*handle
,
1587 const char *oldpath
, const char *newpath
)
1591 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1593 do_log(SMB_VFS_OP_SYMLINK
, (result
>= 0), handle
,
1594 "%s|%s", oldpath
, newpath
);
1599 static int smb_full_audit_readlink(vfs_handle_struct
*handle
,
1600 const char *path
, char *buf
, size_t bufsiz
)
1604 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1606 do_log(SMB_VFS_OP_READLINK
, (result
>= 0), handle
, "%s", path
);
1611 static int smb_full_audit_link(vfs_handle_struct
*handle
,
1612 const char *oldpath
, const char *newpath
)
1616 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
1618 do_log(SMB_VFS_OP_LINK
, (result
>= 0), handle
,
1619 "%s|%s", oldpath
, newpath
);
1624 static int smb_full_audit_mknod(vfs_handle_struct
*handle
,
1625 const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1629 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1631 do_log(SMB_VFS_OP_MKNOD
, (result
>= 0), handle
, "%s", pathname
);
1636 static char *smb_full_audit_realpath(vfs_handle_struct
*handle
,
1637 const char *path
, char *resolved_path
)
1641 result
= SMB_VFS_NEXT_REALPATH(handle
, path
, resolved_path
);
1643 do_log(SMB_VFS_OP_REALPATH
, (result
!= NULL
), handle
, "%s", path
);
1648 static NTSTATUS
smb_full_audit_notify_watch(struct vfs_handle_struct
*handle
,
1649 struct sys_notify_context
*ctx
,
1650 struct notify_entry
*e
,
1651 void (*callback
)(struct sys_notify_context
*ctx
,
1653 struct notify_event
*ev
),
1654 void *private_data
, void *handle_p
)
1658 result
= SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, e
, callback
, private_data
, handle_p
);
1660 do_log(SMB_VFS_OP_NOTIFY_WATCH
, NT_STATUS_IS_OK(result
), handle
, "");
1665 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
1666 const char *path
, unsigned int flags
)
1670 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1672 do_log(SMB_VFS_OP_CHFLAGS
, (result
!= 0), handle
, "%s", path
);
1677 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
1678 const SMB_STRUCT_STAT
*sbuf
)
1680 struct file_id id_zero
;
1681 struct file_id result
;
1683 ZERO_STRUCT(id_zero
);
1685 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1687 do_log(SMB_VFS_OP_FILE_ID_CREATE
,
1688 !file_id_equal(&id_zero
, &result
),
1689 handle
, "%s", file_id_string_tos(&result
));
1694 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
1695 struct files_struct
*fsp
,
1697 TALLOC_CTX
*mem_ctx
,
1698 unsigned int *pnum_streams
,
1699 struct stream_struct
**pstreams
)
1703 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1704 pnum_streams
, pstreams
);
1706 do_log(SMB_VFS_OP_STREAMINFO
, NT_STATUS_IS_OK(result
), handle
,
1712 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1715 TALLOC_CTX
*mem_ctx
,
1720 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
1723 do_log(SMB_VFS_OP_GET_REAL_FILENAME
, (result
== 0), handle
,
1724 "%s/%s->%s", path
, name
, (result
== 0) ? "" : *found_name
);
1729 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
1734 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1736 do_log(SMB_VFS_OP_CONNECTPATH
, result
!= NULL
, handle
,
1742 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1743 struct byte_range_lock
*br_lck
,
1744 struct lock_struct
*plock
,
1746 struct blocking_lock_record
*blr
)
1750 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1751 blocking_lock
, blr
);
1753 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS
, NT_STATUS_IS_OK(result
), handle
,
1754 "%s:%llu-%llu. type=%d. blocking=%d", br_lck
->fsp
->fsp_name
,
1755 plock
->start
, plock
->size
, plock
->lock_type
, blocking_lock
);
1760 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1761 struct messaging_context
*msg_ctx
,
1762 struct byte_range_lock
*br_lck
,
1763 const struct lock_struct
*plock
)
1767 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1770 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, (result
== 0), handle
,
1771 "%s:%llu-%llu:%d", br_lck
->fsp
->fsp_name
, plock
->start
,
1772 plock
->size
, plock
->lock_type
);
1777 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1778 struct byte_range_lock
*br_lck
,
1779 struct lock_struct
*plock
,
1780 struct blocking_lock_record
*blr
)
1784 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
, blr
);
1786 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS
, (result
== 0), handle
,
1787 "%s:%llu-%llu:%d", br_lck
->fsp
->fsp_name
, plock
->start
,
1793 static bool smb_full_audit_strict_lock(struct vfs_handle_struct
*handle
,
1794 struct files_struct
*fsp
,
1795 struct lock_struct
*plock
)
1799 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1801 do_log(SMB_VFS_OP_STRICT_LOCK
, result
, handle
,
1802 "%s:%llu-%llu:%d", fsp
->fsp_name
, plock
->start
,
1808 static void smb_full_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1809 struct files_struct
*fsp
,
1810 struct lock_struct
*plock
)
1812 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1814 do_log(SMB_VFS_OP_STRICT_UNLOCK
, true, handle
,
1815 "%s:%llu-%llu:%d", fsp
->fsp_name
, plock
->start
,
1821 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1822 uint32 security_info
,
1827 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, ppdesc
);
1829 do_log(SMB_VFS_OP_FGET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1830 "%s", fsp
->fsp_name
);
1835 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
1837 uint32 security_info
,
1842 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, ppdesc
);
1844 do_log(SMB_VFS_OP_GET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1850 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1851 uint32 security_info_sent
,
1852 const SEC_DESC
*psd
)
1856 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
1858 do_log(SMB_VFS_OP_FSET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
, "%s", fsp
->fsp_name
);
1863 static int smb_full_audit_chmod_acl(vfs_handle_struct
*handle
,
1864 const char *path
, mode_t mode
)
1868 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1870 do_log(SMB_VFS_OP_CHMOD_ACL
, (result
>= 0), handle
,
1871 "%s|%o", path
, mode
);
1876 static int smb_full_audit_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1881 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1883 do_log(SMB_VFS_OP_FCHMOD_ACL
, (result
>= 0), handle
,
1884 "%s|%o", fsp
->fsp_name
, mode
);
1889 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct
*handle
,
1891 SMB_ACL_T theacl
, int entry_id
,
1892 SMB_ACL_ENTRY_T
*entry_p
)
1896 result
= SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle
, theacl
, entry_id
,
1899 do_log(SMB_VFS_OP_SYS_ACL_GET_ENTRY
, (result
>= 0), handle
,
1905 static int smb_full_audit_sys_acl_get_tag_type(vfs_handle_struct
*handle
,
1907 SMB_ACL_ENTRY_T entry_d
,
1908 SMB_ACL_TAG_T
*tag_type_p
)
1912 result
= SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle
, entry_d
,
1915 do_log(SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, (result
>= 0), handle
,
1921 static int smb_full_audit_sys_acl_get_permset(vfs_handle_struct
*handle
,
1923 SMB_ACL_ENTRY_T entry_d
,
1924 SMB_ACL_PERMSET_T
*permset_p
)
1928 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle
, entry_d
,
1931 do_log(SMB_VFS_OP_SYS_ACL_GET_PERMSET
, (result
>= 0), handle
,
1937 static void * smb_full_audit_sys_acl_get_qualifier(vfs_handle_struct
*handle
,
1939 SMB_ACL_ENTRY_T entry_d
)
1943 result
= SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle
, entry_d
);
1945 do_log(SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, (result
!= NULL
), handle
,
1951 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1953 SMB_ACL_TYPE_T type
)
1957 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
);
1959 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE
, (result
!= NULL
), handle
,
1965 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
1970 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
);
1972 do_log(SMB_VFS_OP_SYS_ACL_GET_FD
, (result
!= NULL
), handle
,
1973 "%s", fsp
->fsp_name
);
1978 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct
*handle
,
1980 SMB_ACL_PERMSET_T permset
)
1984 result
= SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle
, permset
);
1986 do_log(SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, (result
>= 0), handle
,
1992 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct
*handle
,
1994 SMB_ACL_PERMSET_T permset
,
1995 SMB_ACL_PERM_T perm
)
1999 result
= SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle
, permset
, perm
);
2001 do_log(SMB_VFS_OP_SYS_ACL_ADD_PERM
, (result
>= 0), handle
,
2007 static char * smb_full_audit_sys_acl_to_text(vfs_handle_struct
*handle
,
2013 result
= SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle
, theacl
, plen
);
2015 do_log(SMB_VFS_OP_SYS_ACL_TO_TEXT
, (result
!= NULL
), handle
,
2021 static SMB_ACL_T
smb_full_audit_sys_acl_init(vfs_handle_struct
*handle
,
2027 result
= SMB_VFS_NEXT_SYS_ACL_INIT(handle
, count
);
2029 do_log(SMB_VFS_OP_SYS_ACL_INIT
, (result
!= NULL
), handle
,
2035 static int smb_full_audit_sys_acl_create_entry(vfs_handle_struct
*handle
,
2037 SMB_ACL_ENTRY_T
*pentry
)
2041 result
= SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle
, pacl
, pentry
);
2043 do_log(SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, (result
>= 0), handle
,
2049 static int smb_full_audit_sys_acl_set_tag_type(vfs_handle_struct
*handle
,
2051 SMB_ACL_ENTRY_T entry
,
2052 SMB_ACL_TAG_T tagtype
)
2056 result
= SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle
, entry
,
2059 do_log(SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, (result
>= 0), handle
,
2065 static int smb_full_audit_sys_acl_set_qualifier(vfs_handle_struct
*handle
,
2067 SMB_ACL_ENTRY_T entry
,
2072 result
= SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle
, entry
, qual
);
2074 do_log(SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, (result
>= 0), handle
,
2080 static int smb_full_audit_sys_acl_set_permset(vfs_handle_struct
*handle
,
2082 SMB_ACL_ENTRY_T entry
,
2083 SMB_ACL_PERMSET_T permset
)
2087 result
= SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle
, entry
, permset
);
2089 do_log(SMB_VFS_OP_SYS_ACL_SET_PERMSET
, (result
>= 0), handle
,
2095 static int smb_full_audit_sys_acl_valid(vfs_handle_struct
*handle
,
2101 result
= SMB_VFS_NEXT_SYS_ACL_VALID(handle
, theacl
);
2103 do_log(SMB_VFS_OP_SYS_ACL_VALID
, (result
>= 0), handle
,
2109 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
2111 const char *name
, SMB_ACL_TYPE_T acltype
,
2116 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
2119 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE
, (result
>= 0), handle
,
2125 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
2130 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
2132 do_log(SMB_VFS_OP_SYS_ACL_SET_FD
, (result
>= 0), handle
,
2133 "%s", fsp
->fsp_name
);
2138 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
2144 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
2146 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, (result
>= 0), handle
,
2152 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct
*handle
,
2154 SMB_ACL_PERMSET_T permset
,
2155 SMB_ACL_PERM_T perm
)
2159 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle
, permset
, perm
);
2161 do_log(SMB_VFS_OP_SYS_ACL_GET_PERM
, (result
>= 0), handle
,
2167 static int smb_full_audit_sys_acl_free_text(vfs_handle_struct
*handle
,
2173 result
= SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle
, text
);
2175 do_log(SMB_VFS_OP_SYS_ACL_FREE_TEXT
, (result
>= 0), handle
,
2181 static int smb_full_audit_sys_acl_free_acl(vfs_handle_struct
*handle
,
2183 SMB_ACL_T posix_acl
)
2187 result
= SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle
, posix_acl
);
2189 do_log(SMB_VFS_OP_SYS_ACL_FREE_ACL
, (result
>= 0), handle
,
2195 static int smb_full_audit_sys_acl_free_qualifier(vfs_handle_struct
*handle
,
2197 SMB_ACL_TAG_T tagtype
)
2201 result
= SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle
, qualifier
,
2204 do_log(SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, (result
>= 0), handle
,
2210 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
2212 const char *name
, void *value
, size_t size
)
2216 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
2218 do_log(SMB_VFS_OP_GETXATTR
, (result
>= 0), handle
,
2219 "%s|%s", path
, name
);
2224 static ssize_t
smb_full_audit_lgetxattr(struct vfs_handle_struct
*handle
,
2225 const char *path
, const char *name
,
2226 void *value
, size_t size
)
2230 result
= SMB_VFS_NEXT_LGETXATTR(handle
, path
, name
, value
, size
);
2232 do_log(SMB_VFS_OP_LGETXATTR
, (result
>= 0), handle
,
2233 "%s|%s", path
, name
);
2238 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2239 struct files_struct
*fsp
,
2240 const char *name
, void *value
, size_t size
)
2244 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2246 do_log(SMB_VFS_OP_FGETXATTR
, (result
>= 0), handle
,
2247 "%s|%s", fsp
->fsp_name
, name
);
2252 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
2253 const char *path
, char *list
, size_t size
)
2257 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
2259 do_log(SMB_VFS_OP_LISTXATTR
, (result
>= 0), handle
, "%s", path
);
2264 static ssize_t
smb_full_audit_llistxattr(struct vfs_handle_struct
*handle
,
2265 const char *path
, char *list
, size_t size
)
2269 result
= SMB_VFS_NEXT_LLISTXATTR(handle
, path
, list
, size
);
2271 do_log(SMB_VFS_OP_LLISTXATTR
, (result
>= 0), handle
, "%s", path
);
2276 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
2277 struct files_struct
*fsp
, char *list
,
2282 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
2284 do_log(SMB_VFS_OP_FLISTXATTR
, (result
>= 0), handle
,
2285 "%s", fsp
->fsp_name
);
2290 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
2296 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2298 do_log(SMB_VFS_OP_REMOVEXATTR
, (result
>= 0), handle
,
2299 "%s|%s", path
, name
);
2304 static int smb_full_audit_lremovexattr(struct vfs_handle_struct
*handle
,
2310 result
= SMB_VFS_NEXT_LREMOVEXATTR(handle
, path
, name
);
2312 do_log(SMB_VFS_OP_LREMOVEXATTR
, (result
>= 0), handle
,
2313 "%s|%s", path
, name
);
2318 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2319 struct files_struct
*fsp
,
2324 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2326 do_log(SMB_VFS_OP_FREMOVEXATTR
, (result
>= 0), handle
,
2327 "%s|%s", fsp
->fsp_name
, name
);
2332 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
2334 const char *name
, const void *value
, size_t size
,
2339 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
2342 do_log(SMB_VFS_OP_SETXATTR
, (result
>= 0), handle
,
2343 "%s|%s", path
, name
);
2348 static int smb_full_audit_lsetxattr(struct vfs_handle_struct
*handle
,
2350 const char *name
, const void *value
, size_t size
,
2355 result
= SMB_VFS_NEXT_LSETXATTR(handle
, path
, name
, value
, size
,
2358 do_log(SMB_VFS_OP_LSETXATTR
, (result
>= 0), handle
,
2359 "%s|%s", path
, name
);
2364 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2365 struct files_struct
*fsp
, const char *name
,
2366 const void *value
, size_t size
, int flags
)
2370 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2372 do_log(SMB_VFS_OP_FSETXATTR
, (result
>= 0), handle
,
2373 "%s|%s", fsp
->fsp_name
, name
);
2378 static int smb_full_audit_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2382 result
= SMB_VFS_NEXT_AIO_READ(handle
, fsp
, aiocb
);
2383 do_log(SMB_VFS_OP_AIO_READ
, (result
>= 0), handle
,
2384 "%s", fsp
->fsp_name
);
2389 static int smb_full_audit_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2393 result
= SMB_VFS_NEXT_AIO_WRITE(handle
, fsp
, aiocb
);
2394 do_log(SMB_VFS_OP_AIO_WRITE
, (result
>= 0), handle
,
2395 "%s", fsp
->fsp_name
);
2400 static ssize_t
smb_full_audit_aio_return(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2404 result
= SMB_VFS_NEXT_AIO_RETURN(handle
, fsp
, aiocb
);
2405 do_log(SMB_VFS_OP_AIO_RETURN
, (result
>= 0), handle
,
2406 "%s", fsp
->fsp_name
);
2411 static int smb_full_audit_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2415 result
= SMB_VFS_NEXT_AIO_CANCEL(handle
, fsp
, aiocb
);
2416 do_log(SMB_VFS_OP_AIO_CANCEL
, (result
>= 0), handle
,
2417 "%s", fsp
->fsp_name
);
2422 static int smb_full_audit_aio_error(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2426 result
= SMB_VFS_NEXT_AIO_ERROR(handle
, fsp
, aiocb
);
2427 do_log(SMB_VFS_OP_AIO_ERROR
, (result
>= 0), handle
,
2428 "%s", fsp
->fsp_name
);
2433 static int smb_full_audit_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
)
2437 result
= SMB_VFS_NEXT_AIO_FSYNC(handle
, fsp
, op
, aiocb
);
2438 do_log(SMB_VFS_OP_AIO_FSYNC
, (result
>= 0), handle
,
2439 "%s", fsp
->fsp_name
);
2444 static int smb_full_audit_aio_suspend(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, const SMB_STRUCT_AIOCB
* const aiocb
[], int n
, const struct timespec
*ts
)
2448 result
= SMB_VFS_NEXT_AIO_SUSPEND(handle
, fsp
, aiocb
, n
, ts
);
2449 do_log(SMB_VFS_OP_AIO_SUSPEND
, (result
>= 0), handle
,
2450 "%s", fsp
->fsp_name
);
2455 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
2456 struct files_struct
*fsp
)
2460 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2461 do_log(SMB_VFS_OP_AIO_FORCE
, result
, handle
,
2462 "%s", fsp
->fsp_name
);
2467 NTSTATUS
vfs_full_audit_init(void);
2468 NTSTATUS
vfs_full_audit_init(void)
2470 NTSTATUS ret
= smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
2471 "full_audit", audit_op_tuples
);
2473 if (!NT_STATUS_IS_OK(ret
))
2476 vfs_full_audit_debug_level
= debug_add_class("full_audit");
2477 if (vfs_full_audit_debug_level
== -1) {
2478 vfs_full_audit_debug_level
= DBGC_VFS
;
2479 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2482 DEBUG(10, ("vfs_full_audit: Debug class number of "
2483 "'full_audit': %d\n", vfs_full_audit_debug_level
));