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 "system/filesys.h"
62 #include "system/syslog.h"
63 #include "smbd/smbd.h"
64 #include "../librpc/gen_ndr/ndr_netlogon.h"
67 #include "lib/param/loadparm.h"
68 #include "lib/util/bitmap.h"
69 #include "lib/util/tevent_unix.h"
71 static int vfs_full_audit_debug_level
= DBGC_VFS
;
73 struct vfs_full_audit_private_data
{
74 struct bitmap
*success_ops
;
75 struct bitmap
*failure_ops
;
79 #define DBGC_CLASS vfs_full_audit_debug_level
81 typedef enum _vfs_op_type
{
86 SMB_VFS_OP_CONNECT
= 0,
87 SMB_VFS_OP_DISCONNECT
,
91 SMB_VFS_OP_GET_SHADOW_COPY_DATA
,
93 SMB_VFS_OP_FS_CAPABILITIES
,
95 /* Directory operations */
102 SMB_VFS_OP_REWINDDIR
,
106 SMB_VFS_OP_INIT_SEARCH_OP
,
108 /* File operations */
111 SMB_VFS_OP_CREATE_FILE
,
115 SMB_VFS_OP_PREAD_SEND
,
116 SMB_VFS_OP_PREAD_RECV
,
119 SMB_VFS_OP_PWRITE_SEND
,
120 SMB_VFS_OP_PWRITE_RECV
,
126 SMB_VFS_OP_FSYNC_SEND
,
127 SMB_VFS_OP_FSYNC_RECV
,
131 SMB_VFS_OP_GET_ALLOC_SIZE
,
141 SMB_VFS_OP_FTRUNCATE
,
142 SMB_VFS_OP_FALLOCATE
,
144 SMB_VFS_OP_KERNEL_FLOCK
,
145 SMB_VFS_OP_LINUX_SETLEASE
,
152 SMB_VFS_OP_NOTIFY_WATCH
,
154 SMB_VFS_OP_FILE_ID_CREATE
,
155 SMB_VFS_OP_STREAMINFO
,
156 SMB_VFS_OP_GET_REAL_FILENAME
,
157 SMB_VFS_OP_CONNECTPATH
,
158 SMB_VFS_OP_BRL_LOCK_WINDOWS
,
159 SMB_VFS_OP_BRL_UNLOCK_WINDOWS
,
160 SMB_VFS_OP_BRL_CANCEL_WINDOWS
,
161 SMB_VFS_OP_STRICT_LOCK
,
162 SMB_VFS_OP_STRICT_UNLOCK
,
163 SMB_VFS_OP_TRANSLATE_NAME
,
165 /* NT ACL operations. */
167 SMB_VFS_OP_FGET_NT_ACL
,
168 SMB_VFS_OP_GET_NT_ACL
,
169 SMB_VFS_OP_FSET_NT_ACL
,
171 /* POSIX ACL operations. */
173 SMB_VFS_OP_CHMOD_ACL
,
174 SMB_VFS_OP_FCHMOD_ACL
,
176 SMB_VFS_OP_SYS_ACL_GET_ENTRY
,
177 SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
,
178 SMB_VFS_OP_SYS_ACL_GET_PERMSET
,
179 SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
,
180 SMB_VFS_OP_SYS_ACL_GET_FILE
,
181 SMB_VFS_OP_SYS_ACL_GET_FD
,
182 SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
,
183 SMB_VFS_OP_SYS_ACL_ADD_PERM
,
184 SMB_VFS_OP_SYS_ACL_TO_TEXT
,
185 SMB_VFS_OP_SYS_ACL_INIT
,
186 SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
,
187 SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
,
188 SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
,
189 SMB_VFS_OP_SYS_ACL_SET_PERMSET
,
190 SMB_VFS_OP_SYS_ACL_VALID
,
191 SMB_VFS_OP_SYS_ACL_SET_FILE
,
192 SMB_VFS_OP_SYS_ACL_SET_FD
,
193 SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
,
194 SMB_VFS_OP_SYS_ACL_GET_PERM
,
195 SMB_VFS_OP_SYS_ACL_FREE_TEXT
,
196 SMB_VFS_OP_SYS_ACL_FREE_ACL
,
197 SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
,
201 SMB_VFS_OP_FGETXATTR
,
202 SMB_VFS_OP_LISTXATTR
,
203 SMB_VFS_OP_FLISTXATTR
,
204 SMB_VFS_OP_REMOVEXATTR
,
205 SMB_VFS_OP_FREMOVEXATTR
,
207 SMB_VFS_OP_FSETXATTR
,
210 SMB_VFS_OP_AIO_FORCE
,
212 /* offline operations */
213 SMB_VFS_OP_IS_OFFLINE
,
214 SMB_VFS_OP_SET_OFFLINE
,
216 /* This should always be last enum value */
221 /* The following array *must* be in the same order as defined in vfs.h */
227 { SMB_VFS_OP_CONNECT
, "connect" },
228 { SMB_VFS_OP_DISCONNECT
, "disconnect" },
229 { SMB_VFS_OP_DISK_FREE
, "disk_free" },
230 { SMB_VFS_OP_GET_QUOTA
, "get_quota" },
231 { SMB_VFS_OP_SET_QUOTA
, "set_quota" },
232 { SMB_VFS_OP_GET_SHADOW_COPY_DATA
, "get_shadow_copy_data" },
233 { SMB_VFS_OP_STATVFS
, "statvfs" },
234 { SMB_VFS_OP_FS_CAPABILITIES
, "fs_capabilities" },
235 { SMB_VFS_OP_OPENDIR
, "opendir" },
236 { SMB_VFS_OP_FDOPENDIR
, "fdopendir" },
237 { SMB_VFS_OP_READDIR
, "readdir" },
238 { SMB_VFS_OP_SEEKDIR
, "seekdir" },
239 { SMB_VFS_OP_TELLDIR
, "telldir" },
240 { SMB_VFS_OP_REWINDDIR
, "rewinddir" },
241 { SMB_VFS_OP_MKDIR
, "mkdir" },
242 { SMB_VFS_OP_RMDIR
, "rmdir" },
243 { SMB_VFS_OP_CLOSEDIR
, "closedir" },
244 { SMB_VFS_OP_INIT_SEARCH_OP
, "init_search_op" },
245 { SMB_VFS_OP_OPEN
, "open" },
246 { SMB_VFS_OP_CREATE_FILE
, "create_file" },
247 { SMB_VFS_OP_CLOSE
, "close" },
248 { SMB_VFS_OP_READ
, "read" },
249 { SMB_VFS_OP_PREAD
, "pread" },
250 { SMB_VFS_OP_PREAD_SEND
, "pread_send" },
251 { SMB_VFS_OP_PREAD_RECV
, "pread_recv" },
252 { SMB_VFS_OP_WRITE
, "write" },
253 { SMB_VFS_OP_PWRITE
, "pwrite" },
254 { SMB_VFS_OP_LSEEK
, "lseek" },
255 { SMB_VFS_OP_SENDFILE
, "sendfile" },
256 { SMB_VFS_OP_RECVFILE
, "recvfile" },
257 { SMB_VFS_OP_RENAME
, "rename" },
258 { SMB_VFS_OP_FSYNC
, "fsync" },
259 { SMB_VFS_OP_FSYNC_SEND
, "fsync_send" },
260 { SMB_VFS_OP_FSYNC_RECV
, "fsync_recv" },
261 { SMB_VFS_OP_STAT
, "stat" },
262 { SMB_VFS_OP_FSTAT
, "fstat" },
263 { SMB_VFS_OP_LSTAT
, "lstat" },
264 { SMB_VFS_OP_GET_ALLOC_SIZE
, "get_alloc_size" },
265 { SMB_VFS_OP_UNLINK
, "unlink" },
266 { SMB_VFS_OP_CHMOD
, "chmod" },
267 { SMB_VFS_OP_FCHMOD
, "fchmod" },
268 { SMB_VFS_OP_CHOWN
, "chown" },
269 { SMB_VFS_OP_FCHOWN
, "fchown" },
270 { SMB_VFS_OP_LCHOWN
, "lchown" },
271 { SMB_VFS_OP_CHDIR
, "chdir" },
272 { SMB_VFS_OP_GETWD
, "getwd" },
273 { SMB_VFS_OP_NTIMES
, "ntimes" },
274 { SMB_VFS_OP_FTRUNCATE
, "ftruncate" },
275 { SMB_VFS_OP_FALLOCATE
,"fallocate" },
276 { SMB_VFS_OP_LOCK
, "lock" },
277 { SMB_VFS_OP_KERNEL_FLOCK
, "kernel_flock" },
278 { SMB_VFS_OP_LINUX_SETLEASE
, "linux_setlease" },
279 { SMB_VFS_OP_GETLOCK
, "getlock" },
280 { SMB_VFS_OP_SYMLINK
, "symlink" },
281 { SMB_VFS_OP_READLINK
, "readlink" },
282 { SMB_VFS_OP_LINK
, "link" },
283 { SMB_VFS_OP_MKNOD
, "mknod" },
284 { SMB_VFS_OP_REALPATH
, "realpath" },
285 { SMB_VFS_OP_NOTIFY_WATCH
, "notify_watch" },
286 { SMB_VFS_OP_CHFLAGS
, "chflags" },
287 { SMB_VFS_OP_FILE_ID_CREATE
, "file_id_create" },
288 { SMB_VFS_OP_STREAMINFO
, "streaminfo" },
289 { SMB_VFS_OP_GET_REAL_FILENAME
, "get_real_filename" },
290 { SMB_VFS_OP_CONNECTPATH
, "connectpath" },
291 { SMB_VFS_OP_BRL_LOCK_WINDOWS
, "brl_lock_windows" },
292 { SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, "brl_unlock_windows" },
293 { SMB_VFS_OP_BRL_CANCEL_WINDOWS
, "brl_cancel_windows" },
294 { SMB_VFS_OP_STRICT_LOCK
, "strict_lock" },
295 { SMB_VFS_OP_STRICT_UNLOCK
, "strict_unlock" },
296 { SMB_VFS_OP_TRANSLATE_NAME
, "translate_name" },
297 { SMB_VFS_OP_FGET_NT_ACL
, "fget_nt_acl" },
298 { SMB_VFS_OP_GET_NT_ACL
, "get_nt_acl" },
299 { SMB_VFS_OP_FSET_NT_ACL
, "fset_nt_acl" },
300 { SMB_VFS_OP_CHMOD_ACL
, "chmod_acl" },
301 { SMB_VFS_OP_FCHMOD_ACL
, "fchmod_acl" },
302 { SMB_VFS_OP_SYS_ACL_GET_ENTRY
, "sys_acl_get_entry" },
303 { SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, "sys_acl_get_tag_type" },
304 { SMB_VFS_OP_SYS_ACL_GET_PERMSET
, "sys_acl_get_permset" },
305 { SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, "sys_acl_get_qualifier" },
306 { SMB_VFS_OP_SYS_ACL_GET_FILE
, "sys_acl_get_file" },
307 { SMB_VFS_OP_SYS_ACL_GET_FD
, "sys_acl_get_fd" },
308 { SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, "sys_acl_clear_perms" },
309 { SMB_VFS_OP_SYS_ACL_ADD_PERM
, "sys_acl_add_perm" },
310 { SMB_VFS_OP_SYS_ACL_TO_TEXT
, "sys_acl_to_text" },
311 { SMB_VFS_OP_SYS_ACL_INIT
, "sys_acl_init" },
312 { SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, "sys_acl_create_entry" },
313 { SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, "sys_acl_set_tag_type" },
314 { SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, "sys_acl_set_qualifier" },
315 { SMB_VFS_OP_SYS_ACL_SET_PERMSET
, "sys_acl_set_permset" },
316 { SMB_VFS_OP_SYS_ACL_VALID
, "sys_acl_valid" },
317 { SMB_VFS_OP_SYS_ACL_SET_FILE
, "sys_acl_set_file" },
318 { SMB_VFS_OP_SYS_ACL_SET_FD
, "sys_acl_set_fd" },
319 { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, "sys_acl_delete_def_file" },
320 { SMB_VFS_OP_SYS_ACL_GET_PERM
, "sys_acl_get_perm" },
321 { SMB_VFS_OP_SYS_ACL_FREE_TEXT
, "sys_acl_free_text" },
322 { SMB_VFS_OP_SYS_ACL_FREE_ACL
, "sys_acl_free_acl" },
323 { SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, "sys_acl_free_qualifier" },
324 { SMB_VFS_OP_GETXATTR
, "getxattr" },
325 { SMB_VFS_OP_FGETXATTR
, "fgetxattr" },
326 { SMB_VFS_OP_LISTXATTR
, "listxattr" },
327 { SMB_VFS_OP_FLISTXATTR
, "flistxattr" },
328 { SMB_VFS_OP_REMOVEXATTR
, "removexattr" },
329 { SMB_VFS_OP_FREMOVEXATTR
, "fremovexattr" },
330 { SMB_VFS_OP_SETXATTR
, "setxattr" },
331 { SMB_VFS_OP_FSETXATTR
, "fsetxattr" },
332 { SMB_VFS_OP_AIO_FORCE
, "aio_force" },
333 { SMB_VFS_OP_IS_OFFLINE
, "is_offline" },
334 { SMB_VFS_OP_SET_OFFLINE
, "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" },
355 facility
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "facility", enum_log_facilities
, LOG_USER
);
360 static int audit_syslog_priority(vfs_handle_struct
*handle
)
362 static const struct enum_list enum_log_priorities
[] = {
363 { LOG_EMERG
, "EMERG" },
364 { LOG_ALERT
, "ALERT" },
365 { LOG_CRIT
, "CRIT" },
367 { LOG_WARNING
, "WARNING" },
368 { LOG_NOTICE
, "NOTICE" },
369 { LOG_INFO
, "INFO" },
370 { LOG_DEBUG
, "DEBUG" },
376 priority
= lp_parm_enum(SNUM(handle
->conn
), "full_audit", "priority",
377 enum_log_priorities
, LOG_NOTICE
);
378 if (priority
== -1) {
379 priority
= LOG_WARNING
;
385 static char *audit_prefix(TALLOC_CTX
*ctx
, connection_struct
*conn
)
390 prefix
= talloc_strdup(ctx
,
391 lp_parm_const_string(SNUM(conn
), "full_audit",
396 result
= talloc_sub_advanced(ctx
,
397 lp_servicename(talloc_tos(), SNUM(conn
)),
398 conn
->session_info
->unix_info
->unix_name
,
400 conn
->session_info
->unix_token
->gid
,
401 conn
->session_info
->unix_info
->sanitized_username
,
402 conn
->session_info
->info
->domain_name
,
408 static bool log_success(vfs_handle_struct
*handle
, vfs_op_type op
)
410 struct vfs_full_audit_private_data
*pd
= NULL
;
412 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
413 struct vfs_full_audit_private_data
,
416 if (pd
->success_ops
== NULL
) {
420 return bitmap_query(pd
->success_ops
, op
);
423 static bool log_failure(vfs_handle_struct
*handle
, vfs_op_type op
)
425 struct vfs_full_audit_private_data
*pd
= NULL
;
427 SMB_VFS_HANDLE_GET_DATA(handle
, pd
,
428 struct vfs_full_audit_private_data
,
431 if (pd
->failure_ops
== NULL
)
434 return bitmap_query(pd
->failure_ops
, op
);
437 static struct bitmap
*init_bitmap(TALLOC_CTX
*mem_ctx
, const char **ops
)
445 bm
= bitmap_talloc(mem_ctx
, SMB_VFS_OP_LAST
);
447 DEBUG(0, ("Could not alloc bitmap -- "
448 "defaulting to logging everything\n"));
452 for (; *ops
!= NULL
; ops
+= 1) {
457 if (strequal(*ops
, "all")) {
458 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
464 if (strequal(*ops
, "none")) {
474 for (i
=0; i
<SMB_VFS_OP_LAST
; i
++) {
475 if (vfs_op_names
[i
].name
== NULL
) {
476 smb_panic("vfs_full_audit.c: name table not "
477 "in sync with vfs.h\n");
479 if (strequal(op
, vfs_op_names
[i
].name
)) {
488 if (i
== SMB_VFS_OP_LAST
) {
489 DEBUG(0, ("Could not find opname %s, logging all\n",
498 static const char *audit_opname(vfs_op_type op
)
500 if (op
>= SMB_VFS_OP_LAST
)
501 return "INVALID VFS OP";
502 return vfs_op_names
[op
].name
;
505 static TALLOC_CTX
*tmp_do_log_ctx
;
507 * Get us a temporary talloc context usable just for DEBUG arguments
509 static TALLOC_CTX
*do_log_ctx(void)
511 if (tmp_do_log_ctx
== NULL
) {
512 tmp_do_log_ctx
= talloc_named_const(NULL
, 0, "do_log_ctx");
514 return tmp_do_log_ctx
;
517 static void do_log(vfs_op_type op
, bool success
, vfs_handle_struct
*handle
,
518 const char *format
, ...)
521 char *audit_pre
= NULL
;
526 if (success
&& (!log_success(handle
, op
)))
529 if (!success
&& (!log_failure(handle
, op
)))
533 fstrcpy(err_msg
, "ok");
535 fstr_sprintf(err_msg
, "fail (%s)", strerror(errno
));
537 va_start(ap
, format
);
538 op_msg
= talloc_vasprintf(talloc_tos(), format
, ap
);
546 * Specify the facility to interoperate with other syslog callers
547 * (smbd for example).
549 priority
= audit_syslog_priority(handle
) |
550 audit_syslog_facility(handle
);
552 audit_pre
= audit_prefix(talloc_tos(), handle
->conn
);
553 syslog(priority
, "%s|%s|%s|%s\n",
554 audit_pre
? audit_pre
: "",
555 audit_opname(op
), err_msg
, op_msg
);
558 TALLOC_FREE(audit_pre
);
560 TALLOC_FREE(tmp_do_log_ctx
);
566 * Return a string using the do_log_ctx()
568 static const char *smb_fname_str_do_log(const struct smb_filename
*smb_fname
)
573 if (smb_fname
== NULL
) {
576 status
= get_full_smb_filename(do_log_ctx(), smb_fname
, &fname
);
577 if (!NT_STATUS_IS_OK(status
)) {
584 * Return an fsp debug string using the do_log_ctx()
586 static const char *fsp_str_do_log(const struct files_struct
*fsp
)
588 return smb_fname_str_do_log(fsp
->fsp_name
);
591 /* Implementation of vfs_ops. Pass everything on to the default
592 operation but log event first. */
594 static int smb_full_audit_connect(vfs_handle_struct
*handle
,
595 const char *svc
, const char *user
)
598 struct vfs_full_audit_private_data
*pd
= NULL
;
600 result
= SMB_VFS_NEXT_CONNECT(handle
, svc
, user
);
605 pd
= talloc_zero(handle
, struct vfs_full_audit_private_data
);
607 SMB_VFS_NEXT_DISCONNECT(handle
);
612 openlog("smbd_audit", 0, audit_syslog_facility(handle
));
615 pd
->success_ops
= init_bitmap(
616 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
618 pd
->failure_ops
= init_bitmap(
619 pd
, lp_parm_string_list(SNUM(handle
->conn
), "full_audit",
622 /* Store the private data. */
623 SMB_VFS_HANDLE_SET_DATA(handle
, pd
, NULL
,
624 struct vfs_full_audit_private_data
, return -1);
626 do_log(SMB_VFS_OP_CONNECT
, True
, handle
,
632 static void smb_full_audit_disconnect(vfs_handle_struct
*handle
)
634 SMB_VFS_NEXT_DISCONNECT(handle
);
636 do_log(SMB_VFS_OP_DISCONNECT
, True
, handle
,
637 "%s", lp_servicename(talloc_tos(), SNUM(handle
->conn
)));
639 /* The bitmaps will be disconnected when the private
645 static uint64_t smb_full_audit_disk_free(vfs_handle_struct
*handle
,
647 bool small_query
, uint64_t *bsize
,
648 uint64_t *dfree
, uint64_t *dsize
)
652 result
= SMB_VFS_NEXT_DISK_FREE(handle
, path
, small_query
, bsize
,
655 /* Don't have a reasonable notion of failure here */
657 do_log(SMB_VFS_OP_DISK_FREE
, True
, handle
, "%s", path
);
662 static int smb_full_audit_get_quota(struct vfs_handle_struct
*handle
,
663 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
668 result
= SMB_VFS_NEXT_GET_QUOTA(handle
, qtype
, id
, qt
);
670 do_log(SMB_VFS_OP_GET_QUOTA
, (result
>= 0), handle
, "");
676 static int smb_full_audit_set_quota(struct vfs_handle_struct
*handle
,
677 enum SMB_QUOTA_TYPE qtype
, unid_t id
,
682 result
= SMB_VFS_NEXT_SET_QUOTA(handle
, qtype
, id
, qt
);
684 do_log(SMB_VFS_OP_SET_QUOTA
, (result
>= 0), handle
, "");
689 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct
*handle
,
690 struct files_struct
*fsp
,
691 struct shadow_copy_data
*shadow_copy_data
,
696 result
= SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle
, fsp
, shadow_copy_data
, labels
);
698 do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA
, (result
>= 0), handle
, "");
703 static int smb_full_audit_statvfs(struct vfs_handle_struct
*handle
,
705 struct vfs_statvfs_struct
*statbuf
)
709 result
= SMB_VFS_NEXT_STATVFS(handle
, path
, statbuf
);
711 do_log(SMB_VFS_OP_STATVFS
, (result
>= 0), handle
, "");
716 static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct
*handle
, enum timestamp_set_resolution
*p_ts_res
)
720 result
= SMB_VFS_NEXT_FS_CAPABILITIES(handle
, p_ts_res
);
722 do_log(SMB_VFS_OP_FS_CAPABILITIES
, true, handle
, "");
727 static DIR *smb_full_audit_opendir(vfs_handle_struct
*handle
,
728 const char *fname
, const char *mask
, uint32 attr
)
732 result
= SMB_VFS_NEXT_OPENDIR(handle
, fname
, mask
, attr
);
734 do_log(SMB_VFS_OP_OPENDIR
, (result
!= NULL
), handle
, "%s", fname
);
739 static DIR *smb_full_audit_fdopendir(vfs_handle_struct
*handle
,
740 files_struct
*fsp
, const char *mask
, uint32 attr
)
744 result
= SMB_VFS_NEXT_FDOPENDIR(handle
, fsp
, mask
, attr
);
746 do_log(SMB_VFS_OP_FDOPENDIR
, (result
!= NULL
), handle
, "%s",
747 fsp_str_do_log(fsp
));
752 static struct dirent
*smb_full_audit_readdir(vfs_handle_struct
*handle
,
753 DIR *dirp
, SMB_STRUCT_STAT
*sbuf
)
755 struct dirent
*result
;
757 result
= SMB_VFS_NEXT_READDIR(handle
, dirp
, sbuf
);
759 /* This operation has no reasonable error condition
760 * (End of dir is also failure), so always succeed.
762 do_log(SMB_VFS_OP_READDIR
, True
, handle
, "");
767 static void smb_full_audit_seekdir(vfs_handle_struct
*handle
,
768 DIR *dirp
, long offset
)
770 SMB_VFS_NEXT_SEEKDIR(handle
, dirp
, offset
);
772 do_log(SMB_VFS_OP_SEEKDIR
, True
, handle
, "");
776 static long smb_full_audit_telldir(vfs_handle_struct
*handle
,
781 result
= SMB_VFS_NEXT_TELLDIR(handle
, dirp
);
783 do_log(SMB_VFS_OP_TELLDIR
, True
, handle
, "");
788 static void smb_full_audit_rewinddir(vfs_handle_struct
*handle
,
791 SMB_VFS_NEXT_REWINDDIR(handle
, dirp
);
793 do_log(SMB_VFS_OP_REWINDDIR
, True
, handle
, "");
797 static int smb_full_audit_mkdir(vfs_handle_struct
*handle
,
798 const char *path
, mode_t mode
)
802 result
= SMB_VFS_NEXT_MKDIR(handle
, path
, mode
);
804 do_log(SMB_VFS_OP_MKDIR
, (result
>= 0), handle
, "%s", path
);
809 static int smb_full_audit_rmdir(vfs_handle_struct
*handle
,
814 result
= SMB_VFS_NEXT_RMDIR(handle
, path
);
816 do_log(SMB_VFS_OP_RMDIR
, (result
>= 0), handle
, "%s", path
);
821 static int smb_full_audit_closedir(vfs_handle_struct
*handle
,
826 result
= SMB_VFS_NEXT_CLOSEDIR(handle
, dirp
);
828 do_log(SMB_VFS_OP_CLOSEDIR
, (result
>= 0), handle
, "");
833 static void smb_full_audit_init_search_op(vfs_handle_struct
*handle
,
836 SMB_VFS_NEXT_INIT_SEARCH_OP(handle
, dirp
);
838 do_log(SMB_VFS_OP_INIT_SEARCH_OP
, True
, handle
, "");
842 static int smb_full_audit_open(vfs_handle_struct
*handle
,
843 struct smb_filename
*smb_fname
,
844 files_struct
*fsp
, int flags
, mode_t mode
)
848 result
= SMB_VFS_NEXT_OPEN(handle
, smb_fname
, fsp
, flags
, mode
);
850 do_log(SMB_VFS_OP_OPEN
, (result
>= 0), handle
, "%s|%s",
851 ((flags
& O_WRONLY
) || (flags
& O_RDWR
))?"w":"r",
852 smb_fname_str_do_log(smb_fname
));
857 static NTSTATUS
smb_full_audit_create_file(vfs_handle_struct
*handle
,
858 struct smb_request
*req
,
859 uint16_t root_dir_fid
,
860 struct smb_filename
*smb_fname
,
861 uint32_t access_mask
,
862 uint32_t share_access
,
863 uint32_t create_disposition
,
864 uint32_t create_options
,
865 uint32_t file_attributes
,
866 uint32_t oplock_request
,
867 uint64_t allocation_size
,
868 uint32_t private_flags
,
869 struct security_descriptor
*sd
,
870 struct ea_list
*ea_list
,
871 files_struct
**result_fsp
,
875 const char* str_create_disposition
;
877 switch (create_disposition
) {
879 str_create_disposition
= "supersede";
881 case FILE_OVERWRITE_IF
:
882 str_create_disposition
= "overwrite_if";
885 str_create_disposition
= "open";
888 str_create_disposition
= "overwrite";
891 str_create_disposition
= "create";
894 str_create_disposition
= "open_if";
897 str_create_disposition
= "unknown";
900 result
= SMB_VFS_NEXT_CREATE_FILE(
903 root_dir_fid
, /* root_dir_fid */
904 smb_fname
, /* fname */
905 access_mask
, /* access_mask */
906 share_access
, /* share_access */
907 create_disposition
, /* create_disposition*/
908 create_options
, /* create_options */
909 file_attributes
, /* file_attributes */
910 oplock_request
, /* oplock_request */
911 allocation_size
, /* allocation_size */
914 ea_list
, /* ea_list */
915 result_fsp
, /* result */
918 do_log(SMB_VFS_OP_CREATE_FILE
, (NT_STATUS_IS_OK(result
)), handle
,
919 "0x%x|%s|%s|%s", access_mask
,
920 create_options
& FILE_DIRECTORY_FILE
? "dir" : "file",
921 str_create_disposition
, smb_fname_str_do_log(smb_fname
));
926 static int smb_full_audit_close(vfs_handle_struct
*handle
, files_struct
*fsp
)
930 result
= SMB_VFS_NEXT_CLOSE(handle
, fsp
);
932 do_log(SMB_VFS_OP_CLOSE
, (result
>= 0), handle
, "%s",
933 fsp_str_do_log(fsp
));
938 static ssize_t
smb_full_audit_read(vfs_handle_struct
*handle
, files_struct
*fsp
,
939 void *data
, size_t n
)
943 result
= SMB_VFS_NEXT_READ(handle
, fsp
, data
, n
);
945 do_log(SMB_VFS_OP_READ
, (result
>= 0), handle
, "%s",
946 fsp_str_do_log(fsp
));
951 static ssize_t
smb_full_audit_pread(vfs_handle_struct
*handle
, files_struct
*fsp
,
952 void *data
, size_t n
, off_t offset
)
956 result
= SMB_VFS_NEXT_PREAD(handle
, fsp
, data
, n
, offset
);
958 do_log(SMB_VFS_OP_PREAD
, (result
>= 0), handle
, "%s",
959 fsp_str_do_log(fsp
));
964 struct smb_full_audit_pread_state
{
965 vfs_handle_struct
*handle
;
971 static void smb_full_audit_pread_done(struct tevent_req
*subreq
);
973 static struct tevent_req
*smb_full_audit_pread_send(
974 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
975 struct tevent_context
*ev
, struct files_struct
*fsp
,
976 void *data
, size_t n
, off_t offset
)
978 struct tevent_req
*req
, *subreq
;
979 struct smb_full_audit_pread_state
*state
;
981 req
= tevent_req_create(mem_ctx
, &state
,
982 struct smb_full_audit_pread_state
);
984 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
985 fsp_str_do_log(fsp
));
988 state
->handle
= handle
;
991 subreq
= SMB_VFS_NEXT_PREAD_SEND(state
, ev
, handle
, fsp
, data
,
993 if (tevent_req_nomem(subreq
, req
)) {
994 do_log(SMB_VFS_OP_PREAD_SEND
, false, handle
, "%s",
995 fsp_str_do_log(fsp
));
996 return tevent_req_post(req
, ev
);
998 tevent_req_set_callback(subreq
, smb_full_audit_pread_done
, req
);
1000 do_log(SMB_VFS_OP_PREAD_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1004 static void smb_full_audit_pread_done(struct tevent_req
*subreq
)
1006 struct tevent_req
*req
= tevent_req_callback_data(
1007 subreq
, struct tevent_req
);
1008 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1009 req
, struct smb_full_audit_pread_state
);
1011 state
->ret
= SMB_VFS_PREAD_RECV(subreq
, &state
->err
);
1012 TALLOC_FREE(subreq
);
1013 tevent_req_done(req
);
1016 static ssize_t
smb_full_audit_pread_recv(struct tevent_req
*req
, int *err
)
1018 struct smb_full_audit_pread_state
*state
= tevent_req_data(
1019 req
, struct smb_full_audit_pread_state
);
1021 if (tevent_req_is_unix_error(req
, err
)) {
1022 do_log(SMB_VFS_OP_PREAD_RECV
, false, state
->handle
, "%s",
1023 fsp_str_do_log(state
->fsp
));
1027 do_log(SMB_VFS_OP_PREAD_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1028 fsp_str_do_log(state
->fsp
));
1034 static ssize_t
smb_full_audit_write(vfs_handle_struct
*handle
, files_struct
*fsp
,
1035 const void *data
, size_t n
)
1039 result
= SMB_VFS_NEXT_WRITE(handle
, fsp
, data
, n
);
1041 do_log(SMB_VFS_OP_WRITE
, (result
>= 0), handle
, "%s",
1042 fsp_str_do_log(fsp
));
1047 static ssize_t
smb_full_audit_pwrite(vfs_handle_struct
*handle
, files_struct
*fsp
,
1048 const void *data
, size_t n
,
1053 result
= SMB_VFS_NEXT_PWRITE(handle
, fsp
, data
, n
, offset
);
1055 do_log(SMB_VFS_OP_PWRITE
, (result
>= 0), handle
, "%s",
1056 fsp_str_do_log(fsp
));
1061 struct smb_full_audit_pwrite_state
{
1062 vfs_handle_struct
*handle
;
1068 static void smb_full_audit_pwrite_done(struct tevent_req
*subreq
);
1070 static struct tevent_req
*smb_full_audit_pwrite_send(
1071 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1072 struct tevent_context
*ev
, struct files_struct
*fsp
,
1073 const void *data
, size_t n
, off_t offset
)
1075 struct tevent_req
*req
, *subreq
;
1076 struct smb_full_audit_pwrite_state
*state
;
1078 req
= tevent_req_create(mem_ctx
, &state
,
1079 struct smb_full_audit_pwrite_state
);
1081 do_log(SMB_VFS_OP_PWRITE_SEND
, false, handle
, "%s",
1082 fsp_str_do_log(fsp
));
1085 state
->handle
= handle
;
1088 subreq
= SMB_VFS_NEXT_PWRITE_SEND(state
, ev
, handle
, fsp
, data
,
1090 if (tevent_req_nomem(subreq
, req
)) {
1091 do_log(SMB_VFS_OP_PWRITE_SEND
, false, handle
, "%s",
1092 fsp_str_do_log(fsp
));
1093 return tevent_req_post(req
, ev
);
1095 tevent_req_set_callback(subreq
, smb_full_audit_pwrite_done
, req
);
1097 do_log(SMB_VFS_OP_PWRITE_SEND
, true, handle
, "%s",
1098 fsp_str_do_log(fsp
));
1102 static void smb_full_audit_pwrite_done(struct tevent_req
*subreq
)
1104 struct tevent_req
*req
= tevent_req_callback_data(
1105 subreq
, struct tevent_req
);
1106 struct smb_full_audit_pwrite_state
*state
= tevent_req_data(
1107 req
, struct smb_full_audit_pwrite_state
);
1109 state
->ret
= SMB_VFS_PWRITE_RECV(subreq
, &state
->err
);
1110 TALLOC_FREE(subreq
);
1111 tevent_req_done(req
);
1114 static ssize_t
smb_full_audit_pwrite_recv(struct tevent_req
*req
, int *err
)
1116 struct smb_full_audit_pwrite_state
*state
= tevent_req_data(
1117 req
, struct smb_full_audit_pwrite_state
);
1119 if (tevent_req_is_unix_error(req
, err
)) {
1120 do_log(SMB_VFS_OP_PWRITE_RECV
, false, state
->handle
, "%s",
1121 fsp_str_do_log(state
->fsp
));
1125 do_log(SMB_VFS_OP_PWRITE_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1126 fsp_str_do_log(state
->fsp
));
1132 static off_t
smb_full_audit_lseek(vfs_handle_struct
*handle
, files_struct
*fsp
,
1133 off_t offset
, int whence
)
1137 result
= SMB_VFS_NEXT_LSEEK(handle
, fsp
, offset
, whence
);
1139 do_log(SMB_VFS_OP_LSEEK
, (result
!= (ssize_t
)-1), handle
,
1140 "%s", fsp_str_do_log(fsp
));
1145 static ssize_t
smb_full_audit_sendfile(vfs_handle_struct
*handle
, int tofd
,
1146 files_struct
*fromfsp
,
1147 const DATA_BLOB
*hdr
, off_t offset
,
1152 result
= SMB_VFS_NEXT_SENDFILE(handle
, tofd
, fromfsp
, hdr
, offset
, n
);
1154 do_log(SMB_VFS_OP_SENDFILE
, (result
>= 0), handle
,
1155 "%s", fsp_str_do_log(fromfsp
));
1160 static ssize_t
smb_full_audit_recvfile(vfs_handle_struct
*handle
, int fromfd
,
1161 files_struct
*tofsp
,
1167 result
= SMB_VFS_NEXT_RECVFILE(handle
, fromfd
, tofsp
, offset
, n
);
1169 do_log(SMB_VFS_OP_RECVFILE
, (result
>= 0), handle
,
1170 "%s", fsp_str_do_log(tofsp
));
1175 static int smb_full_audit_rename(vfs_handle_struct
*handle
,
1176 const struct smb_filename
*smb_fname_src
,
1177 const struct smb_filename
*smb_fname_dst
)
1181 result
= SMB_VFS_NEXT_RENAME(handle
, smb_fname_src
, smb_fname_dst
);
1183 do_log(SMB_VFS_OP_RENAME
, (result
>= 0), handle
, "%s|%s",
1184 smb_fname_str_do_log(smb_fname_src
),
1185 smb_fname_str_do_log(smb_fname_dst
));
1190 static int smb_full_audit_fsync(vfs_handle_struct
*handle
, files_struct
*fsp
)
1194 result
= SMB_VFS_NEXT_FSYNC(handle
, fsp
);
1196 do_log(SMB_VFS_OP_FSYNC
, (result
>= 0), handle
, "%s",
1197 fsp_str_do_log(fsp
));
1202 struct smb_full_audit_fsync_state
{
1203 vfs_handle_struct
*handle
;
1209 static void smb_full_audit_fsync_done(struct tevent_req
*subreq
);
1211 static struct tevent_req
*smb_full_audit_fsync_send(
1212 struct vfs_handle_struct
*handle
, TALLOC_CTX
*mem_ctx
,
1213 struct tevent_context
*ev
, struct files_struct
*fsp
)
1215 struct tevent_req
*req
, *subreq
;
1216 struct smb_full_audit_fsync_state
*state
;
1218 req
= tevent_req_create(mem_ctx
, &state
,
1219 struct smb_full_audit_fsync_state
);
1221 do_log(SMB_VFS_OP_FSYNC_SEND
, false, handle
, "%s",
1222 fsp_str_do_log(fsp
));
1225 state
->handle
= handle
;
1228 subreq
= SMB_VFS_NEXT_FSYNC_SEND(state
, ev
, handle
, fsp
);
1229 if (tevent_req_nomem(subreq
, req
)) {
1230 do_log(SMB_VFS_OP_FSYNC_SEND
, false, handle
, "%s",
1231 fsp_str_do_log(fsp
));
1232 return tevent_req_post(req
, ev
);
1234 tevent_req_set_callback(subreq
, smb_full_audit_fsync_done
, req
);
1236 do_log(SMB_VFS_OP_FSYNC_SEND
, true, handle
, "%s", fsp_str_do_log(fsp
));
1240 static void smb_full_audit_fsync_done(struct tevent_req
*subreq
)
1242 struct tevent_req
*req
= tevent_req_callback_data(
1243 subreq
, struct tevent_req
);
1244 struct smb_full_audit_fsync_state
*state
= tevent_req_data(
1245 req
, struct smb_full_audit_fsync_state
);
1247 state
->ret
= SMB_VFS_FSYNC_RECV(subreq
, &state
->err
);
1248 TALLOC_FREE(subreq
);
1249 tevent_req_done(req
);
1252 static int smb_full_audit_fsync_recv(struct tevent_req
*req
, int *err
)
1254 struct smb_full_audit_fsync_state
*state
= tevent_req_data(
1255 req
, struct smb_full_audit_fsync_state
);
1257 if (tevent_req_is_unix_error(req
, err
)) {
1258 do_log(SMB_VFS_OP_FSYNC_RECV
, false, state
->handle
, "%s",
1259 fsp_str_do_log(state
->fsp
));
1263 do_log(SMB_VFS_OP_FSYNC_RECV
, (state
->ret
>= 0), state
->handle
, "%s",
1264 fsp_str_do_log(state
->fsp
));
1270 static int smb_full_audit_stat(vfs_handle_struct
*handle
,
1271 struct smb_filename
*smb_fname
)
1275 result
= SMB_VFS_NEXT_STAT(handle
, smb_fname
);
1277 do_log(SMB_VFS_OP_STAT
, (result
>= 0), handle
, "%s",
1278 smb_fname_str_do_log(smb_fname
));
1283 static int smb_full_audit_fstat(vfs_handle_struct
*handle
, files_struct
*fsp
,
1284 SMB_STRUCT_STAT
*sbuf
)
1288 result
= SMB_VFS_NEXT_FSTAT(handle
, fsp
, sbuf
);
1290 do_log(SMB_VFS_OP_FSTAT
, (result
>= 0), handle
, "%s",
1291 fsp_str_do_log(fsp
));
1296 static int smb_full_audit_lstat(vfs_handle_struct
*handle
,
1297 struct smb_filename
*smb_fname
)
1301 result
= SMB_VFS_NEXT_LSTAT(handle
, smb_fname
);
1303 do_log(SMB_VFS_OP_LSTAT
, (result
>= 0), handle
, "%s",
1304 smb_fname_str_do_log(smb_fname
));
1309 static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct
*handle
,
1310 files_struct
*fsp
, const SMB_STRUCT_STAT
*sbuf
)
1314 result
= SMB_VFS_NEXT_GET_ALLOC_SIZE(handle
, fsp
, sbuf
);
1316 do_log(SMB_VFS_OP_GET_ALLOC_SIZE
, (result
!= (uint64_t)-1), handle
,
1322 static int smb_full_audit_unlink(vfs_handle_struct
*handle
,
1323 const struct smb_filename
*smb_fname
)
1327 result
= SMB_VFS_NEXT_UNLINK(handle
, smb_fname
);
1329 do_log(SMB_VFS_OP_UNLINK
, (result
>= 0), handle
, "%s",
1330 smb_fname_str_do_log(smb_fname
));
1335 static int smb_full_audit_chmod(vfs_handle_struct
*handle
,
1336 const char *path
, mode_t mode
)
1340 result
= SMB_VFS_NEXT_CHMOD(handle
, path
, mode
);
1342 do_log(SMB_VFS_OP_CHMOD
, (result
>= 0), handle
, "%s|%o", path
, mode
);
1347 static int smb_full_audit_fchmod(vfs_handle_struct
*handle
, files_struct
*fsp
,
1352 result
= SMB_VFS_NEXT_FCHMOD(handle
, fsp
, mode
);
1354 do_log(SMB_VFS_OP_FCHMOD
, (result
>= 0), handle
,
1355 "%s|%o", fsp_str_do_log(fsp
), mode
);
1360 static int smb_full_audit_chown(vfs_handle_struct
*handle
,
1361 const char *path
, uid_t uid
, gid_t gid
)
1365 result
= SMB_VFS_NEXT_CHOWN(handle
, path
, uid
, gid
);
1367 do_log(SMB_VFS_OP_CHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1368 path
, (long int)uid
, (long int)gid
);
1373 static int smb_full_audit_fchown(vfs_handle_struct
*handle
, files_struct
*fsp
,
1374 uid_t uid
, gid_t gid
)
1378 result
= SMB_VFS_NEXT_FCHOWN(handle
, fsp
, uid
, gid
);
1380 do_log(SMB_VFS_OP_FCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1381 fsp_str_do_log(fsp
), (long int)uid
, (long int)gid
);
1386 static int smb_full_audit_lchown(vfs_handle_struct
*handle
,
1387 const char *path
, uid_t uid
, gid_t gid
)
1391 result
= SMB_VFS_NEXT_LCHOWN(handle
, path
, uid
, gid
);
1393 do_log(SMB_VFS_OP_LCHOWN
, (result
>= 0), handle
, "%s|%ld|%ld",
1394 path
, (long int)uid
, (long int)gid
);
1399 static int smb_full_audit_chdir(vfs_handle_struct
*handle
,
1404 result
= SMB_VFS_NEXT_CHDIR(handle
, path
);
1406 do_log(SMB_VFS_OP_CHDIR
, (result
>= 0), handle
, "chdir|%s", path
);
1411 static char *smb_full_audit_getwd(vfs_handle_struct
*handle
)
1415 result
= SMB_VFS_NEXT_GETWD(handle
);
1417 do_log(SMB_VFS_OP_GETWD
, (result
!= NULL
), handle
, "%s",
1418 result
== NULL
? "" : result
);
1423 static int smb_full_audit_ntimes(vfs_handle_struct
*handle
,
1424 const struct smb_filename
*smb_fname
,
1425 struct smb_file_time
*ft
)
1429 result
= SMB_VFS_NEXT_NTIMES(handle
, smb_fname
, ft
);
1431 do_log(SMB_VFS_OP_NTIMES
, (result
>= 0), handle
, "%s",
1432 smb_fname_str_do_log(smb_fname
));
1437 static int smb_full_audit_ftruncate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1442 result
= SMB_VFS_NEXT_FTRUNCATE(handle
, fsp
, len
);
1444 do_log(SMB_VFS_OP_FTRUNCATE
, (result
>= 0), handle
,
1445 "%s", fsp_str_do_log(fsp
));
1450 static int smb_full_audit_fallocate(vfs_handle_struct
*handle
, files_struct
*fsp
,
1451 enum vfs_fallocate_mode mode
,
1457 result
= SMB_VFS_NEXT_FALLOCATE(handle
, fsp
, mode
, offset
, len
);
1459 do_log(SMB_VFS_OP_FALLOCATE
, (result
>= 0), handle
,
1460 "%s", fsp_str_do_log(fsp
));
1465 static bool smb_full_audit_lock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1466 int op
, off_t offset
, off_t count
, int type
)
1470 result
= SMB_VFS_NEXT_LOCK(handle
, fsp
, op
, offset
, count
, type
);
1472 do_log(SMB_VFS_OP_LOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1477 static int smb_full_audit_kernel_flock(struct vfs_handle_struct
*handle
,
1478 struct files_struct
*fsp
,
1479 uint32 share_mode
, uint32 access_mask
)
1483 result
= SMB_VFS_NEXT_KERNEL_FLOCK(handle
, fsp
, share_mode
, access_mask
);
1485 do_log(SMB_VFS_OP_KERNEL_FLOCK
, (result
>= 0), handle
, "%s",
1486 fsp_str_do_log(fsp
));
1491 static int smb_full_audit_linux_setlease(vfs_handle_struct
*handle
, files_struct
*fsp
,
1496 result
= SMB_VFS_NEXT_LINUX_SETLEASE(handle
, fsp
, leasetype
);
1498 do_log(SMB_VFS_OP_LINUX_SETLEASE
, (result
>= 0), handle
, "%s",
1499 fsp_str_do_log(fsp
));
1504 static bool smb_full_audit_getlock(vfs_handle_struct
*handle
, files_struct
*fsp
,
1505 off_t
*poffset
, off_t
*pcount
, int *ptype
, pid_t
*ppid
)
1509 result
= SMB_VFS_NEXT_GETLOCK(handle
, fsp
, poffset
, pcount
, ptype
, ppid
);
1511 do_log(SMB_VFS_OP_GETLOCK
, result
, handle
, "%s", fsp_str_do_log(fsp
));
1516 static int smb_full_audit_symlink(vfs_handle_struct
*handle
,
1517 const char *oldpath
, const char *newpath
)
1521 result
= SMB_VFS_NEXT_SYMLINK(handle
, oldpath
, newpath
);
1523 do_log(SMB_VFS_OP_SYMLINK
, (result
>= 0), handle
,
1524 "%s|%s", oldpath
, newpath
);
1529 static int smb_full_audit_readlink(vfs_handle_struct
*handle
,
1530 const char *path
, char *buf
, size_t bufsiz
)
1534 result
= SMB_VFS_NEXT_READLINK(handle
, path
, buf
, bufsiz
);
1536 do_log(SMB_VFS_OP_READLINK
, (result
>= 0), handle
, "%s", path
);
1541 static int smb_full_audit_link(vfs_handle_struct
*handle
,
1542 const char *oldpath
, const char *newpath
)
1546 result
= SMB_VFS_NEXT_LINK(handle
, oldpath
, newpath
);
1548 do_log(SMB_VFS_OP_LINK
, (result
>= 0), handle
,
1549 "%s|%s", oldpath
, newpath
);
1554 static int smb_full_audit_mknod(vfs_handle_struct
*handle
,
1555 const char *pathname
, mode_t mode
, SMB_DEV_T dev
)
1559 result
= SMB_VFS_NEXT_MKNOD(handle
, pathname
, mode
, dev
);
1561 do_log(SMB_VFS_OP_MKNOD
, (result
>= 0), handle
, "%s", pathname
);
1566 static char *smb_full_audit_realpath(vfs_handle_struct
*handle
,
1571 result
= SMB_VFS_NEXT_REALPATH(handle
, path
);
1573 do_log(SMB_VFS_OP_REALPATH
, (result
!= NULL
), handle
, "%s", path
);
1578 static NTSTATUS
smb_full_audit_notify_watch(struct vfs_handle_struct
*handle
,
1579 struct sys_notify_context
*ctx
,
1582 uint32_t *subdir_filter
,
1583 void (*callback
)(struct sys_notify_context
*ctx
,
1585 struct notify_event
*ev
),
1586 void *private_data
, void *handle_p
)
1590 result
= SMB_VFS_NEXT_NOTIFY_WATCH(handle
, ctx
, path
,
1591 filter
, subdir_filter
, callback
,
1592 private_data
, handle_p
);
1594 do_log(SMB_VFS_OP_NOTIFY_WATCH
, NT_STATUS_IS_OK(result
), handle
, "");
1599 static int smb_full_audit_chflags(vfs_handle_struct
*handle
,
1600 const char *path
, unsigned int flags
)
1604 result
= SMB_VFS_NEXT_CHFLAGS(handle
, path
, flags
);
1606 do_log(SMB_VFS_OP_CHFLAGS
, (result
!= 0), handle
, "%s", path
);
1611 static struct file_id
smb_full_audit_file_id_create(struct vfs_handle_struct
*handle
,
1612 const SMB_STRUCT_STAT
*sbuf
)
1614 struct file_id id_zero
;
1615 struct file_id result
;
1617 ZERO_STRUCT(id_zero
);
1619 result
= SMB_VFS_NEXT_FILE_ID_CREATE(handle
, sbuf
);
1621 do_log(SMB_VFS_OP_FILE_ID_CREATE
,
1622 !file_id_equal(&id_zero
, &result
),
1623 handle
, "%s", file_id_string_tos(&result
));
1628 static NTSTATUS
smb_full_audit_streaminfo(vfs_handle_struct
*handle
,
1629 struct files_struct
*fsp
,
1631 TALLOC_CTX
*mem_ctx
,
1632 unsigned int *pnum_streams
,
1633 struct stream_struct
**pstreams
)
1637 result
= SMB_VFS_NEXT_STREAMINFO(handle
, fsp
, fname
, mem_ctx
,
1638 pnum_streams
, pstreams
);
1640 do_log(SMB_VFS_OP_STREAMINFO
, NT_STATUS_IS_OK(result
), handle
,
1646 static int smb_full_audit_get_real_filename(struct vfs_handle_struct
*handle
,
1649 TALLOC_CTX
*mem_ctx
,
1654 result
= SMB_VFS_NEXT_GET_REAL_FILENAME(handle
, path
, name
, mem_ctx
,
1657 do_log(SMB_VFS_OP_GET_REAL_FILENAME
, (result
== 0), handle
,
1658 "%s/%s->%s", path
, name
, (result
== 0) ? "" : *found_name
);
1663 static const char *smb_full_audit_connectpath(vfs_handle_struct
*handle
,
1668 result
= SMB_VFS_NEXT_CONNECTPATH(handle
, fname
);
1670 do_log(SMB_VFS_OP_CONNECTPATH
, result
!= NULL
, handle
,
1676 static NTSTATUS
smb_full_audit_brl_lock_windows(struct vfs_handle_struct
*handle
,
1677 struct byte_range_lock
*br_lck
,
1678 struct lock_struct
*plock
,
1680 struct blocking_lock_record
*blr
)
1684 result
= SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle
, br_lck
, plock
,
1685 blocking_lock
, blr
);
1687 do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS
, NT_STATUS_IS_OK(result
), handle
,
1688 "%s:%llu-%llu. type=%d. blocking=%d", fsp_str_do_log(br_lck
->fsp
),
1689 plock
->start
, plock
->size
, plock
->lock_type
, blocking_lock
);
1694 static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct
*handle
,
1695 struct messaging_context
*msg_ctx
,
1696 struct byte_range_lock
*br_lck
,
1697 const struct lock_struct
*plock
)
1701 result
= SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle
, msg_ctx
, br_lck
,
1704 do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS
, (result
== 0), handle
,
1705 "%s:%llu-%llu:%d", fsp_str_do_log(br_lck
->fsp
), plock
->start
,
1706 plock
->size
, plock
->lock_type
);
1711 static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct
*handle
,
1712 struct byte_range_lock
*br_lck
,
1713 struct lock_struct
*plock
,
1714 struct blocking_lock_record
*blr
)
1718 result
= SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle
, br_lck
, plock
, blr
);
1720 do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS
, (result
== 0), handle
,
1721 "%s:%llu-%llu:%d", fsp_str_do_log(br_lck
->fsp
), plock
->start
,
1727 static bool smb_full_audit_strict_lock(struct vfs_handle_struct
*handle
,
1728 struct files_struct
*fsp
,
1729 struct lock_struct
*plock
)
1733 result
= SMB_VFS_NEXT_STRICT_LOCK(handle
, fsp
, plock
);
1735 do_log(SMB_VFS_OP_STRICT_LOCK
, result
, handle
,
1736 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1742 static void smb_full_audit_strict_unlock(struct vfs_handle_struct
*handle
,
1743 struct files_struct
*fsp
,
1744 struct lock_struct
*plock
)
1746 SMB_VFS_NEXT_STRICT_UNLOCK(handle
, fsp
, plock
);
1748 do_log(SMB_VFS_OP_STRICT_UNLOCK
, true, handle
,
1749 "%s:%llu-%llu:%d", fsp_str_do_log(fsp
), plock
->start
,
1755 static NTSTATUS
smb_full_audit_translate_name(struct vfs_handle_struct
*handle
,
1757 enum vfs_translate_direction direction
,
1758 TALLOC_CTX
*mem_ctx
,
1763 result
= SMB_VFS_NEXT_TRANSLATE_NAME(handle
, name
, direction
, mem_ctx
,
1766 do_log(SMB_VFS_OP_TRANSLATE_NAME
, NT_STATUS_IS_OK(result
), handle
, "");
1771 static NTSTATUS
smb_full_audit_fget_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1772 uint32 security_info
,
1773 struct security_descriptor
**ppdesc
)
1777 result
= SMB_VFS_NEXT_FGET_NT_ACL(handle
, fsp
, security_info
, ppdesc
);
1779 do_log(SMB_VFS_OP_FGET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1780 "%s", fsp_str_do_log(fsp
));
1785 static NTSTATUS
smb_full_audit_get_nt_acl(vfs_handle_struct
*handle
,
1787 uint32 security_info
,
1788 struct security_descriptor
**ppdesc
)
1792 result
= SMB_VFS_NEXT_GET_NT_ACL(handle
, name
, security_info
, ppdesc
);
1794 do_log(SMB_VFS_OP_GET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
,
1800 static NTSTATUS
smb_full_audit_fset_nt_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1801 uint32 security_info_sent
,
1802 const struct security_descriptor
*psd
)
1806 result
= SMB_VFS_NEXT_FSET_NT_ACL(handle
, fsp
, security_info_sent
, psd
);
1808 do_log(SMB_VFS_OP_FSET_NT_ACL
, NT_STATUS_IS_OK(result
), handle
, "%s",
1809 fsp_str_do_log(fsp
));
1814 static int smb_full_audit_chmod_acl(vfs_handle_struct
*handle
,
1815 const char *path
, mode_t mode
)
1819 result
= SMB_VFS_NEXT_CHMOD_ACL(handle
, path
, mode
);
1821 do_log(SMB_VFS_OP_CHMOD_ACL
, (result
>= 0), handle
,
1822 "%s|%o", path
, mode
);
1827 static int smb_full_audit_fchmod_acl(vfs_handle_struct
*handle
, files_struct
*fsp
,
1832 result
= SMB_VFS_NEXT_FCHMOD_ACL(handle
, fsp
, mode
);
1834 do_log(SMB_VFS_OP_FCHMOD_ACL
, (result
>= 0), handle
,
1835 "%s|%o", fsp_str_do_log(fsp
), mode
);
1840 static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct
*handle
,
1842 SMB_ACL_T theacl
, int entry_id
,
1843 SMB_ACL_ENTRY_T
*entry_p
)
1847 result
= SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle
, theacl
, entry_id
,
1850 do_log(SMB_VFS_OP_SYS_ACL_GET_ENTRY
, (result
>= 0), handle
,
1856 static int smb_full_audit_sys_acl_get_tag_type(vfs_handle_struct
*handle
,
1858 SMB_ACL_ENTRY_T entry_d
,
1859 SMB_ACL_TAG_T
*tag_type_p
)
1863 result
= SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle
, entry_d
,
1866 do_log(SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE
, (result
>= 0), handle
,
1872 static int smb_full_audit_sys_acl_get_permset(vfs_handle_struct
*handle
,
1874 SMB_ACL_ENTRY_T entry_d
,
1875 SMB_ACL_PERMSET_T
*permset_p
)
1879 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle
, entry_d
,
1882 do_log(SMB_VFS_OP_SYS_ACL_GET_PERMSET
, (result
>= 0), handle
,
1888 static void * smb_full_audit_sys_acl_get_qualifier(vfs_handle_struct
*handle
,
1890 SMB_ACL_ENTRY_T entry_d
)
1894 result
= SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle
, entry_d
);
1896 do_log(SMB_VFS_OP_SYS_ACL_GET_QUALIFIER
, (result
!= NULL
), handle
,
1902 static SMB_ACL_T
smb_full_audit_sys_acl_get_file(vfs_handle_struct
*handle
,
1904 SMB_ACL_TYPE_T type
)
1908 result
= SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle
, path_p
, type
);
1910 do_log(SMB_VFS_OP_SYS_ACL_GET_FILE
, (result
!= NULL
), handle
,
1916 static SMB_ACL_T
smb_full_audit_sys_acl_get_fd(vfs_handle_struct
*handle
,
1921 result
= SMB_VFS_NEXT_SYS_ACL_GET_FD(handle
, fsp
);
1923 do_log(SMB_VFS_OP_SYS_ACL_GET_FD
, (result
!= NULL
), handle
,
1924 "%s", fsp_str_do_log(fsp
));
1929 static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct
*handle
,
1931 SMB_ACL_PERMSET_T permset
)
1935 result
= SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle
, permset
);
1937 do_log(SMB_VFS_OP_SYS_ACL_CLEAR_PERMS
, (result
>= 0), handle
,
1943 static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct
*handle
,
1945 SMB_ACL_PERMSET_T permset
,
1946 SMB_ACL_PERM_T perm
)
1950 result
= SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle
, permset
, perm
);
1952 do_log(SMB_VFS_OP_SYS_ACL_ADD_PERM
, (result
>= 0), handle
,
1958 static char * smb_full_audit_sys_acl_to_text(vfs_handle_struct
*handle
,
1964 result
= SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle
, theacl
, plen
);
1966 do_log(SMB_VFS_OP_SYS_ACL_TO_TEXT
, (result
!= NULL
), handle
,
1972 static SMB_ACL_T
smb_full_audit_sys_acl_init(vfs_handle_struct
*handle
,
1978 result
= SMB_VFS_NEXT_SYS_ACL_INIT(handle
, count
);
1980 do_log(SMB_VFS_OP_SYS_ACL_INIT
, (result
!= NULL
), handle
,
1986 static int smb_full_audit_sys_acl_create_entry(vfs_handle_struct
*handle
,
1988 SMB_ACL_ENTRY_T
*pentry
)
1992 result
= SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle
, pacl
, pentry
);
1994 do_log(SMB_VFS_OP_SYS_ACL_CREATE_ENTRY
, (result
>= 0), handle
,
2000 static int smb_full_audit_sys_acl_set_tag_type(vfs_handle_struct
*handle
,
2002 SMB_ACL_ENTRY_T entry
,
2003 SMB_ACL_TAG_T tagtype
)
2007 result
= SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle
, entry
,
2010 do_log(SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE
, (result
>= 0), handle
,
2016 static int smb_full_audit_sys_acl_set_qualifier(vfs_handle_struct
*handle
,
2018 SMB_ACL_ENTRY_T entry
,
2023 result
= SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle
, entry
, qual
);
2025 do_log(SMB_VFS_OP_SYS_ACL_SET_QUALIFIER
, (result
>= 0), handle
,
2031 static int smb_full_audit_sys_acl_set_permset(vfs_handle_struct
*handle
,
2033 SMB_ACL_ENTRY_T entry
,
2034 SMB_ACL_PERMSET_T permset
)
2038 result
= SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle
, entry
, permset
);
2040 do_log(SMB_VFS_OP_SYS_ACL_SET_PERMSET
, (result
>= 0), handle
,
2046 static int smb_full_audit_sys_acl_valid(vfs_handle_struct
*handle
,
2052 result
= SMB_VFS_NEXT_SYS_ACL_VALID(handle
, theacl
);
2054 do_log(SMB_VFS_OP_SYS_ACL_VALID
, (result
>= 0), handle
,
2060 static int smb_full_audit_sys_acl_set_file(vfs_handle_struct
*handle
,
2062 const char *name
, SMB_ACL_TYPE_T acltype
,
2067 result
= SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle
, name
, acltype
,
2070 do_log(SMB_VFS_OP_SYS_ACL_SET_FILE
, (result
>= 0), handle
,
2076 static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct
*handle
, files_struct
*fsp
,
2081 result
= SMB_VFS_NEXT_SYS_ACL_SET_FD(handle
, fsp
, theacl
);
2083 do_log(SMB_VFS_OP_SYS_ACL_SET_FD
, (result
>= 0), handle
,
2084 "%s", fsp_str_do_log(fsp
));
2089 static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct
*handle
,
2095 result
= SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle
, path
);
2097 do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE
, (result
>= 0), handle
,
2103 static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct
*handle
,
2105 SMB_ACL_PERMSET_T permset
,
2106 SMB_ACL_PERM_T perm
)
2110 result
= SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle
, permset
, perm
);
2112 do_log(SMB_VFS_OP_SYS_ACL_GET_PERM
, (result
>= 0), handle
,
2118 static int smb_full_audit_sys_acl_free_text(vfs_handle_struct
*handle
,
2124 result
= SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle
, text
);
2126 do_log(SMB_VFS_OP_SYS_ACL_FREE_TEXT
, (result
>= 0), handle
,
2132 static int smb_full_audit_sys_acl_free_acl(vfs_handle_struct
*handle
,
2134 SMB_ACL_T posix_acl
)
2138 result
= SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle
, posix_acl
);
2140 do_log(SMB_VFS_OP_SYS_ACL_FREE_ACL
, (result
>= 0), handle
,
2146 static int smb_full_audit_sys_acl_free_qualifier(vfs_handle_struct
*handle
,
2148 SMB_ACL_TAG_T tagtype
)
2152 result
= SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle
, qualifier
,
2155 do_log(SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER
, (result
>= 0), handle
,
2161 static ssize_t
smb_full_audit_getxattr(struct vfs_handle_struct
*handle
,
2163 const char *name
, void *value
, size_t size
)
2167 result
= SMB_VFS_NEXT_GETXATTR(handle
, path
, name
, value
, size
);
2169 do_log(SMB_VFS_OP_GETXATTR
, (result
>= 0), handle
,
2170 "%s|%s", path
, name
);
2175 static ssize_t
smb_full_audit_fgetxattr(struct vfs_handle_struct
*handle
,
2176 struct files_struct
*fsp
,
2177 const char *name
, void *value
, size_t size
)
2181 result
= SMB_VFS_NEXT_FGETXATTR(handle
, fsp
, name
, value
, size
);
2183 do_log(SMB_VFS_OP_FGETXATTR
, (result
>= 0), handle
,
2184 "%s|%s", fsp_str_do_log(fsp
), name
);
2189 static ssize_t
smb_full_audit_listxattr(struct vfs_handle_struct
*handle
,
2190 const char *path
, char *list
, size_t size
)
2194 result
= SMB_VFS_NEXT_LISTXATTR(handle
, path
, list
, size
);
2196 do_log(SMB_VFS_OP_LISTXATTR
, (result
>= 0), handle
, "%s", path
);
2201 static ssize_t
smb_full_audit_flistxattr(struct vfs_handle_struct
*handle
,
2202 struct files_struct
*fsp
, char *list
,
2207 result
= SMB_VFS_NEXT_FLISTXATTR(handle
, fsp
, list
, size
);
2209 do_log(SMB_VFS_OP_FLISTXATTR
, (result
>= 0), handle
,
2210 "%s", fsp_str_do_log(fsp
));
2215 static int smb_full_audit_removexattr(struct vfs_handle_struct
*handle
,
2221 result
= SMB_VFS_NEXT_REMOVEXATTR(handle
, path
, name
);
2223 do_log(SMB_VFS_OP_REMOVEXATTR
, (result
>= 0), handle
,
2224 "%s|%s", path
, name
);
2229 static int smb_full_audit_fremovexattr(struct vfs_handle_struct
*handle
,
2230 struct files_struct
*fsp
,
2235 result
= SMB_VFS_NEXT_FREMOVEXATTR(handle
, fsp
, name
);
2237 do_log(SMB_VFS_OP_FREMOVEXATTR
, (result
>= 0), handle
,
2238 "%s|%s", fsp_str_do_log(fsp
), name
);
2243 static int smb_full_audit_setxattr(struct vfs_handle_struct
*handle
,
2245 const char *name
, const void *value
, size_t size
,
2250 result
= SMB_VFS_NEXT_SETXATTR(handle
, path
, name
, value
, size
,
2253 do_log(SMB_VFS_OP_SETXATTR
, (result
>= 0), handle
,
2254 "%s|%s", path
, name
);
2259 static int smb_full_audit_fsetxattr(struct vfs_handle_struct
*handle
,
2260 struct files_struct
*fsp
, const char *name
,
2261 const void *value
, size_t size
, int flags
)
2265 result
= SMB_VFS_NEXT_FSETXATTR(handle
, fsp
, name
, value
, size
, flags
);
2267 do_log(SMB_VFS_OP_FSETXATTR
, (result
>= 0), handle
,
2268 "%s|%s", fsp_str_do_log(fsp
), name
);
2273 static bool smb_full_audit_aio_force(struct vfs_handle_struct
*handle
,
2274 struct files_struct
*fsp
)
2278 result
= SMB_VFS_NEXT_AIO_FORCE(handle
, fsp
);
2279 do_log(SMB_VFS_OP_AIO_FORCE
, result
, handle
,
2280 "%s", fsp_str_do_log(fsp
));
2285 static bool smb_full_audit_is_offline(struct vfs_handle_struct
*handle
,
2286 const struct smb_filename
*fname
,
2287 SMB_STRUCT_STAT
*sbuf
)
2291 result
= SMB_VFS_NEXT_IS_OFFLINE(handle
, fname
, sbuf
);
2292 do_log(SMB_VFS_OP_IS_OFFLINE
, result
, handle
, "%s",
2293 smb_fname_str_do_log(fname
));
2297 static int smb_full_audit_set_offline(struct vfs_handle_struct
*handle
,
2298 const struct smb_filename
*fname
)
2302 result
= SMB_VFS_NEXT_SET_OFFLINE(handle
, fname
);
2303 do_log(SMB_VFS_OP_SET_OFFLINE
, result
>= 0, handle
, "%s",
2304 smb_fname_str_do_log(fname
));
2308 static struct vfs_fn_pointers vfs_full_audit_fns
= {
2310 /* Disk operations */
2312 .connect_fn
= smb_full_audit_connect
,
2313 .disconnect_fn
= smb_full_audit_disconnect
,
2314 .disk_free_fn
= smb_full_audit_disk_free
,
2315 .get_quota_fn
= smb_full_audit_get_quota
,
2316 .set_quota_fn
= smb_full_audit_set_quota
,
2317 .get_shadow_copy_data_fn
= smb_full_audit_get_shadow_copy_data
,
2318 .statvfs_fn
= smb_full_audit_statvfs
,
2319 .fs_capabilities_fn
= smb_full_audit_fs_capabilities
,
2320 .opendir_fn
= smb_full_audit_opendir
,
2321 .fdopendir_fn
= smb_full_audit_fdopendir
,
2322 .readdir_fn
= smb_full_audit_readdir
,
2323 .seekdir_fn
= smb_full_audit_seekdir
,
2324 .telldir_fn
= smb_full_audit_telldir
,
2325 .rewind_dir_fn
= smb_full_audit_rewinddir
,
2326 .mkdir_fn
= smb_full_audit_mkdir
,
2327 .rmdir_fn
= smb_full_audit_rmdir
,
2328 .closedir_fn
= smb_full_audit_closedir
,
2329 .init_search_op_fn
= smb_full_audit_init_search_op
,
2330 .open_fn
= smb_full_audit_open
,
2331 .create_file_fn
= smb_full_audit_create_file
,
2332 .close_fn
= smb_full_audit_close
,
2333 .read_fn
= smb_full_audit_read
,
2334 .pread_fn
= smb_full_audit_pread
,
2335 .pread_send_fn
= smb_full_audit_pread_send
,
2336 .pread_recv_fn
= smb_full_audit_pread_recv
,
2337 .write_fn
= smb_full_audit_write
,
2338 .pwrite_fn
= smb_full_audit_pwrite
,
2339 .pwrite_send_fn
= smb_full_audit_pwrite_send
,
2340 .pwrite_recv_fn
= smb_full_audit_pwrite_recv
,
2341 .lseek_fn
= smb_full_audit_lseek
,
2342 .sendfile_fn
= smb_full_audit_sendfile
,
2343 .recvfile_fn
= smb_full_audit_recvfile
,
2344 .rename_fn
= smb_full_audit_rename
,
2345 .fsync_fn
= smb_full_audit_fsync
,
2346 .fsync_send_fn
= smb_full_audit_fsync_send
,
2347 .fsync_recv_fn
= smb_full_audit_fsync_recv
,
2348 .stat_fn
= smb_full_audit_stat
,
2349 .fstat_fn
= smb_full_audit_fstat
,
2350 .lstat_fn
= smb_full_audit_lstat
,
2351 .get_alloc_size_fn
= smb_full_audit_get_alloc_size
,
2352 .unlink_fn
= smb_full_audit_unlink
,
2353 .chmod_fn
= smb_full_audit_chmod
,
2354 .fchmod_fn
= smb_full_audit_fchmod
,
2355 .chown_fn
= smb_full_audit_chown
,
2356 .fchown_fn
= smb_full_audit_fchown
,
2357 .lchown_fn
= smb_full_audit_lchown
,
2358 .chdir_fn
= smb_full_audit_chdir
,
2359 .getwd_fn
= smb_full_audit_getwd
,
2360 .ntimes_fn
= smb_full_audit_ntimes
,
2361 .ftruncate_fn
= smb_full_audit_ftruncate
,
2362 .fallocate_fn
= smb_full_audit_fallocate
,
2363 .lock_fn
= smb_full_audit_lock
,
2364 .kernel_flock_fn
= smb_full_audit_kernel_flock
,
2365 .linux_setlease_fn
= smb_full_audit_linux_setlease
,
2366 .getlock_fn
= smb_full_audit_getlock
,
2367 .symlink_fn
= smb_full_audit_symlink
,
2368 .readlink_fn
= smb_full_audit_readlink
,
2369 .link_fn
= smb_full_audit_link
,
2370 .mknod_fn
= smb_full_audit_mknod
,
2371 .realpath_fn
= smb_full_audit_realpath
,
2372 .notify_watch_fn
= smb_full_audit_notify_watch
,
2373 .chflags_fn
= smb_full_audit_chflags
,
2374 .file_id_create_fn
= smb_full_audit_file_id_create
,
2375 .streaminfo_fn
= smb_full_audit_streaminfo
,
2376 .get_real_filename_fn
= smb_full_audit_get_real_filename
,
2377 .connectpath_fn
= smb_full_audit_connectpath
,
2378 .brl_lock_windows_fn
= smb_full_audit_brl_lock_windows
,
2379 .brl_unlock_windows_fn
= smb_full_audit_brl_unlock_windows
,
2380 .brl_cancel_windows_fn
= smb_full_audit_brl_cancel_windows
,
2381 .strict_lock_fn
= smb_full_audit_strict_lock
,
2382 .strict_unlock_fn
= smb_full_audit_strict_unlock
,
2383 .translate_name_fn
= smb_full_audit_translate_name
,
2384 .fget_nt_acl_fn
= smb_full_audit_fget_nt_acl
,
2385 .get_nt_acl_fn
= smb_full_audit_get_nt_acl
,
2386 .fset_nt_acl_fn
= smb_full_audit_fset_nt_acl
,
2387 .chmod_acl_fn
= smb_full_audit_chmod_acl
,
2388 .fchmod_acl_fn
= smb_full_audit_fchmod_acl
,
2389 .sys_acl_get_entry_fn
= smb_full_audit_sys_acl_get_entry
,
2390 .sys_acl_get_tag_type_fn
= smb_full_audit_sys_acl_get_tag_type
,
2391 .sys_acl_get_permset_fn
= smb_full_audit_sys_acl_get_permset
,
2392 .sys_acl_get_qualifier_fn
= smb_full_audit_sys_acl_get_qualifier
,
2393 .sys_acl_get_file_fn
= smb_full_audit_sys_acl_get_file
,
2394 .sys_acl_get_fd_fn
= smb_full_audit_sys_acl_get_fd
,
2395 .sys_acl_clear_perms_fn
= smb_full_audit_sys_acl_clear_perms
,
2396 .sys_acl_add_perm_fn
= smb_full_audit_sys_acl_add_perm
,
2397 .sys_acl_to_text_fn
= smb_full_audit_sys_acl_to_text
,
2398 .sys_acl_init_fn
= smb_full_audit_sys_acl_init
,
2399 .sys_acl_create_entry_fn
= smb_full_audit_sys_acl_create_entry
,
2400 .sys_acl_set_tag_type_fn
= smb_full_audit_sys_acl_set_tag_type
,
2401 .sys_acl_set_qualifier_fn
= smb_full_audit_sys_acl_set_qualifier
,
2402 .sys_acl_set_permset_fn
= smb_full_audit_sys_acl_set_permset
,
2403 .sys_acl_valid_fn
= smb_full_audit_sys_acl_valid
,
2404 .sys_acl_set_file_fn
= smb_full_audit_sys_acl_set_file
,
2405 .sys_acl_set_fd_fn
= smb_full_audit_sys_acl_set_fd
,
2406 .sys_acl_delete_def_file_fn
= smb_full_audit_sys_acl_delete_def_file
,
2407 .sys_acl_get_perm_fn
= smb_full_audit_sys_acl_get_perm
,
2408 .sys_acl_free_text_fn
= smb_full_audit_sys_acl_free_text
,
2409 .sys_acl_free_acl_fn
= smb_full_audit_sys_acl_free_acl
,
2410 .sys_acl_free_qualifier_fn
= smb_full_audit_sys_acl_free_qualifier
,
2411 .getxattr_fn
= smb_full_audit_getxattr
,
2412 .fgetxattr_fn
= smb_full_audit_fgetxattr
,
2413 .listxattr_fn
= smb_full_audit_listxattr
,
2414 .flistxattr_fn
= smb_full_audit_flistxattr
,
2415 .removexattr_fn
= smb_full_audit_removexattr
,
2416 .fremovexattr_fn
= smb_full_audit_fremovexattr
,
2417 .setxattr_fn
= smb_full_audit_setxattr
,
2418 .fsetxattr_fn
= smb_full_audit_fsetxattr
,
2419 .aio_force_fn
= smb_full_audit_aio_force
,
2420 .is_offline_fn
= smb_full_audit_is_offline
,
2421 .set_offline_fn
= smb_full_audit_set_offline
,
2424 NTSTATUS
vfs_full_audit_init(void)
2426 NTSTATUS ret
= smb_register_vfs(SMB_VFS_INTERFACE_VERSION
,
2427 "full_audit", &vfs_full_audit_fns
);
2429 if (!NT_STATUS_IS_OK(ret
))
2432 vfs_full_audit_debug_level
= debug_add_class("full_audit");
2433 if (vfs_full_audit_debug_level
== -1) {
2434 vfs_full_audit_debug_level
= DBGC_VFS
;
2435 DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
2438 DEBUG(10, ("vfs_full_audit: Debug class number of "
2439 "'full_audit': %d\n", vfs_full_audit_debug_level
));