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.
61 #include "../librpc/gen_ndr/ndr_netlogon.h"
63 static int vfs_full_audit_debug_level
= DBGC_VFS
;
65 struct vfs_full_audit_private_data
{
66 struct bitmap
*success_ops
;
67 struct bitmap
*failure_ops
;
71 #define DBGC_CLASS vfs_full_audit_debug_level
73 typedef enum _vfs_op_type
{
78 SMB_VFS_OP_CONNECT
= 0,
79 SMB_VFS_OP_DISCONNECT
,
83 SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
85 SMB_VFS_OP_FS_CAPABILITIES
,
87 /* Directory operations */
97 SMB_VFS_OP_INIT_SEARCH_OP
,
102 SMB_VFS_OP_CREATE_FILE
,
116 SMB_VFS_OP_GET_ALLOC_SIZE
,
126 SMB_VFS_OP_FTRUNCATE
,
128 SMB_VFS_OP_KERNEL_FLOCK
,
129 SMB_VFS_OP_LINUX_SETLEASE
,
136 SMB_VFS_OP_NOTIFY_WATCH
,
138 SMB_VFS_OP_FILE_ID_CREATE
,
139 SMB_VFS_OP_STREAMINFO
,
140 SMB_VFS_OP_GET_REAL_FILENAME
,
141 SMB_VFS_OP_CONNECTPATH
,
142 SMB_VFS_OP_BRL_LOCK_WINDOWS
,
143 SMB_VFS_OP_BRL_UNLOCK_WINDOWS
,
144 SMB_VFS_OP_BRL_CANCEL_WINDOWS
,
145 SMB_VFS_OP_STRICT_LOCK
,
146 SMB_VFS_OP_STRICT_UNLOCK
,
147 SMB_VFS_OP_TRANSLATE_NAME
,
149 /* NT ACL operations. */
151 SMB_VFS_OP_FGET_NT_ACL
,
152 SMB_VFS_OP_GET_NT_ACL
,
153 SMB_VFS_OP_FSET_NT_ACL
,
155 /* POSIX ACL operations. */
157 SMB_VFS_OP_CHMOD_ACL
,
158 SMB_VFS_OP_FCHMOD_ACL
,
160 SMB_VFS_OP_SYS_ACL_GET_ENTRY
,
161 SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
,
162 SMB_VFS_OP_SYS_ACL_GET_PERMSET
,
163 SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
,
164 SMB_VFS_OP_SYS_ACL_GET_FILE
,
165 SMB_VFS_OP_SYS_ACL_GET_FD
,
166 SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
,
167 SMB_VFS_OP_SYS_ACL_ADD_PERM
,
168 SMB_VFS_OP_SYS_ACL_TO_TEXT
,
169 SMB_VFS_OP_SYS_ACL_INIT
,
170 SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
,
171 SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
,
172 SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
,
173 SMB_VFS_OP_SYS_ACL_SET_PERMSET
,
174 SMB_VFS_OP_SYS_ACL_VALID
,
175 SMB_VFS_OP_SYS_ACL_SET_FILE
,
176 SMB_VFS_OP_SYS_ACL_SET_FD
,
177 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
178 SMB_VFS_OP_SYS_ACL_GET_PERM
,
179 SMB_VFS_OP_SYS_ACL_FREE_TEXT
,
180 SMB_VFS_OP_SYS_ACL_FREE_ACL
,
181 SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
,
185 SMB_VFS_OP_LGETXATTR
,
186 SMB_VFS_OP_FGETXATTR
,
187 SMB_VFS_OP_LISTXATTR
,
188 SMB_VFS_OP_LLISTXATTR
,
189 SMB_VFS_OP_FLISTXATTR
,
190 SMB_VFS_OP_REMOVEXATTR
,
191 SMB_VFS_OP_LREMOVEXATTR
,
192 SMB_VFS_OP_FREMOVEXATTR
,
194 SMB_VFS_OP_LSETXATTR
,
195 SMB_VFS_OP_FSETXATTR
,
199 SMB_VFS_OP_AIO_WRITE
,
200 SMB_VFS_OP_AIO_RETURN
,
201 SMB_VFS_OP_AIO_CANCEL
,
202 SMB_VFS_OP_AIO_ERROR
,
203 SMB_VFS_OP_AIO_FSYNC
,
204 SMB_VFS_OP_AIO_SUSPEND
,
205 SMB_VFS_OP_AIO_FORCE
,
207 /* offline operations */
208 SMB_VFS_OP_IS_OFFLINE
,
209 SMB_VFS_OP_SET_OFFLINE
,
211 /* This should always be last enum value */
216 /* The following array *must* be in the same order as defined in vfs.h */
222 { SMB_VFS_OP_CONNECT
, "connect" },
223 { SMB_VFS_OP_DISCONNECT
, "disconnect" },
224 { SMB_VFS_OP_DISK_FREE
, "disk_free" },
225 { SMB_VFS_OP_GET_QUOTA
, "get_quota" },
226 { SMB_VFS_OP_SET_QUOTA
, "set_quota" },
227 { SMB_VFS_OP_GET_SHADOW_COPY_DATA
, "get_shadow_copy_data" },
228 { SMB_VFS_OP_STATVFS
, "statvfs" },
229 { SMB_VFS_OP_FS_CAPABILITIES
, "fs_capabilities" },
230 { SMB_VFS_OP_OPENDIR
, "opendir" },
231 { SMB_VFS_OP_READDIR
, "readdir" },
232 { SMB_VFS_OP_SEEKDIR
, "seekdir" },
233 { SMB_VFS_OP_TELLDIR
, "telldir" },
234 { SMB_VFS_OP_REWINDDIR
, "rewinddir" },
235 { SMB_VFS_OP_MKDIR
, "mkdir" },
236 { SMB_VFS_OP_RMDIR
, "rmdir" },
237 { SMB_VFS_OP_CLOSEDIR
, "closedir" },
238 { SMB_VFS_OP_INIT_SEARCH_OP
, "init_search_op" },
239 { SMB_VFS_OP_OPEN
, "open" },
240 { SMB_VFS_OP_CREATE_FILE
, "create_file" },
241 { SMB_VFS_OP_CLOSE
, "close" },
242 { SMB_VFS_OP_READ
, "read" },
243 { SMB_VFS_OP_PREAD
, "pread" },
244 { SMB_VFS_OP_WRITE
, "write" },
245 { SMB_VFS_OP_PWRITE
, "pwrite" },
246 { SMB_VFS_OP_LSEEK
, "lseek" },
247 { SMB_VFS_OP_SENDFILE
, "sendfile" },
248 { SMB_VFS_OP_RECVFILE
, "recvfile" },
249 { SMB_VFS_OP_RENAME
, "rename" },
250 { SMB_VFS_OP_FSYNC
, "fsync" },
251 { SMB_VFS_OP_STAT
, "stat" },
252 { SMB_VFS_OP_FSTAT
, "fstat" },
253 { SMB_VFS_OP_LSTAT
, "lstat" },
254 { SMB_VFS_OP_GET_ALLOC_SIZE
, "get_alloc_size" },
255 { SMB_VFS_OP_UNLINK
, "unlink" },
256 { SMB_VFS_OP_CHMOD
, "chmod" },
257 { SMB_VFS_OP_FCHMOD
, "fchmod" },
258 { SMB_VFS_OP_CHOWN
, "chown" },
259 { SMB_VFS_OP_FCHOWN
, "fchown" },
260 { SMB_VFS_OP_LCHOWN
, "lchown" },
261 { SMB_VFS_OP_CHDIR
, "chdir" },
262 { SMB_VFS_OP_GETWD
, "getwd" },
263 { SMB_VFS_OP_NTIMES
, "ntimes" },
264 { SMB_VFS_OP_FTRUNCATE
, "ftruncate" },
265 { SMB_VFS_OP_LOCK
, "lock" },
266 { SMB_VFS_OP_KERNEL_FLOCK
, "kernel_flock" },
267 { SMB_VFS_OP_LINUX_SETLEASE
, "linux_setlease" },
268 { SMB_VFS_OP_GETLOCK
, "getlock" },
269 { SMB_VFS_OP_SYMLINK
, "symlink" },
270 { SMB_VFS_OP_READLINK
, "readlink" },
271 { SMB_VFS_OP_LINK
, "link" },
272 { SMB_VFS_OP_MKNOD
, "mknod" },
273 { SMB_VFS_OP_REALPATH
, "realpath" },
274 { SMB_VFS_OP_NOTIFY_WATCH
, "notify_watch" },
275 { SMB_VFS_OP_CHFLAGS
, "chflags" },
276 { SMB_VFS_OP_FILE_ID_CREATE
, "file_id_create" },
277 { SMB_VFS_OP_STREAMINFO
, "streaminfo" },
278 { SMB_VFS_OP_GET_REAL_FILENAME
, "get_real_filename" },
279 { SMB_VFS_OP_CONNECTPATH
, "connectpath" },
280 { SMB_VFS_OP_BRL_LOCK_WINDOWS
, "brl_lock_windows" },
281 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, "brl_unlock_windows" },
282 { SMB_VFS_OP_BRL_CANCEL_WINDOWS
, "brl_cancel_windows" },
283 { SMB_VFS_OP_STRICT_LOCK
, "strict_lock" },
284 { SMB_VFS_OP_STRICT_UNLOCK
, "strict_unlock" },
285 { SMB_VFS_OP_TRANSLATE_NAME
, "translate_name" },
286 { SMB_VFS_OP_FGET_NT_ACL
, "fget_nt_acl" },
287 { SMB_VFS_OP_GET_NT_ACL
, "get_nt_acl" },
288 { SMB_VFS_OP_FSET_NT_ACL
, "fset_nt_acl" },
289 { SMB_VFS_OP_CHMOD_ACL
, "chmod_acl" },
290 { SMB_VFS_OP_FCHMOD_ACL
, "fchmod_acl" },
291 { SMB_VFS_OP_SYS_ACL_GET_ENTRY
, "sys_acl_get_entry" },
292 { SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, "sys_acl_get_tag_type" },
293 { SMB_VFS_OP_SYS_ACL_GET_PERMSET
, "sys_acl_get_permset" },
294 { SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, "sys_acl_get_qualifier" },
295 { SMB_VFS_OP_SYS_ACL_GET_FILE
, "sys_acl_get_file" },
296 { SMB_VFS_OP_SYS_ACL_GET_FD
, "sys_acl_get_fd" },
297 { SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, "sys_acl_clear_perms" },
298 { SMB_VFS_OP_SYS_ACL_ADD_PERM
, "sys_acl_add_perm" },
299 { SMB_VFS_OP_SYS_ACL_TO_TEXT
, "sys_acl_to_text" },
300 { SMB_VFS_OP_SYS_ACL_INIT
, "sys_acl_init" },
301 { SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, "sys_acl_create_entry" },
302 { SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, "sys_acl_set_tag_type" },
303 { SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, "sys_acl_set_qualifier" },
304 { SMB_VFS_OP_SYS_ACL_SET_PERMSET
, "sys_acl_set_permset" },
305 { SMB_VFS_OP_SYS_ACL_VALID
, "sys_acl_valid" },
306 { SMB_VFS_OP_SYS_ACL_SET_FILE
, "sys_acl_set_file" },
307 { SMB_VFS_OP_SYS_ACL_SET_FD
, "sys_acl_set_fd" },
308 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, "sys_acl_delete_def_file" },
309 { SMB_VFS_OP_SYS_ACL_GET_PERM
, "sys_acl_get_perm" },
310 { SMB_VFS_OP_SYS_ACL_FREE_TEXT
, "sys_acl_free_text" },
311 { SMB_VFS_OP_SYS_ACL_FREE_ACL
, "sys_acl_free_acl" },
312 { SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, "sys_acl_free_qualifier" },
313 { SMB_VFS_OP_GETXATTR
, "getxattr" },
314 { SMB_VFS_OP_LGETXATTR
, "lgetxattr" },
315 { SMB_VFS_OP_FGETXATTR
, "fgetxattr" },
316 { SMB_VFS_OP_LISTXATTR
, "listxattr" },
317 { SMB_VFS_OP_LLISTXATTR
, "llistxattr" },
318 { SMB_VFS_OP_FLISTXATTR
, "flistxattr" },
319 { SMB_VFS_OP_REMOVEXATTR
, "removexattr" },
320 { SMB_VFS_OP_LREMOVEXATTR
, "lremovexattr" },
321 { SMB_VFS_OP_FREMOVEXATTR
, "fremovexattr" },
322 { SMB_VFS_OP_SETXATTR
, "setxattr" },
323 { SMB_VFS_OP_LSETXATTR
, "lsetxattr" },
324 { SMB_VFS_OP_FSETXATTR
, "fsetxattr" },
325 { SMB_VFS_OP_AIO_READ
, "aio_read" },
326 { SMB_VFS_OP_AIO_WRITE
, "aio_write" },
327 { SMB_VFS_OP_AIO_RETURN
,"aio_return" },
328 { SMB_VFS_OP_AIO_CANCEL
,"aio_cancel" },
329 { SMB_VFS_OP_AIO_ERROR
, "aio_error" },
330 { SMB_VFS_OP_AIO_FSYNC
, "aio_fsync" },
331 { SMB_VFS_OP_AIO_SUSPEND
,"aio_suspend" },
332 { SMB_VFS_OP_AIO_FORCE
, "aio_force" },
333 { SMB_VFS_OP_IS_OFFLINE
, "aio_is_offline" },
334 { SMB_VFS_OP_SET_OFFLINE
, "aio_set_offline" },
335 { SMB_VFS_OP_LAST
, NULL
}
338 static int audit_syslog_facility(vfs_handle_struct
*handle
)
340 static const struct enum_list enum_log_facilities
[] = {
341 { LOG_USER
, "USER" },
342 { LOG_LOCAL0
, "LOCAL0" },
343 { LOG_LOCAL1
, "LOCAL1" },
344 { LOG_LOCAL2
, "LOCAL2" },
345 { LOG_LOCAL3
, "LOCAL3" },
346 { LOG_LOCAL4
, "LOCAL4" },
347 { LOG_LOCAL5
, "LOCAL5" },
348 { LOG_LOCAL6
, "LOCAL6" },
349 { LOG_LOCAL7
, "LOCAL7" }
354 facility
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "facility", enum_log_facilities
, LOG_USER
);
359 static int audit_syslog_priority(vfs_handle_struct
*handle
)
361 static const struct enum_list enum_log_priorities
[] = {
362 { LOG_EMERG
, "EMERG" },
363 { LOG_ALERT
, "ALERT" },
364 { LOG_CRIT
, "CRIT" },
366 { LOG_WARNING
, "WARNING" },
367 { LOG_NOTICE
, "NOTICE" },
368 { LOG_INFO
, "INFO" },
369 { LOG_DEBUG
, "DEBUG" }
374 priority
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "priority",
375 enum_log_priorities
, LOG_NOTICE
);
376 if (priority
== -1) {
377 priority
= LOG_WARNING
;
383 static char *audit_prefix(TALLOC_CTX
*ctx
, connection_struct
*conn
)
388 prefix
= talloc_strdup(ctx
,
389 lp_parm_const_string(SNUM(conn
), "full_audit",
394 result
= talloc_sub_advanced(ctx
,
395 lp_servicename(SNUM(conn
)),
396 conn
->server_info
->unix_name
,
398 conn
->server_info
->utok
.gid
,
399 conn
->server_info
->sanitized_username
,
400 conn
->server_info
->info3
->base
.domain
.string
,
406 static bool log_success(vfs_handle_struct
*handle
, vfs_op_type op
)
408 struct vfs_full_audit_private_data
*pd
= NULL
;
410 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
411 struct vfs_full_audit_private_data
,
414 if (pd
->success_ops
== NULL
) {
418 return bitmap_query(pd
->success_ops
, op
);
421 static bool log_failure(vfs_handle_struct
*handle
, vfs_op_type op
)
423 struct vfs_full_audit_private_data
*pd
= NULL
;
425 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
426 struct vfs_full_audit_private_data
,
429 if (pd
->failure_ops
== NULL
)
432 return bitmap_query(pd
->failure_ops
, op
);
435 static struct bitmap
*init_bitmap(TALLOC_CTX
*mem_ctx
, const char **ops
)
443 bm
= bitmap_talloc(mem_ctx
, SMB_VFS_OP_LAST
);
445 DEBUG(0, ("Could not alloc bitmap -- "
446 "defaulting to logging everything\n"));
450 for (; *ops
!= NULL
; ops
+= 1) {
455 if (strequal(*ops
, "all")) {
456 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
462 if (strequal(*ops
, "none")) {
472 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
473 if (vfs_op_names
[i
].name
== NULL
) {
474 smb_panic("vfs_full_audit.c: name table not "
475 "in sync with vfs.h\n");
477 if (strequal(op
, vfs_op_names
[i
].name
)) {
486 if (i
== SMB_VFS_OP_LAST
) {
487 DEBUG(0, ("Could not find opname %s, logging all\n",
496 static const char *audit_opname(vfs_op_type op
)
498 if (op
>= SMB_VFS_OP_LAST
)
499 return "INVALID VFS OP";
500 return vfs_op_names
[op
].name
;
503 static TALLOC_CTX
*tmp_do_log_ctx
;
505 * Get us a temporary talloc context usable just for DEBUG arguments
507 static TALLOC_CTX
*do_log_ctx(void)
509 if (tmp_do_log_ctx
== NULL
) {
510 tmp_do_log_ctx
= talloc_named_const(NULL
, 0, "do_log_ctx");
512 return tmp_do_log_ctx
;
515 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
516 const char *format
, ...)
519 char *audit_pre
= NULL
;
524 if (success
&& (!log_success(handle
, op
)))
527 if (!success
&& (!log_failure(handle
, op
)))
531 fstrcpy(err_msg
, "ok");
533 fstr_sprintf(err_msg
, "fail (%s)", strerror(errno
));
535 va_start(ap
, format
);
536 op_msg
= talloc_vasprintf(talloc_tos(), format
, ap
);
544 * Specify the facility to interoperate with other syslog callers
545 * (smbd for example).
547 priority
= audit_syslog_priority(handle
) |
548 audit_syslog_facility(handle
);
550 audit_pre
= audit_prefix(talloc_tos(), handle
->conn
);
551 syslog(priority
, "%s|%s|%s|%s\n",
552 audit_pre
? audit_pre
: "",
553 audit_opname(op
), err_msg
, op_msg
);
556 TALLOC_FREE(audit_pre
);
558 TALLOC_FREE(tmp_do_log_ctx
);
564 * Return a string using the do_log_ctx()
566 static const char *smb_fname_str_do_log(const struct smb_filename
*smb_fname
)
571 if (smb_fname
== NULL
) {
574 status
= get_full_smb_filename(do_log_ctx(), smb_fname
, &fname
);
575 if (!NT_STATUS_IS_OK(status
)) {
582 * Return an fsp debug string using the do_log_ctx()
584 static const char *fsp_str_do_log(const struct files_struct
*fsp
)
586 return smb_fname_str_do_log(fsp
->fsp_name
);
589 /* Implementation of vfs_ops. Pass everything on to the default
590 operation but log event first. */
592 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
593 const char *svc
, const char *user
)
596 struct vfs_full_audit_private_data
*pd
= NULL
;
598 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
603 pd
= TALLOC_ZERO_P(handle
, struct vfs_full_audit_private_data
);
605 SMB_VFS_NEXT_DISCONNECT(handle
);
610 openlog("smbd_audit", 0, audit_syslog_facility(handle
));
613 pd
->success_ops
= init_bitmap(
614 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
616 pd
->failure_ops
= init_bitmap(
617 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
620 /* Store the private data. */
621 SMB_VFS_HANDLE_SET_DATA(handle
, pd
, NULL
,
622 struct vfs_full_audit_private_data
, return -1);
624 do_log(SMB_VFS_OP_CONNECT
, True
, handle
,
630 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
)
632 SMB_VFS_NEXT_DISCONNECT(handle
);
634 do_log(SMB_VFS_OP_DISCONNECT
, True
, handle
,
635 "%s", lp_servicename(SNUM(handle
->conn
)));
637 /* The bitmaps will be disconnected when the private
643 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
645 bool small_query
, uint64_t *bsize
,
646 uint64_t *dfree
, uint64_t *dsize
)
650 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
653 /* Don't have a reasonable notion of failure here */
655 do_log(SMB_VFS_OP_DISK_FREE
, True
, handle
, "%s", path
);
660 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
661 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
666 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
668 do_log(SMB_VFS_OP_GET_QUOTA
, (result
>= 0), handle
, "");
674 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
675 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
680 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
682 do_log(SMB_VFS_OP_SET_QUOTA
, (result
>= 0), handle
, "");
687 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
688 struct files_struct
*fsp
,
689 SHADOW_COPY_DATA
*shadow_copy_data
, bool labels
)
693 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
, labels
);
695 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA
, (result
>= 0), handle
, "");
700 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
702 struct vfs_statvfs_struct
*statbuf
)
706 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
708 do_log(SMB_VFS_OP_STATVFS
, (result
>= 0), handle
, "");
713 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
, enum timestamp_set_resolution
*p_ts_res
)
717 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
719 do_log(SMB_VFS_OP_FS_CAPABILITIES
, true, handle
, "");
724 static SMB_STRUCT_DIR
*smb_full_audit_opendir(vfs_handle_struct
*handle
,
725 const char *fname
, const char *mask
, uint32 attr
)
727 SMB_STRUCT_DIR
*result
;
729 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
731 do_log(SMB_VFS_OP_OPENDIR
, (result
!= NULL
), handle
, "%s", fname
);
736 static SMB_STRUCT_DIRENT
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
737 SMB_STRUCT_DIR
*dirp
, SMB_STRUCT_STAT
*sbuf
)
739 SMB_STRUCT_DIRENT
*result
;
741 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
743 /* This operation has no reasonable error condition
744 * (End of dir is also failure), so always succeed.
746 do_log(SMB_VFS_OP_READDIR
, True
, handle
, "");
751 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
752 SMB_STRUCT_DIR
*dirp
, long offset
)
754 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
756 do_log(SMB_VFS_OP_SEEKDIR
, True
, handle
, "");
760 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
761 SMB_STRUCT_DIR
*dirp
)
765 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
767 do_log(SMB_VFS_OP_TELLDIR
, True
, handle
, "");
772 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
773 SMB_STRUCT_DIR
*dirp
)
775 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
777 do_log(SMB_VFS_OP_REWINDDIR
, True
, handle
, "");
781 static int smb_full_audit_mkdir(vfs_handle_struct
*handle
,
782 const char *path
, mode_t mode
)
786 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
788 do_log(SMB_VFS_OP_MKDIR
, (result
>= 0), handle
, "%s", path
);
793 static int smb_full_audit_rmdir(vfs_handle_struct
*handle
,
798 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
800 do_log(SMB_VFS_OP_RMDIR
, (result
>= 0), handle
, "%s", path
);
805 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
806 SMB_STRUCT_DIR
*dirp
)
810 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
812 do_log(SMB_VFS_OP_CLOSEDIR
, (result
>= 0), handle
, "");
817 static void smb_full_audit_init_search_op(vfs_handle_struct
*handle
,
818 SMB_STRUCT_DIR
*dirp
)
820 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
822 do_log(SMB_VFS_OP_INIT_SEARCH_OP
, True
, handle
, "");
826 static int smb_full_audit_open(vfs_handle_struct
*handle
,
827 struct smb_filename
*smb_fname
,
828 files_struct
*fsp
, int flags
, mode_t mode
)
832 result
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
834 do_log(SMB_VFS_OP_OPEN
, (result
>= 0), handle
, "%s|%s",
835 ((flags
& O_WRONLY
) || (flags
& O_RDWR
))?"w":"r",
836 smb_fname_str_do_log(smb_fname
));
841 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
842 struct smb_request
*req
,
843 uint16_t root_dir_fid
,
844 struct smb_filename
*smb_fname
,
845 uint32_t access_mask
,
846 uint32_t share_access
,
847 uint32_t create_disposition
,
848 uint32_t create_options
,
849 uint32_t file_attributes
,
850 uint32_t oplock_request
,
851 uint64_t allocation_size
,
852 uint32_t private_flags
,
853 struct security_descriptor
*sd
,
854 struct ea_list
*ea_list
,
855 files_struct
**result_fsp
,
859 const char* str_create_disposition
;
861 switch (create_disposition
) {
863 str_create_disposition
= "supersede";
865 case FILE_OVERWRITE_IF
:
866 str_create_disposition
= "overwrite_if";
869 str_create_disposition
= "open";
872 str_create_disposition
= "overwrite";
875 str_create_disposition
= "create";
878 str_create_disposition
= "open_if";
881 str_create_disposition
= "unknown";
884 result
= SMB_VFS_NEXT_CREATE_FILE(
887 root_dir_fid
, /* root_dir_fid */
888 smb_fname
, /* fname */
889 access_mask
, /* access_mask */
890 share_access
, /* share_access */
891 create_disposition
, /* create_disposition*/
892 create_options
, /* create_options */
893 file_attributes
, /* file_attributes */
894 oplock_request
, /* oplock_request */
895 allocation_size
, /* allocation_size */
898 ea_list
, /* ea_list */
899 result_fsp
, /* result */
902 do_log(SMB_VFS_OP_CREATE_FILE
, (NT_STATUS_IS_OK(result
)), handle
,
903 "0x%x|%s|%s|%s", access_mask
,
904 create_options
& FILE_DIRECTORY_FILE
? "dir" : "file",
905 str_create_disposition
, smb_fname_str_do_log(smb_fname
));
910 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
914 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
916 do_log(SMB_VFS_OP_CLOSE
, (result
>= 0), handle
, "%s",
917 fsp_str_do_log(fsp
));
922 static ssize_t
smb_full_audit_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
923 void *data
, size_t n
)
927 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
929 do_log(SMB_VFS_OP_READ
, (result
>= 0), handle
, "%s",
930 fsp_str_do_log(fsp
));
935 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
936 void *data
, size_t n
, SMB_OFF_T offset
)
940 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
942 do_log(SMB_VFS_OP_PREAD
, (result
>= 0), handle
, "%s",
943 fsp_str_do_log(fsp
));
948 static ssize_t
smb_full_audit_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
949 const void *data
, size_t n
)
953 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
955 do_log(SMB_VFS_OP_WRITE
, (result
>= 0), handle
, "%s",
956 fsp_str_do_log(fsp
));
961 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
962 const void *data
, size_t n
,
967 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
969 do_log(SMB_VFS_OP_PWRITE
, (result
>= 0), handle
, "%s",
970 fsp_str_do_log(fsp
));
975 static SMB_OFF_T
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
976 SMB_OFF_T offset
, int whence
)
980 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
982 do_log(SMB_VFS_OP_LSEEK
, (result
!= (ssize_t
)-1), handle
,
983 "%s", fsp_str_do_log(fsp
));
988 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
989 files_struct
*fromfsp
,
990 const DATA_BLOB
*hdr
, SMB_OFF_T offset
,
995 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
997 do_log(SMB_VFS_OP_SENDFILE
, (result
>= 0), handle
,
998 "%s", fsp_str_do_log(fromfsp
));
1003 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
1004 files_struct
*tofsp
,
1010 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
1012 do_log(SMB_VFS_OP_RECVFILE
, (result
>= 0), handle
,
1013 "%s", fsp_str_do_log(tofsp
));
1018 static int smb_full_audit_rename(vfs_handle_struct
*handle
,
1019 const struct smb_filename
*smb_fname_src
,
1020 const struct smb_filename
*smb_fname_dst
)
1024 result
= SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
1026 do_log(SMB_VFS_OP_RENAME
, (result
>= 0), handle
, "%s|%s",
1027 smb_fname_str_do_log(smb_fname_src
),
1028 smb_fname_str_do_log(smb_fname_dst
));
1033 static int smb_full_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
1037 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
1039 do_log(SMB_VFS_OP_FSYNC
, (result
>= 0), handle
, "%s",
1040 fsp_str_do_log(fsp
));
1045 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
1046 struct smb_filename
*smb_fname
)
1050 result
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
1052 do_log(SMB_VFS_OP_STAT
, (result
>= 0), handle
, "%s",
1053 smb_fname_str_do_log(smb_fname
));
1058 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1059 SMB_STRUCT_STAT
*sbuf
)
1063 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1065 do_log(SMB_VFS_OP_FSTAT
, (result
>= 0), handle
, "%s",
1066 fsp_str_do_log(fsp
));
1071 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
1072 struct smb_filename
*smb_fname
)
1076 result
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
1078 do_log(SMB_VFS_OP_LSTAT
, (result
>= 0), handle
, "%s",
1079 smb_fname_str_do_log(smb_fname
));
1084 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
1085 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
1089 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1091 do_log(SMB_VFS_OP_GET_ALLOC_SIZE
, (result
!= (uint64_t)-1), handle
,
1097 static int smb_full_audit_unlink(vfs_handle_struct
*handle
,
1098 const struct smb_filename
*smb_fname
)
1102 result
= SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
1104 do_log(SMB_VFS_OP_UNLINK
, (result
>= 0), handle
, "%s",
1105 smb_fname_str_do_log(smb_fname
));
1110 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
1111 const char *path
, mode_t mode
)
1115 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1117 do_log(SMB_VFS_OP_CHMOD
, (result
>= 0), handle
, "%s|%o", path
, mode
);
1122 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1127 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1129 do_log(SMB_VFS_OP_FCHMOD
, (result
>= 0), handle
,
1130 "%s|%o", fsp_str_do_log(fsp
), mode
);
1135 static int smb_full_audit_chown(vfs_handle_struct
*handle
,
1136 const char *path
, uid_t uid
, gid_t gid
)
1140 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1142 do_log(SMB_VFS_OP_CHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1143 path
, (long int)uid
, (long int)gid
);
1148 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1149 uid_t uid
, gid_t gid
)
1153 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1155 do_log(SMB_VFS_OP_FCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1156 fsp_str_do_log(fsp
), (long int)uid
, (long int)gid
);
1161 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
1162 const char *path
, uid_t uid
, gid_t gid
)
1166 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1168 do_log(SMB_VFS_OP_LCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1169 path
, (long int)uid
, (long int)gid
);
1174 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
1179 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
1181 do_log(SMB_VFS_OP_CHDIR
, (result
>= 0), handle
, "chdir|%s", path
);
1186 static char *smb_full_audit_getwd(vfs_handle_struct
*handle
,
1191 result
= SMB_VFS_NEXT_GETWD(handle
, path
);
1193 do_log(SMB_VFS_OP_GETWD
, (result
!= NULL
), handle
, "%s", path
);
1198 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
1199 const struct smb_filename
*smb_fname
,
1200 struct smb_file_time
*ft
)
1204 result
= SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
1206 do_log(SMB_VFS_OP_NTIMES
, (result
>= 0), handle
, "%s",
1207 smb_fname_str_do_log(smb_fname
));
1212 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1217 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1219 do_log(SMB_VFS_OP_FTRUNCATE
, (result
>= 0), handle
,
1220 "%s", fsp_str_do_log(fsp
));
1225 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1226 int op
, SMB_OFF_T offset
, SMB_OFF_T count
, int type
)
1230 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1232 do_log(SMB_VFS_OP_LOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1237 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1238 struct files_struct
*fsp
,
1239 uint32 share_mode
, uint32 access_mask
)
1243 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
1245 do_log(SMB_VFS_OP_KERNEL_FLOCK
, (result
>= 0), handle
, "%s",
1246 fsp_str_do_log(fsp
));
1251 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1256 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1258 do_log(SMB_VFS_OP_LINUX_SETLEASE
, (result
>= 0), handle
, "%s",
1259 fsp_str_do_log(fsp
));
1264 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1265 SMB_OFF_T
*poffset
, SMB_OFF_T
*pcount
, int *ptype
, pid_t
*ppid
)
1269 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
1271 do_log(SMB_VFS_OP_GETLOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1276 static int smb_full_audit_symlink(vfs_handle_struct
*handle
,
1277 const char *oldpath
, const char *newpath
)
1281 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1283 do_log(SMB_VFS_OP_SYMLINK
, (result
>= 0), handle
,
1284 "%s|%s", oldpath
, newpath
);
1289 static int smb_full_audit_readlink(vfs_handle_struct
*handle
,
1290 const char *path
, char *buf
, size_t bufsiz
)
1294 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1296 do_log(SMB_VFS_OP_READLINK
, (result
>= 0), handle
, "%s", path
);
1301 static int smb_full_audit_link(vfs_handle_struct
*handle
,
1302 const char *oldpath
, const char *newpath
)
1306 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
1308 do_log(SMB_VFS_OP_LINK
, (result
>= 0), handle
,
1309 "%s|%s", oldpath
, newpath
);
1314 static int smb_full_audit_mknod(vfs_handle_struct
*handle
,
1315 const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1319 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1321 do_log(SMB_VFS_OP_MKNOD
, (result
>= 0), handle
, "%s", pathname
);
1326 static char *smb_full_audit_realpath(vfs_handle_struct
*handle
,
1327 const char *path
, char *resolved_path
)
1331 result
= SMB_VFS_NEXT_REALPATH(handle
, path
, resolved_path
);
1333 do_log(SMB_VFS_OP_REALPATH
, (result
!= NULL
), handle
, "%s", path
);
1338 static NTSTATUS
smb_full_audit_notify_watch(struct vfs_handle_struct
*handle
,
1339 struct sys_notify_context
*ctx
,
1340 struct notify_entry
*e
,
1341 void (*callback
)(struct sys_notify_context
*ctx
,
1343 struct notify_event
*ev
),
1344 void *private_data
, void *handle_p
)
1348 result
= SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, e
, callback
, private_data
, handle_p
);
1350 do_log(SMB_VFS_OP_NOTIFY_WATCH
, NT_STATUS_IS_OK(result
), handle
, "");
1355 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
1356 const char *path
, unsigned int flags
)
1360 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1362 do_log(SMB_VFS_OP_CHFLAGS
, (result
!= 0), handle
, "%s", path
);
1367 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
1368 const SMB_STRUCT_STAT
*sbuf
)
1370 struct file_id id_zero
;
1371 struct file_id result
;
1373 ZERO_STRUCT(id_zero
);
1375 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1377 do_log(SMB_VFS_OP_FILE_ID_CREATE
,
1378 !file_id_equal(&id_zero
, &result
),
1379 handle
, "%s", file_id_string_tos(&result
));
1384 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
1385 struct files_struct
*fsp
,
1387 TALLOC_CTX
*mem_ctx
,
1388 unsigned int *pnum_streams
,
1389 struct stream_struct
**pstreams
)
1393 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1394 pnum_streams
, pstreams
);
1396 do_log(SMB_VFS_OP_STREAMINFO
, NT_STATUS_IS_OK(result
), handle
,
1402 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1405 TALLOC_CTX
*mem_ctx
,
1410 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
1413 do_log(SMB_VFS_OP_GET_REAL_FILENAME
, (result
== 0), handle
,
1414 "%s/%s->%s", path
, name
, (result
== 0) ? "" : *found_name
);
1419 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
1424 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1426 do_log(SMB_VFS_OP_CONNECTPATH
, result
!= NULL
, handle
,
1432 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1433 struct byte_range_lock
*br_lck
,
1434 struct lock_struct
*plock
,
1436 struct blocking_lock_record
*blr
)
1440 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1441 blocking_lock
, blr
);
1443 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS
, NT_STATUS_IS_OK(result
), handle
,
1444 "%s:%llu-%llu. type=%d. blocking=%d", fsp_str_do_log(br_lck
->fsp
),
1445 plock
->start
, plock
->size
, plock
->lock_type
, blocking_lock
);
1450 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1451 struct messaging_context
*msg_ctx
,
1452 struct byte_range_lock
*br_lck
,
1453 const struct lock_struct
*plock
)
1457 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1460 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, (result
== 0), handle
,
1461 "%s:%llu-%llu:%d", fsp_str_do_log(br_lck
->fsp
), plock
->start
,
1462 plock
->size
, plock
->lock_type
);
1467 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1468 struct byte_range_lock
*br_lck
,
1469 struct lock_struct
*plock
,
1470 struct blocking_lock_record
*blr
)
1474 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
, blr
);
1476 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS
, (result
== 0), handle
,
1477 "%s:%llu-%llu:%d", fsp_str_do_log(br_lck
->fsp
), plock
->start
,
1483 static bool smb_full_audit_strict_lock(struct vfs_handle_struct
*handle
,
1484 struct files_struct
*fsp
,
1485 struct lock_struct
*plock
)
1489 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1491 do_log(SMB_VFS_OP_STRICT_LOCK
, result
, handle
,
1492 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1498 static void smb_full_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1499 struct files_struct
*fsp
,
1500 struct lock_struct
*plock
)
1502 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1504 do_log(SMB_VFS_OP_STRICT_UNLOCK
, true, handle
,
1505 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1511 static NTSTATUS
smb_full_audit_translate_name(struct vfs_handle_struct
*handle
,
1513 enum vfs_translate_direction direction
,
1514 TALLOC_CTX
*mem_ctx
,
1519 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
1522 do_log(SMB_VFS_OP_TRANSLATE_NAME
, NT_STATUS_IS_OK(result
), handle
, "");
1527 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1528 uint32 security_info
,
1529 struct security_descriptor
**ppdesc
)
1533 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, ppdesc
);
1535 do_log(SMB_VFS_OP_FGET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1536 "%s", fsp_str_do_log(fsp
));
1541 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
1543 uint32 security_info
,
1544 struct security_descriptor
**ppdesc
)
1548 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, ppdesc
);
1550 do_log(SMB_VFS_OP_GET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1556 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1557 uint32 security_info_sent
,
1558 const struct security_descriptor
*psd
)
1562 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
1564 do_log(SMB_VFS_OP_FSET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
, "%s",
1565 fsp_str_do_log(fsp
));
1570 static int smb_full_audit_chmod_acl(vfs_handle_struct
*handle
,
1571 const char *path
, mode_t mode
)
1575 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1577 do_log(SMB_VFS_OP_CHMOD_ACL
, (result
>= 0), handle
,
1578 "%s|%o", path
, mode
);
1583 static int smb_full_audit_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1588 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1590 do_log(SMB_VFS_OP_FCHMOD_ACL
, (result
>= 0), handle
,
1591 "%s|%o", fsp_str_do_log(fsp
), mode
);
1596 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct
*handle
,
1598 SMB_ACL_T theacl
, int entry_id
,
1599 SMB_ACL_ENTRY_T
*entry_p
)
1603 result
= SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle
, theacl
, entry_id
,
1606 do_log(SMB_VFS_OP_SYS_ACL_GET_ENTRY
, (result
>= 0), handle
,
1612 static int smb_full_audit_sys_acl_get_tag_type(vfs_handle_struct
*handle
,
1614 SMB_ACL_ENTRY_T entry_d
,
1615 SMB_ACL_TAG_T
*tag_type_p
)
1619 result
= SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle
, entry_d
,
1622 do_log(SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, (result
>= 0), handle
,
1628 static int smb_full_audit_sys_acl_get_permset(vfs_handle_struct
*handle
,
1630 SMB_ACL_ENTRY_T entry_d
,
1631 SMB_ACL_PERMSET_T
*permset_p
)
1635 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle
, entry_d
,
1638 do_log(SMB_VFS_OP_SYS_ACL_GET_PERMSET
, (result
>= 0), handle
,
1644 static void * smb_full_audit_sys_acl_get_qualifier(vfs_handle_struct
*handle
,
1646 SMB_ACL_ENTRY_T entry_d
)
1650 result
= SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle
, entry_d
);
1652 do_log(SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, (result
!= NULL
), handle
,
1658 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1660 SMB_ACL_TYPE_T type
)
1664 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
);
1666 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE
, (result
!= NULL
), handle
,
1672 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
1677 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
);
1679 do_log(SMB_VFS_OP_SYS_ACL_GET_FD
, (result
!= NULL
), handle
,
1680 "%s", fsp_str_do_log(fsp
));
1685 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct
*handle
,
1687 SMB_ACL_PERMSET_T permset
)
1691 result
= SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle
, permset
);
1693 do_log(SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, (result
>= 0), handle
,
1699 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct
*handle
,
1701 SMB_ACL_PERMSET_T permset
,
1702 SMB_ACL_PERM_T perm
)
1706 result
= SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle
, permset
, perm
);
1708 do_log(SMB_VFS_OP_SYS_ACL_ADD_PERM
, (result
>= 0), handle
,
1714 static char * smb_full_audit_sys_acl_to_text(vfs_handle_struct
*handle
,
1720 result
= SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle
, theacl
, plen
);
1722 do_log(SMB_VFS_OP_SYS_ACL_TO_TEXT
, (result
!= NULL
), handle
,
1728 static SMB_ACL_T
smb_full_audit_sys_acl_init(vfs_handle_struct
*handle
,
1734 result
= SMB_VFS_NEXT_SYS_ACL_INIT(handle
, count
);
1736 do_log(SMB_VFS_OP_SYS_ACL_INIT
, (result
!= NULL
), handle
,
1742 static int smb_full_audit_sys_acl_create_entry(vfs_handle_struct
*handle
,
1744 SMB_ACL_ENTRY_T
*pentry
)
1748 result
= SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle
, pacl
, pentry
);
1750 do_log(SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, (result
>= 0), handle
,
1756 static int smb_full_audit_sys_acl_set_tag_type(vfs_handle_struct
*handle
,
1758 SMB_ACL_ENTRY_T entry
,
1759 SMB_ACL_TAG_T tagtype
)
1763 result
= SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle
, entry
,
1766 do_log(SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, (result
>= 0), handle
,
1772 static int smb_full_audit_sys_acl_set_qualifier(vfs_handle_struct
*handle
,
1774 SMB_ACL_ENTRY_T entry
,
1779 result
= SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle
, entry
, qual
);
1781 do_log(SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, (result
>= 0), handle
,
1787 static int smb_full_audit_sys_acl_set_permset(vfs_handle_struct
*handle
,
1789 SMB_ACL_ENTRY_T entry
,
1790 SMB_ACL_PERMSET_T permset
)
1794 result
= SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle
, entry
, permset
);
1796 do_log(SMB_VFS_OP_SYS_ACL_SET_PERMSET
, (result
>= 0), handle
,
1802 static int smb_full_audit_sys_acl_valid(vfs_handle_struct
*handle
,
1808 result
= SMB_VFS_NEXT_SYS_ACL_VALID(handle
, theacl
);
1810 do_log(SMB_VFS_OP_SYS_ACL_VALID
, (result
>= 0), handle
,
1816 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
1818 const char *name
, SMB_ACL_TYPE_T acltype
,
1823 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
1826 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE
, (result
>= 0), handle
,
1832 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
1837 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
1839 do_log(SMB_VFS_OP_SYS_ACL_SET_FD
, (result
>= 0), handle
,
1840 "%s", fsp_str_do_log(fsp
));
1845 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
1851 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
1853 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, (result
>= 0), handle
,
1859 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct
*handle
,
1861 SMB_ACL_PERMSET_T permset
,
1862 SMB_ACL_PERM_T perm
)
1866 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle
, permset
, perm
);
1868 do_log(SMB_VFS_OP_SYS_ACL_GET_PERM
, (result
>= 0), handle
,
1874 static int smb_full_audit_sys_acl_free_text(vfs_handle_struct
*handle
,
1880 result
= SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle
, text
);
1882 do_log(SMB_VFS_OP_SYS_ACL_FREE_TEXT
, (result
>= 0), handle
,
1888 static int smb_full_audit_sys_acl_free_acl(vfs_handle_struct
*handle
,
1890 SMB_ACL_T posix_acl
)
1894 result
= SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle
, posix_acl
);
1896 do_log(SMB_VFS_OP_SYS_ACL_FREE_ACL
, (result
>= 0), handle
,
1902 static int smb_full_audit_sys_acl_free_qualifier(vfs_handle_struct
*handle
,
1904 SMB_ACL_TAG_T tagtype
)
1908 result
= SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle
, qualifier
,
1911 do_log(SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, (result
>= 0), handle
,
1917 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
1919 const char *name
, void *value
, size_t size
)
1923 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
1925 do_log(SMB_VFS_OP_GETXATTR
, (result
>= 0), handle
,
1926 "%s|%s", path
, name
);
1931 static ssize_t
smb_full_audit_lgetxattr(struct vfs_handle_struct
*handle
,
1932 const char *path
, const char *name
,
1933 void *value
, size_t size
)
1937 result
= SMB_VFS_NEXT_LGETXATTR(handle
, path
, name
, value
, size
);
1939 do_log(SMB_VFS_OP_LGETXATTR
, (result
>= 0), handle
,
1940 "%s|%s", path
, name
);
1945 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
1946 struct files_struct
*fsp
,
1947 const char *name
, void *value
, size_t size
)
1951 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
1953 do_log(SMB_VFS_OP_FGETXATTR
, (result
>= 0), handle
,
1954 "%s|%s", fsp_str_do_log(fsp
), name
);
1959 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
1960 const char *path
, char *list
, size_t size
)
1964 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
1966 do_log(SMB_VFS_OP_LISTXATTR
, (result
>= 0), handle
, "%s", path
);
1971 static ssize_t
smb_full_audit_llistxattr(struct vfs_handle_struct
*handle
,
1972 const char *path
, char *list
, size_t size
)
1976 result
= SMB_VFS_NEXT_LLISTXATTR(handle
, path
, list
, size
);
1978 do_log(SMB_VFS_OP_LLISTXATTR
, (result
>= 0), handle
, "%s", path
);
1983 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
1984 struct files_struct
*fsp
, char *list
,
1989 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
1991 do_log(SMB_VFS_OP_FLISTXATTR
, (result
>= 0), handle
,
1992 "%s", fsp_str_do_log(fsp
));
1997 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
2003 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2005 do_log(SMB_VFS_OP_REMOVEXATTR
, (result
>= 0), handle
,
2006 "%s|%s", path
, name
);
2011 static int smb_full_audit_lremovexattr(struct vfs_handle_struct
*handle
,
2017 result
= SMB_VFS_NEXT_LREMOVEXATTR(handle
, path
, name
);
2019 do_log(SMB_VFS_OP_LREMOVEXATTR
, (result
>= 0), handle
,
2020 "%s|%s", path
, name
);
2025 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2026 struct files_struct
*fsp
,
2031 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2033 do_log(SMB_VFS_OP_FREMOVEXATTR
, (result
>= 0), handle
,
2034 "%s|%s", fsp_str_do_log(fsp
), name
);
2039 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
2041 const char *name
, const void *value
, size_t size
,
2046 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
2049 do_log(SMB_VFS_OP_SETXATTR
, (result
>= 0), handle
,
2050 "%s|%s", path
, name
);
2055 static int smb_full_audit_lsetxattr(struct vfs_handle_struct
*handle
,
2057 const char *name
, const void *value
, size_t size
,
2062 result
= SMB_VFS_NEXT_LSETXATTR(handle
, path
, name
, value
, size
,
2065 do_log(SMB_VFS_OP_LSETXATTR
, (result
>= 0), handle
,
2066 "%s|%s", path
, name
);
2071 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2072 struct files_struct
*fsp
, const char *name
,
2073 const void *value
, size_t size
, int flags
)
2077 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2079 do_log(SMB_VFS_OP_FSETXATTR
, (result
>= 0), handle
,
2080 "%s|%s", fsp_str_do_log(fsp
), name
);
2085 static int smb_full_audit_aio_read(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2089 result
= SMB_VFS_NEXT_AIO_READ(handle
, fsp
, aiocb
);
2090 do_log(SMB_VFS_OP_AIO_READ
, (result
>= 0), handle
,
2091 "%s", fsp_str_do_log(fsp
));
2096 static int smb_full_audit_aio_write(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2100 result
= SMB_VFS_NEXT_AIO_WRITE(handle
, fsp
, aiocb
);
2101 do_log(SMB_VFS_OP_AIO_WRITE
, (result
>= 0), handle
,
2102 "%s", fsp_str_do_log(fsp
));
2107 static ssize_t
smb_full_audit_aio_return(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2111 result
= SMB_VFS_NEXT_AIO_RETURN(handle
, fsp
, aiocb
);
2112 do_log(SMB_VFS_OP_AIO_RETURN
, (result
>= 0), handle
,
2113 "%s", fsp_str_do_log(fsp
));
2118 static int smb_full_audit_aio_cancel(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2122 result
= SMB_VFS_NEXT_AIO_CANCEL(handle
, fsp
, aiocb
);
2123 do_log(SMB_VFS_OP_AIO_CANCEL
, (result
>= 0), handle
,
2124 "%s", fsp_str_do_log(fsp
));
2129 static int smb_full_audit_aio_error(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, SMB_STRUCT_AIOCB
*aiocb
)
2133 result
= SMB_VFS_NEXT_AIO_ERROR(handle
, fsp
, aiocb
);
2134 do_log(SMB_VFS_OP_AIO_ERROR
, (result
>= 0), handle
,
2135 "%s", fsp_str_do_log(fsp
));
2140 static int smb_full_audit_aio_fsync(struct vfs_handle_struct
*handle
, struct files_struct
*fsp
, int op
, SMB_STRUCT_AIOCB
*aiocb
)
2144 result
= SMB_VFS_NEXT_AIO_FSYNC(handle
, fsp
, op
, aiocb
);
2145 do_log(SMB_VFS_OP_AIO_FSYNC
, (result
>= 0), handle
,
2146 "%s", fsp_str_do_log(fsp
));
2151 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
)
2155 result
= SMB_VFS_NEXT_AIO_SUSPEND(handle
, fsp
, aiocb
, n
, ts
);
2156 do_log(SMB_VFS_OP_AIO_SUSPEND
, (result
>= 0), handle
,
2157 "%s", fsp_str_do_log(fsp
));
2162 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
2163 struct files_struct
*fsp
)
2167 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2168 do_log(SMB_VFS_OP_AIO_FORCE
, result
, handle
,
2169 "%s", fsp_str_do_log(fsp
));
2174 static struct vfs_fn_pointers vfs_full_audit_fns
= {
2176 /* Disk operations */
2178 .connect_fn
= smb_full_audit_connect
,
2179 .disconnect
= smb_full_audit_disconnect
,
2180 .disk_free
= smb_full_audit_disk_free
,
2181 .get_quota
= smb_full_audit_get_quota
,
2182 .set_quota
= smb_full_audit_set_quota
,
2183 .get_shadow_copy_data
= smb_full_audit_get_shadow_copy_data
,
2184 .statvfs
= smb_full_audit_statvfs
,
2185 .fs_capabilities
= smb_full_audit_fs_capabilities
,
2186 .opendir
= smb_full_audit_opendir
,
2187 .readdir
= smb_full_audit_readdir
,
2188 .seekdir
= smb_full_audit_seekdir
,
2189 .telldir
= smb_full_audit_telldir
,
2190 .rewind_dir
= smb_full_audit_rewinddir
,
2191 .mkdir
= smb_full_audit_mkdir
,
2192 .rmdir
= smb_full_audit_rmdir
,
2193 .closedir
= smb_full_audit_closedir
,
2194 .init_search_op
= smb_full_audit_init_search_op
,
2195 .open
= smb_full_audit_open
,
2196 .create_file
= smb_full_audit_create_file
,
2197 .close_fn
= smb_full_audit_close
,
2198 .vfs_read
= smb_full_audit_read
,
2199 .pread
= smb_full_audit_pread
,
2200 .write
= smb_full_audit_write
,
2201 .pwrite
= smb_full_audit_pwrite
,
2202 .lseek
= smb_full_audit_lseek
,
2203 .sendfile
= smb_full_audit_sendfile
,
2204 .recvfile
= smb_full_audit_recvfile
,
2205 .rename
= smb_full_audit_rename
,
2206 .fsync
= smb_full_audit_fsync
,
2207 .stat
= smb_full_audit_stat
,
2208 .fstat
= smb_full_audit_fstat
,
2209 .lstat
= smb_full_audit_lstat
,
2210 .get_alloc_size
= smb_full_audit_get_alloc_size
,
2211 .unlink
= smb_full_audit_unlink
,
2212 .chmod
= smb_full_audit_chmod
,
2213 .fchmod
= smb_full_audit_fchmod
,
2214 .chown
= smb_full_audit_chown
,
2215 .fchown
= smb_full_audit_fchown
,
2216 .lchown
= smb_full_audit_lchown
,
2217 .chdir
= smb_full_audit_chdir
,
2218 .getwd
= smb_full_audit_getwd
,
2219 .ntimes
= smb_full_audit_ntimes
,
2220 .ftruncate
= smb_full_audit_ftruncate
,
2221 .lock
= smb_full_audit_lock
,
2222 .kernel_flock
= smb_full_audit_kernel_flock
,
2223 .linux_setlease
= smb_full_audit_linux_setlease
,
2224 .getlock
= smb_full_audit_getlock
,
2225 .symlink
= smb_full_audit_symlink
,
2226 .vfs_readlink
= smb_full_audit_readlink
,
2227 .link
= smb_full_audit_link
,
2228 .mknod
= smb_full_audit_mknod
,
2229 .realpath
= smb_full_audit_realpath
,
2230 .notify_watch
= smb_full_audit_notify_watch
,
2231 .chflags
= smb_full_audit_chflags
,
2232 .file_id_create
= smb_full_audit_file_id_create
,
2233 .streaminfo
= smb_full_audit_streaminfo
,
2234 .get_real_filename
= smb_full_audit_get_real_filename
,
2235 .connectpath
= smb_full_audit_connectpath
,
2236 .brl_lock_windows
= smb_full_audit_brl_lock_windows
,
2237 .brl_unlock_windows
= smb_full_audit_brl_unlock_windows
,
2238 .brl_cancel_windows
= smb_full_audit_brl_cancel_windows
,
2239 .strict_lock
= smb_full_audit_strict_lock
,
2240 .strict_unlock
= smb_full_audit_strict_unlock
,
2241 .translate_name
= smb_full_audit_translate_name
,
2242 .fget_nt_acl
= smb_full_audit_fget_nt_acl
,
2243 .get_nt_acl
= smb_full_audit_get_nt_acl
,
2244 .fset_nt_acl
= smb_full_audit_fset_nt_acl
,
2245 .chmod_acl
= smb_full_audit_chmod_acl
,
2246 .fchmod_acl
= smb_full_audit_fchmod_acl
,
2247 .sys_acl_get_entry
= smb_full_audit_sys_acl_get_entry
,
2248 .sys_acl_get_tag_type
= smb_full_audit_sys_acl_get_tag_type
,
2249 .sys_acl_get_permset
= smb_full_audit_sys_acl_get_permset
,
2250 .sys_acl_get_qualifier
= smb_full_audit_sys_acl_get_qualifier
,
2251 .sys_acl_get_file
= smb_full_audit_sys_acl_get_file
,
2252 .sys_acl_get_fd
= smb_full_audit_sys_acl_get_fd
,
2253 .sys_acl_clear_perms
= smb_full_audit_sys_acl_clear_perms
,
2254 .sys_acl_add_perm
= smb_full_audit_sys_acl_add_perm
,
2255 .sys_acl_to_text
= smb_full_audit_sys_acl_to_text
,
2256 .sys_acl_init
= smb_full_audit_sys_acl_init
,
2257 .sys_acl_create_entry
= smb_full_audit_sys_acl_create_entry
,
2258 .sys_acl_set_tag_type
= smb_full_audit_sys_acl_set_tag_type
,
2259 .sys_acl_set_qualifier
= smb_full_audit_sys_acl_set_qualifier
,
2260 .sys_acl_set_permset
= smb_full_audit_sys_acl_set_permset
,
2261 .sys_acl_valid
= smb_full_audit_sys_acl_valid
,
2262 .sys_acl_set_file
= smb_full_audit_sys_acl_set_file
,
2263 .sys_acl_set_fd
= smb_full_audit_sys_acl_set_fd
,
2264 .sys_acl_delete_def_file
= smb_full_audit_sys_acl_delete_def_file
,
2265 .sys_acl_get_perm
= smb_full_audit_sys_acl_get_perm
,
2266 .sys_acl_free_text
= smb_full_audit_sys_acl_free_text
,
2267 .sys_acl_free_acl
= smb_full_audit_sys_acl_free_acl
,
2268 .sys_acl_free_qualifier
= smb_full_audit_sys_acl_free_qualifier
,
2269 .getxattr
= smb_full_audit_getxattr
,
2270 .lgetxattr
= smb_full_audit_lgetxattr
,
2271 .fgetxattr
= smb_full_audit_fgetxattr
,
2272 .listxattr
= smb_full_audit_listxattr
,
2273 .llistxattr
= smb_full_audit_llistxattr
,
2274 .flistxattr
= smb_full_audit_flistxattr
,
2275 .removexattr
= smb_full_audit_removexattr
,
2276 .lremovexattr
= smb_full_audit_lremovexattr
,
2277 .fremovexattr
= smb_full_audit_fremovexattr
,
2278 .setxattr
= smb_full_audit_setxattr
,
2279 .lsetxattr
= smb_full_audit_lsetxattr
,
2280 .fsetxattr
= smb_full_audit_fsetxattr
,
2281 .aio_read
= smb_full_audit_aio_read
,
2282 .aio_write
= smb_full_audit_aio_write
,
2283 .aio_return_fn
= smb_full_audit_aio_return
,
2284 .aio_cancel
= smb_full_audit_aio_cancel
,
2285 .aio_error_fn
= smb_full_audit_aio_error
,
2286 .aio_fsync
= smb_full_audit_aio_fsync
,
2287 .aio_suspend
= smb_full_audit_aio_suspend
,
2288 .aio_force
= smb_full_audit_aio_force
,
2291 NTSTATUS
vfs_full_audit_init(void)
2293 NTSTATUS ret
= smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
2294 "full_audit", &vfs_full_audit_fns
);
2296 if (!NT_STATUS_IS_OK(ret
))
2299 vfs_full_audit_debug_level
= debug_add_class("full_audit");
2300 if (vfs_full_audit_debug_level
== -1) {
2301 vfs_full_audit_debug_level
= DBGC_VFS
;
2302 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2305 DEBUG(10, ("vfs_full_audit: Debug class number of "
2306 "'full_audit': %d\n", vfs_full_audit_debug_level
));