1 | /*
|
---|
2 | * Auditing VFS module for samba. Log selected file operations to syslog
|
---|
3 | * facility.
|
---|
4 | *
|
---|
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
|
---|
10 | *
|
---|
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.
|
---|
15 | *
|
---|
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.
|
---|
20 | *
|
---|
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/>.
|
---|
23 | */
|
---|
24 |
|
---|
25 | /*
|
---|
26 | * This module implements parseable logging for all Samba VFS operations.
|
---|
27 | *
|
---|
28 | * You use it as follows:
|
---|
29 | *
|
---|
30 | * [tmp]
|
---|
31 | * path = /tmp
|
---|
32 | * vfs objects = full_audit
|
---|
33 | * full_audit:prefix = %u|%I
|
---|
34 | * full_audit:success = open opendir
|
---|
35 | * full_audit:failure = all
|
---|
36 | *
|
---|
37 | * vfs op can be "all" which means log all operations.
|
---|
38 | * vfs op can be "none" which means no logging.
|
---|
39 | *
|
---|
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
|
---|
43 | *
|
---|
44 | * where "nobody" is the connected username and "192.168.234.1" is the
|
---|
45 | * client's IP address.
|
---|
46 | *
|
---|
47 | * Options:
|
---|
48 | *
|
---|
49 | * prefix: A macro expansion template prepended to the syslog entry.
|
---|
50 | *
|
---|
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.
|
---|
54 | *
|
---|
55 | * failure: A list of VFS operations for which failure to complete should be
|
---|
56 | * logged. Defaults to logging everything.
|
---|
57 | */
|
---|
58 |
|
---|
59 |
|
---|
60 | #include "includes.h"
|
---|
61 | #include "system/filesys.h"
|
---|
62 | #include "system/syslog.h"
|
---|
63 | #include "smbd/smbd.h"
|
---|
64 | #include "../librpc/gen_ndr/ndr_netlogon.h"
|
---|
65 | #include "auth.h"
|
---|
66 | #include "ntioctl.h"
|
---|
67 | #include "lib/util/bitmap.h"
|
---|
68 |
|
---|
69 | static int vfs_full_audit_debug_level = DBGC_VFS;
|
---|
70 |
|
---|
71 | struct vfs_full_audit_private_data {
|
---|
72 | struct bitmap *success_ops;
|
---|
73 | struct bitmap *failure_ops;
|
---|
74 | };
|
---|
75 |
|
---|
76 | #undef DBGC_CLASS
|
---|
77 | #define DBGC_CLASS vfs_full_audit_debug_level
|
---|
78 |
|
---|
79 | typedef enum _vfs_op_type {
|
---|
80 | SMB_VFS_OP_NOOP = -1,
|
---|
81 |
|
---|
82 | /* Disk operations */
|
---|
83 |
|
---|
84 | SMB_VFS_OP_CONNECT = 0,
|
---|
85 | SMB_VFS_OP_DISCONNECT,
|
---|
86 | SMB_VFS_OP_DISK_FREE,
|
---|
87 | SMB_VFS_OP_GET_QUOTA,
|
---|
88 | SMB_VFS_OP_SET_QUOTA,
|
---|
89 | SMB_VFS_OP_GET_SHADOW_COPY_DATA,
|
---|
90 | SMB_VFS_OP_STATVFS,
|
---|
91 | SMB_VFS_OP_FS_CAPABILITIES,
|
---|
92 |
|
---|
93 | /* Directory operations */
|
---|
94 |
|
---|
95 | SMB_VFS_OP_OPENDIR,
|
---|
96 | SMB_VFS_OP_FDOPENDIR,
|
---|
97 | SMB_VFS_OP_READDIR,
|
---|
98 | SMB_VFS_OP_SEEKDIR,
|
---|
99 | SMB_VFS_OP_TELLDIR,
|
---|
100 | SMB_VFS_OP_REWINDDIR,
|
---|
101 | SMB_VFS_OP_MKDIR,
|
---|
102 | SMB_VFS_OP_RMDIR,
|
---|
103 | SMB_VFS_OP_CLOSEDIR,
|
---|
104 | SMB_VFS_OP_INIT_SEARCH_OP,
|
---|
105 |
|
---|
106 | /* File operations */
|
---|
107 |
|
---|
108 | SMB_VFS_OP_OPEN,
|
---|
109 | SMB_VFS_OP_CREATE_FILE,
|
---|
110 | SMB_VFS_OP_CLOSE,
|
---|
111 | SMB_VFS_OP_READ,
|
---|
112 | SMB_VFS_OP_PREAD,
|
---|
113 | SMB_VFS_OP_WRITE,
|
---|
114 | SMB_VFS_OP_PWRITE,
|
---|
115 | SMB_VFS_OP_LSEEK,
|
---|
116 | SMB_VFS_OP_SENDFILE,
|
---|
117 | SMB_VFS_OP_RECVFILE,
|
---|
118 | SMB_VFS_OP_RENAME,
|
---|
119 | SMB_VFS_OP_FSYNC,
|
---|
120 | SMB_VFS_OP_STAT,
|
---|
121 | SMB_VFS_OP_FSTAT,
|
---|
122 | SMB_VFS_OP_LSTAT,
|
---|
123 | SMB_VFS_OP_GET_ALLOC_SIZE,
|
---|
124 | SMB_VFS_OP_UNLINK,
|
---|
125 | SMB_VFS_OP_CHMOD,
|
---|
126 | SMB_VFS_OP_FCHMOD,
|
---|
127 | SMB_VFS_OP_CHOWN,
|
---|
128 | SMB_VFS_OP_FCHOWN,
|
---|
129 | SMB_VFS_OP_LCHOWN,
|
---|
130 | SMB_VFS_OP_CHDIR,
|
---|
131 | SMB_VFS_OP_GETWD,
|
---|
132 | SMB_VFS_OP_NTIMES,
|
---|
133 | SMB_VFS_OP_FTRUNCATE,
|
---|
134 | SMB_VFS_OP_FALLOCATE,
|
---|
135 | SMB_VFS_OP_LOCK,
|
---|
136 | SMB_VFS_OP_KERNEL_FLOCK,
|
---|
137 | SMB_VFS_OP_LINUX_SETLEASE,
|
---|
138 | SMB_VFS_OP_GETLOCK,
|
---|
139 | SMB_VFS_OP_SYMLINK,
|
---|
140 | SMB_VFS_OP_READLINK,
|
---|
141 | SMB_VFS_OP_LINK,
|
---|
142 | SMB_VFS_OP_MKNOD,
|
---|
143 | SMB_VFS_OP_REALPATH,
|
---|
144 | SMB_VFS_OP_NOTIFY_WATCH,
|
---|
145 | SMB_VFS_OP_CHFLAGS,
|
---|
146 | SMB_VFS_OP_FILE_ID_CREATE,
|
---|
147 | SMB_VFS_OP_STREAMINFO,
|
---|
148 | SMB_VFS_OP_GET_REAL_FILENAME,
|
---|
149 | SMB_VFS_OP_CONNECTPATH,
|
---|
150 | SMB_VFS_OP_BRL_LOCK_WINDOWS,
|
---|
151 | SMB_VFS_OP_BRL_UNLOCK_WINDOWS,
|
---|
152 | SMB_VFS_OP_BRL_CANCEL_WINDOWS,
|
---|
153 | SMB_VFS_OP_STRICT_LOCK,
|
---|
154 | SMB_VFS_OP_STRICT_UNLOCK,
|
---|
155 | SMB_VFS_OP_TRANSLATE_NAME,
|
---|
156 |
|
---|
157 | /* NT ACL operations. */
|
---|
158 |
|
---|
159 | SMB_VFS_OP_FGET_NT_ACL,
|
---|
160 | SMB_VFS_OP_GET_NT_ACL,
|
---|
161 | SMB_VFS_OP_FSET_NT_ACL,
|
---|
162 |
|
---|
163 | /* POSIX ACL operations. */
|
---|
164 |
|
---|
165 | SMB_VFS_OP_CHMOD_ACL,
|
---|
166 | SMB_VFS_OP_FCHMOD_ACL,
|
---|
167 |
|
---|
168 | SMB_VFS_OP_SYS_ACL_GET_ENTRY,
|
---|
169 | SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE,
|
---|
170 | SMB_VFS_OP_SYS_ACL_GET_PERMSET,
|
---|
171 | SMB_VFS_OP_SYS_ACL_GET_QUALIFIER,
|
---|
172 | SMB_VFS_OP_SYS_ACL_GET_FILE,
|
---|
173 | SMB_VFS_OP_SYS_ACL_GET_FD,
|
---|
174 | SMB_VFS_OP_SYS_ACL_CLEAR_PERMS,
|
---|
175 | SMB_VFS_OP_SYS_ACL_ADD_PERM,
|
---|
176 | SMB_VFS_OP_SYS_ACL_TO_TEXT,
|
---|
177 | SMB_VFS_OP_SYS_ACL_INIT,
|
---|
178 | SMB_VFS_OP_SYS_ACL_CREATE_ENTRY,
|
---|
179 | SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE,
|
---|
180 | SMB_VFS_OP_SYS_ACL_SET_QUALIFIER,
|
---|
181 | SMB_VFS_OP_SYS_ACL_SET_PERMSET,
|
---|
182 | SMB_VFS_OP_SYS_ACL_VALID,
|
---|
183 | SMB_VFS_OP_SYS_ACL_SET_FILE,
|
---|
184 | SMB_VFS_OP_SYS_ACL_SET_FD,
|
---|
185 | SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE,
|
---|
186 | SMB_VFS_OP_SYS_ACL_GET_PERM,
|
---|
187 | SMB_VFS_OP_SYS_ACL_FREE_TEXT,
|
---|
188 | SMB_VFS_OP_SYS_ACL_FREE_ACL,
|
---|
189 | SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER,
|
---|
190 |
|
---|
191 | /* EA operations. */
|
---|
192 | SMB_VFS_OP_GETXATTR,
|
---|
193 | SMB_VFS_OP_LGETXATTR,
|
---|
194 | SMB_VFS_OP_FGETXATTR,
|
---|
195 | SMB_VFS_OP_LISTXATTR,
|
---|
196 | SMB_VFS_OP_LLISTXATTR,
|
---|
197 | SMB_VFS_OP_FLISTXATTR,
|
---|
198 | SMB_VFS_OP_REMOVEXATTR,
|
---|
199 | SMB_VFS_OP_LREMOVEXATTR,
|
---|
200 | SMB_VFS_OP_FREMOVEXATTR,
|
---|
201 | SMB_VFS_OP_SETXATTR,
|
---|
202 | SMB_VFS_OP_LSETXATTR,
|
---|
203 | SMB_VFS_OP_FSETXATTR,
|
---|
204 |
|
---|
205 | /* aio operations */
|
---|
206 | SMB_VFS_OP_AIO_READ,
|
---|
207 | SMB_VFS_OP_AIO_WRITE,
|
---|
208 | SMB_VFS_OP_AIO_RETURN,
|
---|
209 | SMB_VFS_OP_AIO_CANCEL,
|
---|
210 | SMB_VFS_OP_AIO_ERROR,
|
---|
211 | SMB_VFS_OP_AIO_FSYNC,
|
---|
212 | SMB_VFS_OP_AIO_SUSPEND,
|
---|
213 | SMB_VFS_OP_AIO_FORCE,
|
---|
214 |
|
---|
215 | /* offline operations */
|
---|
216 | SMB_VFS_OP_IS_OFFLINE,
|
---|
217 | SMB_VFS_OP_SET_OFFLINE,
|
---|
218 |
|
---|
219 | /* This should always be last enum value */
|
---|
220 |
|
---|
221 | SMB_VFS_OP_LAST
|
---|
222 | } vfs_op_type;
|
---|
223 |
|
---|
224 | /* The following array *must* be in the same order as defined in vfs.h */
|
---|
225 |
|
---|
226 | static struct {
|
---|
227 | vfs_op_type type;
|
---|
228 | const char *name;
|
---|
229 | } vfs_op_names[] = {
|
---|
230 | { SMB_VFS_OP_CONNECT, "connect" },
|
---|
231 | { SMB_VFS_OP_DISCONNECT, "disconnect" },
|
---|
232 | { SMB_VFS_OP_DISK_FREE, "disk_free" },
|
---|
233 | { SMB_VFS_OP_GET_QUOTA, "get_quota" },
|
---|
234 | { SMB_VFS_OP_SET_QUOTA, "set_quota" },
|
---|
235 | { SMB_VFS_OP_GET_SHADOW_COPY_DATA, "get_shadow_copy_data" },
|
---|
236 | { SMB_VFS_OP_STATVFS, "statvfs" },
|
---|
237 | { SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" },
|
---|
238 | { SMB_VFS_OP_OPENDIR, "opendir" },
|
---|
239 | { SMB_VFS_OP_FDOPENDIR, "fdopendir" },
|
---|
240 | { SMB_VFS_OP_READDIR, "readdir" },
|
---|
241 | { SMB_VFS_OP_SEEKDIR, "seekdir" },
|
---|
242 | { SMB_VFS_OP_TELLDIR, "telldir" },
|
---|
243 | { SMB_VFS_OP_REWINDDIR, "rewinddir" },
|
---|
244 | { SMB_VFS_OP_MKDIR, "mkdir" },
|
---|
245 | { SMB_VFS_OP_RMDIR, "rmdir" },
|
---|
246 | { SMB_VFS_OP_CLOSEDIR, "closedir" },
|
---|
247 | { SMB_VFS_OP_INIT_SEARCH_OP, "init_search_op" },
|
---|
248 | { SMB_VFS_OP_OPEN, "open" },
|
---|
249 | { SMB_VFS_OP_CREATE_FILE, "create_file" },
|
---|
250 | { SMB_VFS_OP_CLOSE, "close" },
|
---|
251 | { SMB_VFS_OP_READ, "read" },
|
---|
252 | { SMB_VFS_OP_PREAD, "pread" },
|
---|
253 | { SMB_VFS_OP_WRITE, "write" },
|
---|
254 | { SMB_VFS_OP_PWRITE, "pwrite" },
|
---|
255 | { SMB_VFS_OP_LSEEK, "lseek" },
|
---|
256 | { SMB_VFS_OP_SENDFILE, "sendfile" },
|
---|
257 | { SMB_VFS_OP_RECVFILE, "recvfile" },
|
---|
258 | { SMB_VFS_OP_RENAME, "rename" },
|
---|
259 | { SMB_VFS_OP_FSYNC, "fsync" },
|
---|
260 | { SMB_VFS_OP_STAT, "stat" },
|
---|
261 | { SMB_VFS_OP_FSTAT, "fstat" },
|
---|
262 | { SMB_VFS_OP_LSTAT, "lstat" },
|
---|
263 | { SMB_VFS_OP_GET_ALLOC_SIZE, "get_alloc_size" },
|
---|
264 | { SMB_VFS_OP_UNLINK, "unlink" },
|
---|
265 | { SMB_VFS_OP_CHMOD, "chmod" },
|
---|
266 | { SMB_VFS_OP_FCHMOD, "fchmod" },
|
---|
267 | { SMB_VFS_OP_CHOWN, "chown" },
|
---|
268 | { SMB_VFS_OP_FCHOWN, "fchown" },
|
---|
269 | { SMB_VFS_OP_LCHOWN, "lchown" },
|
---|
270 | { SMB_VFS_OP_CHDIR, "chdir" },
|
---|
271 | { SMB_VFS_OP_GETWD, "getwd" },
|
---|
272 | { SMB_VFS_OP_NTIMES, "ntimes" },
|
---|
273 | { SMB_VFS_OP_FTRUNCATE, "ftruncate" },
|
---|
274 | { SMB_VFS_OP_FALLOCATE,"fallocate" },
|
---|
275 | { SMB_VFS_OP_LOCK, "lock" },
|
---|
276 | { SMB_VFS_OP_KERNEL_FLOCK, "kernel_flock" },
|
---|
277 | { SMB_VFS_OP_LINUX_SETLEASE, "linux_setlease" },
|
---|
278 | { SMB_VFS_OP_GETLOCK, "getlock" },
|
---|
279 | { SMB_VFS_OP_SYMLINK, "symlink" },
|
---|
280 | { SMB_VFS_OP_READLINK, "readlink" },
|
---|
281 | { SMB_VFS_OP_LINK, "link" },
|
---|
282 | { SMB_VFS_OP_MKNOD, "mknod" },
|
---|
283 | { SMB_VFS_OP_REALPATH, "realpath" },
|
---|
284 | { SMB_VFS_OP_NOTIFY_WATCH, "notify_watch" },
|
---|
285 | { SMB_VFS_OP_CHFLAGS, "chflags" },
|
---|
286 | { SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
|
---|
287 | { SMB_VFS_OP_STREAMINFO, "streaminfo" },
|
---|
288 | { SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
|
---|
289 | { SMB_VFS_OP_CONNECTPATH, "connectpath" },
|
---|
290 | { SMB_VFS_OP_BRL_LOCK_WINDOWS, "brl_lock_windows" },
|
---|
291 | { SMB_VFS_OP_BRL_UNLOCK_WINDOWS, "brl_unlock_windows" },
|
---|
292 | { SMB_VFS_OP_BRL_CANCEL_WINDOWS, "brl_cancel_windows" },
|
---|
293 | { SMB_VFS_OP_STRICT_LOCK, "strict_lock" },
|
---|
294 | { SMB_VFS_OP_STRICT_UNLOCK, "strict_unlock" },
|
---|
295 | { SMB_VFS_OP_TRANSLATE_NAME, "translate_name" },
|
---|
296 | { SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" },
|
---|
297 | { SMB_VFS_OP_GET_NT_ACL, "get_nt_acl" },
|
---|
298 | { SMB_VFS_OP_FSET_NT_ACL, "fset_nt_acl" },
|
---|
299 | { SMB_VFS_OP_CHMOD_ACL, "chmod_acl" },
|
---|
300 | { SMB_VFS_OP_FCHMOD_ACL, "fchmod_acl" },
|
---|
301 | { SMB_VFS_OP_SYS_ACL_GET_ENTRY, "sys_acl_get_entry" },
|
---|
302 | { SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, "sys_acl_get_tag_type" },
|
---|
303 | { SMB_VFS_OP_SYS_ACL_GET_PERMSET, "sys_acl_get_permset" },
|
---|
304 | { SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, "sys_acl_get_qualifier" },
|
---|
305 | { SMB_VFS_OP_SYS_ACL_GET_FILE, "sys_acl_get_file" },
|
---|
306 | { SMB_VFS_OP_SYS_ACL_GET_FD, "sys_acl_get_fd" },
|
---|
307 | { SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, "sys_acl_clear_perms" },
|
---|
308 | { SMB_VFS_OP_SYS_ACL_ADD_PERM, "sys_acl_add_perm" },
|
---|
309 | { SMB_VFS_OP_SYS_ACL_TO_TEXT, "sys_acl_to_text" },
|
---|
310 | { SMB_VFS_OP_SYS_ACL_INIT, "sys_acl_init" },
|
---|
311 | { SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, "sys_acl_create_entry" },
|
---|
312 | { SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, "sys_acl_set_tag_type" },
|
---|
313 | { SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, "sys_acl_set_qualifier" },
|
---|
314 | { SMB_VFS_OP_SYS_ACL_SET_PERMSET, "sys_acl_set_permset" },
|
---|
315 | { SMB_VFS_OP_SYS_ACL_VALID, "sys_acl_valid" },
|
---|
316 | { SMB_VFS_OP_SYS_ACL_SET_FILE, "sys_acl_set_file" },
|
---|
317 | { SMB_VFS_OP_SYS_ACL_SET_FD, "sys_acl_set_fd" },
|
---|
318 | { SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, "sys_acl_delete_def_file" },
|
---|
319 | { SMB_VFS_OP_SYS_ACL_GET_PERM, "sys_acl_get_perm" },
|
---|
320 | { SMB_VFS_OP_SYS_ACL_FREE_TEXT, "sys_acl_free_text" },
|
---|
321 | { SMB_VFS_OP_SYS_ACL_FREE_ACL, "sys_acl_free_acl" },
|
---|
322 | { SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, "sys_acl_free_qualifier" },
|
---|
323 | { SMB_VFS_OP_GETXATTR, "getxattr" },
|
---|
324 | { SMB_VFS_OP_LGETXATTR, "lgetxattr" },
|
---|
325 | { SMB_VFS_OP_FGETXATTR, "fgetxattr" },
|
---|
326 | { SMB_VFS_OP_LISTXATTR, "listxattr" },
|
---|
327 | { SMB_VFS_OP_LLISTXATTR, "llistxattr" },
|
---|
328 | { SMB_VFS_OP_FLISTXATTR, "flistxattr" },
|
---|
329 | { SMB_VFS_OP_REMOVEXATTR, "removexattr" },
|
---|
330 | { SMB_VFS_OP_LREMOVEXATTR, "lremovexattr" },
|
---|
331 | { SMB_VFS_OP_FREMOVEXATTR, "fremovexattr" },
|
---|
332 | { SMB_VFS_OP_SETXATTR, "setxattr" },
|
---|
333 | { SMB_VFS_OP_LSETXATTR, "lsetxattr" },
|
---|
334 | { SMB_VFS_OP_FSETXATTR, "fsetxattr" },
|
---|
335 | { SMB_VFS_OP_AIO_READ, "aio_read" },
|
---|
336 | { SMB_VFS_OP_AIO_WRITE, "aio_write" },
|
---|
337 | { SMB_VFS_OP_AIO_RETURN,"aio_return" },
|
---|
338 | { SMB_VFS_OP_AIO_CANCEL,"aio_cancel" },
|
---|
339 | { SMB_VFS_OP_AIO_ERROR, "aio_error" },
|
---|
340 | { SMB_VFS_OP_AIO_FSYNC, "aio_fsync" },
|
---|
341 | { SMB_VFS_OP_AIO_SUSPEND,"aio_suspend" },
|
---|
342 | { SMB_VFS_OP_AIO_FORCE, "aio_force" },
|
---|
343 | { SMB_VFS_OP_IS_OFFLINE, "is_offline" },
|
---|
344 | { SMB_VFS_OP_SET_OFFLINE, "set_offline" },
|
---|
345 | { SMB_VFS_OP_LAST, NULL }
|
---|
346 | };
|
---|
347 |
|
---|
348 | static int audit_syslog_facility(vfs_handle_struct *handle)
|
---|
349 | {
|
---|
350 | static const struct enum_list enum_log_facilities[] = {
|
---|
351 | { LOG_USER, "USER" },
|
---|
352 | { LOG_LOCAL0, "LOCAL0" },
|
---|
353 | { LOG_LOCAL1, "LOCAL1" },
|
---|
354 | { LOG_LOCAL2, "LOCAL2" },
|
---|
355 | { LOG_LOCAL3, "LOCAL3" },
|
---|
356 | { LOG_LOCAL4, "LOCAL4" },
|
---|
357 | { LOG_LOCAL5, "LOCAL5" },
|
---|
358 | { LOG_LOCAL6, "LOCAL6" },
|
---|
359 | { LOG_LOCAL7, "LOCAL7" }
|
---|
360 | };
|
---|
361 |
|
---|
362 | int facility;
|
---|
363 |
|
---|
364 | facility = lp_parm_enum(SNUM(handle->conn), "full_audit", "facility", enum_log_facilities, LOG_USER);
|
---|
365 |
|
---|
366 | return facility;
|
---|
367 | }
|
---|
368 |
|
---|
369 | static int audit_syslog_priority(vfs_handle_struct *handle)
|
---|
370 | {
|
---|
371 | static const struct enum_list enum_log_priorities[] = {
|
---|
372 | { LOG_EMERG, "EMERG" },
|
---|
373 | { LOG_ALERT, "ALERT" },
|
---|
374 | { LOG_CRIT, "CRIT" },
|
---|
375 | { LOG_ERR, "ERR" },
|
---|
376 | { LOG_WARNING, "WARNING" },
|
---|
377 | { LOG_NOTICE, "NOTICE" },
|
---|
378 | { LOG_INFO, "INFO" },
|
---|
379 | { LOG_DEBUG, "DEBUG" }
|
---|
380 | };
|
---|
381 |
|
---|
382 | int priority;
|
---|
383 |
|
---|
384 | priority = lp_parm_enum(SNUM(handle->conn), "full_audit", "priority",
|
---|
385 | enum_log_priorities, LOG_NOTICE);
|
---|
386 | if (priority == -1) {
|
---|
387 | priority = LOG_WARNING;
|
---|
388 | }
|
---|
389 |
|
---|
390 | return priority;
|
---|
391 | }
|
---|
392 |
|
---|
393 | static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
|
---|
394 | {
|
---|
395 | char *prefix = NULL;
|
---|
396 | char *result;
|
---|
397 |
|
---|
398 | prefix = talloc_strdup(ctx,
|
---|
399 | lp_parm_const_string(SNUM(conn), "full_audit",
|
---|
400 | "prefix", "%u|%I"));
|
---|
401 | if (!prefix) {
|
---|
402 | return NULL;
|
---|
403 | }
|
---|
404 | result = talloc_sub_advanced(ctx,
|
---|
405 | lp_servicename(SNUM(conn)),
|
---|
406 | conn->session_info->unix_name,
|
---|
407 | conn->connectpath,
|
---|
408 | conn->session_info->utok.gid,
|
---|
409 | conn->session_info->sanitized_username,
|
---|
410 | conn->session_info->info3->base.domain.string,
|
---|
411 | prefix);
|
---|
412 | TALLOC_FREE(prefix);
|
---|
413 | return result;
|
---|
414 | }
|
---|
415 |
|
---|
416 | static bool log_success(vfs_handle_struct *handle, vfs_op_type op)
|
---|
417 | {
|
---|
418 | struct vfs_full_audit_private_data *pd = NULL;
|
---|
419 |
|
---|
420 | SMB_VFS_HANDLE_GET_DATA(handle, pd,
|
---|
421 | struct vfs_full_audit_private_data,
|
---|
422 | return True);
|
---|
423 |
|
---|
424 | if (pd->success_ops == NULL) {
|
---|
425 | return True;
|
---|
426 | }
|
---|
427 |
|
---|
428 | return bitmap_query(pd->success_ops, op);
|
---|
429 | }
|
---|
430 |
|
---|
431 | static bool log_failure(vfs_handle_struct *handle, vfs_op_type op)
|
---|
432 | {
|
---|
433 | struct vfs_full_audit_private_data *pd = NULL;
|
---|
434 |
|
---|
435 | SMB_VFS_HANDLE_GET_DATA(handle, pd,
|
---|
436 | struct vfs_full_audit_private_data,
|
---|
437 | return True);
|
---|
438 |
|
---|
439 | if (pd->failure_ops == NULL)
|
---|
440 | return True;
|
---|
441 |
|
---|
442 | return bitmap_query(pd->failure_ops, op);
|
---|
443 | }
|
---|
444 |
|
---|
445 | static struct bitmap *init_bitmap(TALLOC_CTX *mem_ctx, const char **ops)
|
---|
446 | {
|
---|
447 | struct bitmap *bm;
|
---|
448 |
|
---|
449 | if (ops == NULL) {
|
---|
450 | return NULL;
|
---|
451 | }
|
---|
452 |
|
---|
453 | bm = bitmap_talloc(mem_ctx, SMB_VFS_OP_LAST);
|
---|
454 | if (bm == NULL) {
|
---|
455 | DEBUG(0, ("Could not alloc bitmap -- "
|
---|
456 | "defaulting to logging everything\n"));
|
---|
457 | return NULL;
|
---|
458 | }
|
---|
459 |
|
---|
460 | for (; *ops != NULL; ops += 1) {
|
---|
461 | int i;
|
---|
462 | bool neg = false;
|
---|
463 | const char *op;
|
---|
464 |
|
---|
465 | if (strequal(*ops, "all")) {
|
---|
466 | for (i=0; i<SMB_VFS_OP_LAST; i++) {
|
---|
467 | bitmap_set(bm, i);
|
---|
468 | }
|
---|
469 | continue;
|
---|
470 | }
|
---|
471 |
|
---|
472 | if (strequal(*ops, "none")) {
|
---|
473 | break;
|
---|
474 | }
|
---|
475 |
|
---|
476 | op = ops[0];
|
---|
477 | if (op[0] == '!') {
|
---|
478 | neg = true;
|
---|
479 | op += 1;
|
---|
480 | }
|
---|
481 |
|
---|
482 | for (i=0; i<SMB_VFS_OP_LAST; i++) {
|
---|
483 | if (vfs_op_names[i].name == NULL) {
|
---|
484 | smb_panic("vfs_full_audit.c: name table not "
|
---|
485 | "in sync with vfs.h\n");
|
---|
486 | }
|
---|
487 | if (strequal(op, vfs_op_names[i].name)) {
|
---|
488 | if (neg) {
|
---|
489 | bitmap_clear(bm, i);
|
---|
490 | } else {
|
---|
491 | bitmap_set(bm, i);
|
---|
492 | }
|
---|
493 | break;
|
---|
494 | }
|
---|
495 | }
|
---|
496 | if (i == SMB_VFS_OP_LAST) {
|
---|
497 | DEBUG(0, ("Could not find opname %s, logging all\n",
|
---|
498 | *ops));
|
---|
499 | TALLOC_FREE(bm);
|
---|
500 | return NULL;
|
---|
501 | }
|
---|
502 | }
|
---|
503 | return bm;
|
---|
504 | }
|
---|
505 |
|
---|
506 | static const char *audit_opname(vfs_op_type op)
|
---|
507 | {
|
---|
508 | if (op >= SMB_VFS_OP_LAST)
|
---|
509 | return "INVALID VFS OP";
|
---|
510 | return vfs_op_names[op].name;
|
---|
511 | }
|
---|
512 |
|
---|
513 | static TALLOC_CTX *tmp_do_log_ctx;
|
---|
514 | /*
|
---|
515 | * Get us a temporary talloc context usable just for DEBUG arguments
|
---|
516 | */
|
---|
517 | static TALLOC_CTX *do_log_ctx(void)
|
---|
518 | {
|
---|
519 | if (tmp_do_log_ctx == NULL) {
|
---|
520 | tmp_do_log_ctx = talloc_named_const(NULL, 0, "do_log_ctx");
|
---|
521 | }
|
---|
522 | return tmp_do_log_ctx;
|
---|
523 | }
|
---|
524 |
|
---|
525 | static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
|
---|
526 | const char *format, ...)
|
---|
527 | {
|
---|
528 | fstring err_msg;
|
---|
529 | char *audit_pre = NULL;
|
---|
530 | va_list ap;
|
---|
531 | char *op_msg = NULL;
|
---|
532 | int priority;
|
---|
533 |
|
---|
534 | if (success && (!log_success(handle, op)))
|
---|
535 | goto out;
|
---|
536 |
|
---|
537 | if (!success && (!log_failure(handle, op)))
|
---|
538 | goto out;
|
---|
539 |
|
---|
540 | if (success)
|
---|
541 | fstrcpy(err_msg, "ok");
|
---|
542 | else
|
---|
543 | fstr_sprintf(err_msg, "fail (%s)", strerror(errno));
|
---|
544 |
|
---|
545 | va_start(ap, format);
|
---|
546 | op_msg = talloc_vasprintf(talloc_tos(), format, ap);
|
---|
547 | va_end(ap);
|
---|
548 |
|
---|
549 | if (!op_msg) {
|
---|
550 | goto out;
|
---|
551 | }
|
---|
552 |
|
---|
553 | /*
|
---|
554 | * Specify the facility to interoperate with other syslog callers
|
---|
555 | * (smbd for example).
|
---|
556 | */
|
---|
557 | priority = audit_syslog_priority(handle) |
|
---|
558 | audit_syslog_facility(handle);
|
---|
559 |
|
---|
560 | audit_pre = audit_prefix(talloc_tos(), handle->conn);
|
---|
561 | syslog(priority, "%s|%s|%s|%s\n",
|
---|
562 | audit_pre ? audit_pre : "",
|
---|
563 | audit_opname(op), err_msg, op_msg);
|
---|
564 |
|
---|
565 | out:
|
---|
566 | TALLOC_FREE(audit_pre);
|
---|
567 | TALLOC_FREE(op_msg);
|
---|
568 | TALLOC_FREE(tmp_do_log_ctx);
|
---|
569 |
|
---|
570 | return;
|
---|
571 | }
|
---|
572 |
|
---|
573 | /**
|
---|
574 | * Return a string using the do_log_ctx()
|
---|
575 | */
|
---|
576 | static const char *smb_fname_str_do_log(const struct smb_filename *smb_fname)
|
---|
577 | {
|
---|
578 | char *fname = NULL;
|
---|
579 | NTSTATUS status;
|
---|
580 |
|
---|
581 | if (smb_fname == NULL) {
|
---|
582 | return "";
|
---|
583 | }
|
---|
584 | status = get_full_smb_filename(do_log_ctx(), smb_fname, &fname);
|
---|
585 | if (!NT_STATUS_IS_OK(status)) {
|
---|
586 | return "";
|
---|
587 | }
|
---|
588 | return fname;
|
---|
589 | }
|
---|
590 |
|
---|
591 | /**
|
---|
592 | * Return an fsp debug string using the do_log_ctx()
|
---|
593 | */
|
---|
594 | static const char *fsp_str_do_log(const struct files_struct *fsp)
|
---|
595 | {
|
---|
596 | return smb_fname_str_do_log(fsp->fsp_name);
|
---|
597 | }
|
---|
598 |
|
---|
599 | /* Implementation of vfs_ops. Pass everything on to the default
|
---|
600 | operation but log event first. */
|
---|
601 |
|
---|
602 | static int smb_full_audit_connect(vfs_handle_struct *handle,
|
---|
603 | const char *svc, const char *user)
|
---|
604 | {
|
---|
605 | int result;
|
---|
606 | struct vfs_full_audit_private_data *pd = NULL;
|
---|
607 |
|
---|
608 | result = SMB_VFS_NEXT_CONNECT(handle, svc, user);
|
---|
609 | if (result < 0) {
|
---|
610 | return result;
|
---|
611 | }
|
---|
612 |
|
---|
613 | pd = TALLOC_ZERO_P(handle, struct vfs_full_audit_private_data);
|
---|
614 | if (!pd) {
|
---|
615 | SMB_VFS_NEXT_DISCONNECT(handle);
|
---|
616 | return -1;
|
---|
617 | }
|
---|
618 |
|
---|
619 | #ifndef WITH_SYSLOG
|
---|
620 | openlog("smbd_audit", 0, audit_syslog_facility(handle));
|
---|
621 | #endif
|
---|
622 |
|
---|
623 | pd->success_ops = init_bitmap(
|
---|
624 | pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
|
---|
625 | "success", NULL));
|
---|
626 | pd->failure_ops = init_bitmap(
|
---|
627 | pd, lp_parm_string_list(SNUM(handle->conn), "full_audit",
|
---|
628 | "failure", NULL));
|
---|
629 |
|
---|
630 | /* Store the private data. */
|
---|
631 | SMB_VFS_HANDLE_SET_DATA(handle, pd, NULL,
|
---|
632 | struct vfs_full_audit_private_data, return -1);
|
---|
633 |
|
---|
634 | do_log(SMB_VFS_OP_CONNECT, True, handle,
|
---|
635 | "%s", svc);
|
---|
636 |
|
---|
637 | return 0;
|
---|
638 | }
|
---|
639 |
|
---|
640 | static void smb_full_audit_disconnect(vfs_handle_struct *handle)
|
---|
641 | {
|
---|
642 | SMB_VFS_NEXT_DISCONNECT(handle);
|
---|
643 |
|
---|
644 | do_log(SMB_VFS_OP_DISCONNECT, True, handle,
|
---|
645 | "%s", lp_servicename(SNUM(handle->conn)));
|
---|
646 |
|
---|
647 | /* The bitmaps will be disconnected when the private
|
---|
648 | data is deleted. */
|
---|
649 |
|
---|
650 | return;
|
---|
651 | }
|
---|
652 |
|
---|
653 | static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
|
---|
654 | const char *path,
|
---|
655 | bool small_query, uint64_t *bsize,
|
---|
656 | uint64_t *dfree, uint64_t *dsize)
|
---|
657 | {
|
---|
658 | uint64_t result;
|
---|
659 |
|
---|
660 | result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
|
---|
661 | dfree, dsize);
|
---|
662 |
|
---|
663 | /* Don't have a reasonable notion of failure here */
|
---|
664 |
|
---|
665 | do_log(SMB_VFS_OP_DISK_FREE, True, handle, "%s", path);
|
---|
666 |
|
---|
667 | return result;
|
---|
668 | }
|
---|
669 |
|
---|
670 | static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
|
---|
671 | enum SMB_QUOTA_TYPE qtype, unid_t id,
|
---|
672 | SMB_DISK_QUOTA *qt)
|
---|
673 | {
|
---|
674 | int result;
|
---|
675 |
|
---|
676 | result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
|
---|
677 |
|
---|
678 | do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "");
|
---|
679 |
|
---|
680 | return result;
|
---|
681 | }
|
---|
682 |
|
---|
683 |
|
---|
684 | static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
|
---|
685 | enum SMB_QUOTA_TYPE qtype, unid_t id,
|
---|
686 | SMB_DISK_QUOTA *qt)
|
---|
687 | {
|
---|
688 | int result;
|
---|
689 |
|
---|
690 | result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
|
---|
691 |
|
---|
692 | do_log(SMB_VFS_OP_SET_QUOTA, (result >= 0), handle, "");
|
---|
693 |
|
---|
694 | return result;
|
---|
695 | }
|
---|
696 |
|
---|
697 | static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
|
---|
698 | struct files_struct *fsp,
|
---|
699 | struct shadow_copy_data *shadow_copy_data,
|
---|
700 | bool labels)
|
---|
701 | {
|
---|
702 | int result;
|
---|
703 |
|
---|
704 | result = SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
|
---|
705 |
|
---|
706 | do_log(SMB_VFS_OP_GET_SHADOW_COPY_DATA, (result >= 0), handle, "");
|
---|
707 |
|
---|
708 | return result;
|
---|
709 | }
|
---|
710 |
|
---|
711 | static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
|
---|
712 | const char *path,
|
---|
713 | struct vfs_statvfs_struct *statbuf)
|
---|
714 | {
|
---|
715 | int result;
|
---|
716 |
|
---|
717 | result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
|
---|
718 |
|
---|
719 | do_log(SMB_VFS_OP_STATVFS, (result >= 0), handle, "");
|
---|
720 |
|
---|
721 | return result;
|
---|
722 | }
|
---|
723 |
|
---|
724 | static uint32_t smb_full_audit_fs_capabilities(struct vfs_handle_struct *handle, enum timestamp_set_resolution *p_ts_res)
|
---|
725 | {
|
---|
726 | int result;
|
---|
727 |
|
---|
728 | result = SMB_VFS_NEXT_FS_CAPABILITIES(handle, p_ts_res);
|
---|
729 |
|
---|
730 | do_log(SMB_VFS_OP_FS_CAPABILITIES, true, handle, "");
|
---|
731 |
|
---|
732 | return result;
|
---|
733 | }
|
---|
734 |
|
---|
735 | static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
|
---|
736 | const char *fname, const char *mask, uint32 attr)
|
---|
737 | {
|
---|
738 | SMB_STRUCT_DIR *result;
|
---|
739 |
|
---|
740 | result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
|
---|
741 |
|
---|
742 | do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
|
---|
743 |
|
---|
744 | return result;
|
---|
745 | }
|
---|
746 |
|
---|
747 | static SMB_STRUCT_DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
|
---|
748 | files_struct *fsp, const char *mask, uint32 attr)
|
---|
749 | {
|
---|
750 | SMB_STRUCT_DIR *result;
|
---|
751 |
|
---|
752 | result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
|
---|
753 |
|
---|
754 | do_log(SMB_VFS_OP_FDOPENDIR, (result != NULL), handle, "%s",
|
---|
755 | fsp_str_do_log(fsp));
|
---|
756 |
|
---|
757 | return result;
|
---|
758 | }
|
---|
759 |
|
---|
760 | static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
|
---|
761 | SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf)
|
---|
762 | {
|
---|
763 | SMB_STRUCT_DIRENT *result;
|
---|
764 |
|
---|
765 | result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
|
---|
766 |
|
---|
767 | /* This operation has no reasonable error condition
|
---|
768 | * (End of dir is also failure), so always succeed.
|
---|
769 | */
|
---|
770 | do_log(SMB_VFS_OP_READDIR, True, handle, "");
|
---|
771 |
|
---|
772 | return result;
|
---|
773 | }
|
---|
774 |
|
---|
775 | static void smb_full_audit_seekdir(vfs_handle_struct *handle,
|
---|
776 | SMB_STRUCT_DIR *dirp, long offset)
|
---|
777 | {
|
---|
778 | SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
|
---|
779 |
|
---|
780 | do_log(SMB_VFS_OP_SEEKDIR, True, handle, "");
|
---|
781 | return;
|
---|
782 | }
|
---|
783 |
|
---|
784 | static long smb_full_audit_telldir(vfs_handle_struct *handle,
|
---|
785 | SMB_STRUCT_DIR *dirp)
|
---|
786 | {
|
---|
787 | long result;
|
---|
788 |
|
---|
789 | result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
|
---|
790 |
|
---|
791 | do_log(SMB_VFS_OP_TELLDIR, True, handle, "");
|
---|
792 |
|
---|
793 | return result;
|
---|
794 | }
|
---|
795 |
|
---|
796 | static void smb_full_audit_rewinddir(vfs_handle_struct *handle,
|
---|
797 | SMB_STRUCT_DIR *dirp)
|
---|
798 | {
|
---|
799 | SMB_VFS_NEXT_REWINDDIR(handle, dirp);
|
---|
800 |
|
---|
801 | do_log(SMB_VFS_OP_REWINDDIR, True, handle, "");
|
---|
802 | return;
|
---|
803 | }
|
---|
804 |
|
---|
805 | static int smb_full_audit_mkdir(vfs_handle_struct *handle,
|
---|
806 | const char *path, mode_t mode)
|
---|
807 | {
|
---|
808 | int result;
|
---|
809 |
|
---|
810 | result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
|
---|
811 |
|
---|
812 | do_log(SMB_VFS_OP_MKDIR, (result >= 0), handle, "%s", path);
|
---|
813 |
|
---|
814 | return result;
|
---|
815 | }
|
---|
816 |
|
---|
817 | static int smb_full_audit_rmdir(vfs_handle_struct *handle,
|
---|
818 | const char *path)
|
---|
819 | {
|
---|
820 | int result;
|
---|
821 |
|
---|
822 | result = SMB_VFS_NEXT_RMDIR(handle, path);
|
---|
823 |
|
---|
824 | do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s", path);
|
---|
825 |
|
---|
826 | return result;
|
---|
827 | }
|
---|
828 |
|
---|
829 | static int smb_full_audit_closedir(vfs_handle_struct *handle,
|
---|
830 | SMB_STRUCT_DIR *dirp)
|
---|
831 | {
|
---|
832 | int result;
|
---|
833 |
|
---|
834 | result = SMB_VFS_NEXT_CLOSEDIR(handle, dirp);
|
---|
835 |
|
---|
836 | do_log(SMB_VFS_OP_CLOSEDIR, (result >= 0), handle, "");
|
---|
837 |
|
---|
838 | return result;
|
---|
839 | }
|
---|
840 |
|
---|
841 | static void smb_full_audit_init_search_op(vfs_handle_struct *handle,
|
---|
842 | SMB_STRUCT_DIR *dirp)
|
---|
843 | {
|
---|
844 | SMB_VFS_NEXT_INIT_SEARCH_OP(handle, dirp);
|
---|
845 |
|
---|
846 | do_log(SMB_VFS_OP_INIT_SEARCH_OP, True, handle, "");
|
---|
847 | return;
|
---|
848 | }
|
---|
849 |
|
---|
850 | static int smb_full_audit_open(vfs_handle_struct *handle,
|
---|
851 | struct smb_filename *smb_fname,
|
---|
852 | files_struct *fsp, int flags, mode_t mode)
|
---|
853 | {
|
---|
854 | int result;
|
---|
855 |
|
---|
856 | result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
|
---|
857 |
|
---|
858 | do_log(SMB_VFS_OP_OPEN, (result >= 0), handle, "%s|%s",
|
---|
859 | ((flags & O_WRONLY) || (flags & O_RDWR))?"w":"r",
|
---|
860 | smb_fname_str_do_log(smb_fname));
|
---|
861 |
|
---|
862 | return result;
|
---|
863 | }
|
---|
864 |
|
---|
865 | static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
|
---|
866 | struct smb_request *req,
|
---|
867 | uint16_t root_dir_fid,
|
---|
868 | struct smb_filename *smb_fname,
|
---|
869 | uint32_t access_mask,
|
---|
870 | uint32_t share_access,
|
---|
871 | uint32_t create_disposition,
|
---|
872 | uint32_t create_options,
|
---|
873 | uint32_t file_attributes,
|
---|
874 | uint32_t oplock_request,
|
---|
875 | uint64_t allocation_size,
|
---|
876 | uint32_t private_flags,
|
---|
877 | struct security_descriptor *sd,
|
---|
878 | struct ea_list *ea_list,
|
---|
879 | files_struct **result_fsp,
|
---|
880 | int *pinfo)
|
---|
881 | {
|
---|
882 | NTSTATUS result;
|
---|
883 | const char* str_create_disposition;
|
---|
884 |
|
---|
885 | switch (create_disposition) {
|
---|
886 | case FILE_SUPERSEDE:
|
---|
887 | str_create_disposition = "supersede";
|
---|
888 | break;
|
---|
889 | case FILE_OVERWRITE_IF:
|
---|
890 | str_create_disposition = "overwrite_if";
|
---|
891 | break;
|
---|
892 | case FILE_OPEN:
|
---|
893 | str_create_disposition = "open";
|
---|
894 | break;
|
---|
895 | case FILE_OVERWRITE:
|
---|
896 | str_create_disposition = "overwrite";
|
---|
897 | break;
|
---|
898 | case FILE_CREATE:
|
---|
899 | str_create_disposition = "create";
|
---|
900 | break;
|
---|
901 | case FILE_OPEN_IF:
|
---|
902 | str_create_disposition = "open_if";
|
---|
903 | break;
|
---|
904 | default:
|
---|
905 | str_create_disposition = "unknown";
|
---|
906 | }
|
---|
907 |
|
---|
908 | result = SMB_VFS_NEXT_CREATE_FILE(
|
---|
909 | handle, /* handle */
|
---|
910 | req, /* req */
|
---|
911 | root_dir_fid, /* root_dir_fid */
|
---|
912 | smb_fname, /* fname */
|
---|
913 | access_mask, /* access_mask */
|
---|
914 | share_access, /* share_access */
|
---|
915 | create_disposition, /* create_disposition*/
|
---|
916 | create_options, /* create_options */
|
---|
917 | file_attributes, /* file_attributes */
|
---|
918 | oplock_request, /* oplock_request */
|
---|
919 | allocation_size, /* allocation_size */
|
---|
920 | private_flags,
|
---|
921 | sd, /* sd */
|
---|
922 | ea_list, /* ea_list */
|
---|
923 | result_fsp, /* result */
|
---|
924 | pinfo); /* pinfo */
|
---|
925 |
|
---|
926 | do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
|
---|
927 | "0x%x|%s|%s|%s", access_mask,
|
---|
928 | create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
|
---|
929 | str_create_disposition, smb_fname_str_do_log(smb_fname));
|
---|
930 |
|
---|
931 | return result;
|
---|
932 | }
|
---|
933 |
|
---|
934 | static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
|
---|
935 | {
|
---|
936 | int result;
|
---|
937 |
|
---|
938 | result = SMB_VFS_NEXT_CLOSE(handle, fsp);
|
---|
939 |
|
---|
940 | do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s",
|
---|
941 | fsp_str_do_log(fsp));
|
---|
942 |
|
---|
943 | return result;
|
---|
944 | }
|
---|
945 |
|
---|
946 | static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
|
---|
947 | void *data, size_t n)
|
---|
948 | {
|
---|
949 | ssize_t result;
|
---|
950 |
|
---|
951 | result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
|
---|
952 |
|
---|
953 | do_log(SMB_VFS_OP_READ, (result >= 0), handle, "%s",
|
---|
954 | fsp_str_do_log(fsp));
|
---|
955 |
|
---|
956 | return result;
|
---|
957 | }
|
---|
958 |
|
---|
959 | static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
|
---|
960 | void *data, size_t n, SMB_OFF_T offset)
|
---|
961 | {
|
---|
962 | ssize_t result;
|
---|
963 |
|
---|
964 | result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
|
---|
965 |
|
---|
966 | do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s",
|
---|
967 | fsp_str_do_log(fsp));
|
---|
968 |
|
---|
969 | return result;
|
---|
970 | }
|
---|
971 |
|
---|
972 | static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
|
---|
973 | const void *data, size_t n)
|
---|
974 | {
|
---|
975 | ssize_t result;
|
---|
976 |
|
---|
977 | result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
|
---|
978 |
|
---|
979 | do_log(SMB_VFS_OP_WRITE, (result >= 0), handle, "%s",
|
---|
980 | fsp_str_do_log(fsp));
|
---|
981 |
|
---|
982 | return result;
|
---|
983 | }
|
---|
984 |
|
---|
985 | static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
|
---|
986 | const void *data, size_t n,
|
---|
987 | SMB_OFF_T offset)
|
---|
988 | {
|
---|
989 | ssize_t result;
|
---|
990 |
|
---|
991 | result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
|
---|
992 |
|
---|
993 | do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s",
|
---|
994 | fsp_str_do_log(fsp));
|
---|
995 |
|
---|
996 | return result;
|
---|
997 | }
|
---|
998 |
|
---|
999 | static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1000 | SMB_OFF_T offset, int whence)
|
---|
1001 | {
|
---|
1002 | ssize_t result;
|
---|
1003 |
|
---|
1004 | result = SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence);
|
---|
1005 |
|
---|
1006 | do_log(SMB_VFS_OP_LSEEK, (result != (ssize_t)-1), handle,
|
---|
1007 | "%s", fsp_str_do_log(fsp));
|
---|
1008 |
|
---|
1009 | return result;
|
---|
1010 | }
|
---|
1011 |
|
---|
1012 | static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
|
---|
1013 | files_struct *fromfsp,
|
---|
1014 | const DATA_BLOB *hdr, SMB_OFF_T offset,
|
---|
1015 | size_t n)
|
---|
1016 | {
|
---|
1017 | ssize_t result;
|
---|
1018 |
|
---|
1019 | result = SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n);
|
---|
1020 |
|
---|
1021 | do_log(SMB_VFS_OP_SENDFILE, (result >= 0), handle,
|
---|
1022 | "%s", fsp_str_do_log(fromfsp));
|
---|
1023 |
|
---|
1024 | return result;
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
|
---|
1028 | files_struct *tofsp,
|
---|
1029 | SMB_OFF_T offset,
|
---|
1030 | size_t n)
|
---|
1031 | {
|
---|
1032 | ssize_t result;
|
---|
1033 |
|
---|
1034 | result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n);
|
---|
1035 |
|
---|
1036 | do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
|
---|
1037 | "%s", fsp_str_do_log(tofsp));
|
---|
1038 |
|
---|
1039 | return result;
|
---|
1040 | }
|
---|
1041 |
|
---|
1042 | static int smb_full_audit_rename(vfs_handle_struct *handle,
|
---|
1043 | const struct smb_filename *smb_fname_src,
|
---|
1044 | const struct smb_filename *smb_fname_dst)
|
---|
1045 | {
|
---|
1046 | int result;
|
---|
1047 |
|
---|
1048 | result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
|
---|
1049 |
|
---|
1050 | do_log(SMB_VFS_OP_RENAME, (result >= 0), handle, "%s|%s",
|
---|
1051 | smb_fname_str_do_log(smb_fname_src),
|
---|
1052 | smb_fname_str_do_log(smb_fname_dst));
|
---|
1053 |
|
---|
1054 | return result;
|
---|
1055 | }
|
---|
1056 |
|
---|
1057 | static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
|
---|
1058 | {
|
---|
1059 | int result;
|
---|
1060 |
|
---|
1061 | result = SMB_VFS_NEXT_FSYNC(handle, fsp);
|
---|
1062 |
|
---|
1063 | do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s",
|
---|
1064 | fsp_str_do_log(fsp));
|
---|
1065 |
|
---|
1066 | return result;
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 | static int smb_full_audit_stat(vfs_handle_struct *handle,
|
---|
1070 | struct smb_filename *smb_fname)
|
---|
1071 | {
|
---|
1072 | int result;
|
---|
1073 |
|
---|
1074 | result = SMB_VFS_NEXT_STAT(handle, smb_fname);
|
---|
1075 |
|
---|
1076 | do_log(SMB_VFS_OP_STAT, (result >= 0), handle, "%s",
|
---|
1077 | smb_fname_str_do_log(smb_fname));
|
---|
1078 |
|
---|
1079 | return result;
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | static int smb_full_audit_fstat(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1083 | SMB_STRUCT_STAT *sbuf)
|
---|
1084 | {
|
---|
1085 | int result;
|
---|
1086 |
|
---|
1087 | result = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
|
---|
1088 |
|
---|
1089 | do_log(SMB_VFS_OP_FSTAT, (result >= 0), handle, "%s",
|
---|
1090 | fsp_str_do_log(fsp));
|
---|
1091 |
|
---|
1092 | return result;
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 | static int smb_full_audit_lstat(vfs_handle_struct *handle,
|
---|
1096 | struct smb_filename *smb_fname)
|
---|
1097 | {
|
---|
1098 | int result;
|
---|
1099 |
|
---|
1100 | result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
|
---|
1101 |
|
---|
1102 | do_log(SMB_VFS_OP_LSTAT, (result >= 0), handle, "%s",
|
---|
1103 | smb_fname_str_do_log(smb_fname));
|
---|
1104 |
|
---|
1105 | return result;
|
---|
1106 | }
|
---|
1107 |
|
---|
1108 | static uint64_t smb_full_audit_get_alloc_size(vfs_handle_struct *handle,
|
---|
1109 | files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
|
---|
1110 | {
|
---|
1111 | uint64_t result;
|
---|
1112 |
|
---|
1113 | result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
|
---|
1114 |
|
---|
1115 | do_log(SMB_VFS_OP_GET_ALLOC_SIZE, (result != (uint64_t)-1), handle,
|
---|
1116 | "%llu", result);
|
---|
1117 |
|
---|
1118 | return result;
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | static int smb_full_audit_unlink(vfs_handle_struct *handle,
|
---|
1122 | const struct smb_filename *smb_fname)
|
---|
1123 | {
|
---|
1124 | int result;
|
---|
1125 |
|
---|
1126 | result = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
---|
1127 |
|
---|
1128 | do_log(SMB_VFS_OP_UNLINK, (result >= 0), handle, "%s",
|
---|
1129 | smb_fname_str_do_log(smb_fname));
|
---|
1130 |
|
---|
1131 | return result;
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 | static int smb_full_audit_chmod(vfs_handle_struct *handle,
|
---|
1135 | const char *path, mode_t mode)
|
---|
1136 | {
|
---|
1137 | int result;
|
---|
1138 |
|
---|
1139 | result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
|
---|
1140 |
|
---|
1141 | do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o", path, mode);
|
---|
1142 |
|
---|
1143 | return result;
|
---|
1144 | }
|
---|
1145 |
|
---|
1146 | static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1147 | mode_t mode)
|
---|
1148 | {
|
---|
1149 | int result;
|
---|
1150 |
|
---|
1151 | result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode);
|
---|
1152 |
|
---|
1153 | do_log(SMB_VFS_OP_FCHMOD, (result >= 0), handle,
|
---|
1154 | "%s|%o", fsp_str_do_log(fsp), mode);
|
---|
1155 |
|
---|
1156 | return result;
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 | static int smb_full_audit_chown(vfs_handle_struct *handle,
|
---|
1160 | const char *path, uid_t uid, gid_t gid)
|
---|
1161 | {
|
---|
1162 | int result;
|
---|
1163 |
|
---|
1164 | result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
|
---|
1165 |
|
---|
1166 | do_log(SMB_VFS_OP_CHOWN, (result >= 0), handle, "%s|%ld|%ld",
|
---|
1167 | path, (long int)uid, (long int)gid);
|
---|
1168 |
|
---|
1169 | return result;
|
---|
1170 | }
|
---|
1171 |
|
---|
1172 | static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1173 | uid_t uid, gid_t gid)
|
---|
1174 | {
|
---|
1175 | int result;
|
---|
1176 |
|
---|
1177 | result = SMB_VFS_NEXT_FCHOWN(handle, fsp, uid, gid);
|
---|
1178 |
|
---|
1179 | do_log(SMB_VFS_OP_FCHOWN, (result >= 0), handle, "%s|%ld|%ld",
|
---|
1180 | fsp_str_do_log(fsp), (long int)uid, (long int)gid);
|
---|
1181 |
|
---|
1182 | return result;
|
---|
1183 | }
|
---|
1184 |
|
---|
1185 | static int smb_full_audit_lchown(vfs_handle_struct *handle,
|
---|
1186 | const char *path, uid_t uid, gid_t gid)
|
---|
1187 | {
|
---|
1188 | int result;
|
---|
1189 |
|
---|
1190 | result = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
|
---|
1191 |
|
---|
1192 | do_log(SMB_VFS_OP_LCHOWN, (result >= 0), handle, "%s|%ld|%ld",
|
---|
1193 | path, (long int)uid, (long int)gid);
|
---|
1194 |
|
---|
1195 | return result;
|
---|
1196 | }
|
---|
1197 |
|
---|
1198 | static int smb_full_audit_chdir(vfs_handle_struct *handle,
|
---|
1199 | const char *path)
|
---|
1200 | {
|
---|
1201 | int result;
|
---|
1202 |
|
---|
1203 | result = SMB_VFS_NEXT_CHDIR(handle, path);
|
---|
1204 |
|
---|
1205 | do_log(SMB_VFS_OP_CHDIR, (result >= 0), handle, "chdir|%s", path);
|
---|
1206 |
|
---|
1207 | return result;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | static char *smb_full_audit_getwd(vfs_handle_struct *handle,
|
---|
1211 | char *path)
|
---|
1212 | {
|
---|
1213 | char *result;
|
---|
1214 |
|
---|
1215 | result = SMB_VFS_NEXT_GETWD(handle, path);
|
---|
1216 |
|
---|
1217 | do_log(SMB_VFS_OP_GETWD, (result != NULL), handle, "%s", path);
|
---|
1218 |
|
---|
1219 | return result;
|
---|
1220 | }
|
---|
1221 |
|
---|
1222 | static int smb_full_audit_ntimes(vfs_handle_struct *handle,
|
---|
1223 | const struct smb_filename *smb_fname,
|
---|
1224 | struct smb_file_time *ft)
|
---|
1225 | {
|
---|
1226 | int result;
|
---|
1227 |
|
---|
1228 | result = SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
|
---|
1229 |
|
---|
1230 | do_log(SMB_VFS_OP_NTIMES, (result >= 0), handle, "%s",
|
---|
1231 | smb_fname_str_do_log(smb_fname));
|
---|
1232 |
|
---|
1233 | return result;
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1237 | SMB_OFF_T len)
|
---|
1238 | {
|
---|
1239 | int result;
|
---|
1240 |
|
---|
1241 | result = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, len);
|
---|
1242 |
|
---|
1243 | do_log(SMB_VFS_OP_FTRUNCATE, (result >= 0), handle,
|
---|
1244 | "%s", fsp_str_do_log(fsp));
|
---|
1245 |
|
---|
1246 | return result;
|
---|
1247 | }
|
---|
1248 |
|
---|
1249 | static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1250 | enum vfs_fallocate_mode mode,
|
---|
1251 | SMB_OFF_T offset,
|
---|
1252 | SMB_OFF_T len)
|
---|
1253 | {
|
---|
1254 | int result;
|
---|
1255 |
|
---|
1256 | result = SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len);
|
---|
1257 |
|
---|
1258 | do_log(SMB_VFS_OP_FALLOCATE, (result >= 0), handle,
|
---|
1259 | "%s", fsp_str_do_log(fsp));
|
---|
1260 |
|
---|
1261 | return result;
|
---|
1262 | }
|
---|
1263 |
|
---|
1264 | static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1265 | int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
|
---|
1266 | {
|
---|
1267 | bool result;
|
---|
1268 |
|
---|
1269 | result = SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type);
|
---|
1270 |
|
---|
1271 | do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp_str_do_log(fsp));
|
---|
1272 |
|
---|
1273 | return result;
|
---|
1274 | }
|
---|
1275 |
|
---|
1276 | static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
|
---|
1277 | struct files_struct *fsp,
|
---|
1278 | uint32 share_mode, uint32 access_mask)
|
---|
1279 | {
|
---|
1280 | int result;
|
---|
1281 |
|
---|
1282 | result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_mode, access_mask);
|
---|
1283 |
|
---|
1284 | do_log(SMB_VFS_OP_KERNEL_FLOCK, (result >= 0), handle, "%s",
|
---|
1285 | fsp_str_do_log(fsp));
|
---|
1286 |
|
---|
1287 | return result;
|
---|
1288 | }
|
---|
1289 |
|
---|
1290 | static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1291 | int leasetype)
|
---|
1292 | {
|
---|
1293 | int result;
|
---|
1294 |
|
---|
1295 | result = SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype);
|
---|
1296 |
|
---|
1297 | do_log(SMB_VFS_OP_LINUX_SETLEASE, (result >= 0), handle, "%s",
|
---|
1298 | fsp_str_do_log(fsp));
|
---|
1299 |
|
---|
1300 | return result;
|
---|
1301 | }
|
---|
1302 |
|
---|
1303 | static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1304 | SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
|
---|
1305 | {
|
---|
1306 | bool result;
|
---|
1307 |
|
---|
1308 | result = SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid);
|
---|
1309 |
|
---|
1310 | do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp_str_do_log(fsp));
|
---|
1311 |
|
---|
1312 | return result;
|
---|
1313 | }
|
---|
1314 |
|
---|
1315 | static int smb_full_audit_symlink(vfs_handle_struct *handle,
|
---|
1316 | const char *oldpath, const char *newpath)
|
---|
1317 | {
|
---|
1318 | int result;
|
---|
1319 |
|
---|
1320 | result = SMB_VFS_NEXT_SYMLINK(handle, oldpath, newpath);
|
---|
1321 |
|
---|
1322 | do_log(SMB_VFS_OP_SYMLINK, (result >= 0), handle,
|
---|
1323 | "%s|%s", oldpath, newpath);
|
---|
1324 |
|
---|
1325 | return result;
|
---|
1326 | }
|
---|
1327 |
|
---|
1328 | static int smb_full_audit_readlink(vfs_handle_struct *handle,
|
---|
1329 | const char *path, char *buf, size_t bufsiz)
|
---|
1330 | {
|
---|
1331 | int result;
|
---|
1332 |
|
---|
1333 | result = SMB_VFS_NEXT_READLINK(handle, path, buf, bufsiz);
|
---|
1334 |
|
---|
1335 | do_log(SMB_VFS_OP_READLINK, (result >= 0), handle, "%s", path);
|
---|
1336 |
|
---|
1337 | return result;
|
---|
1338 | }
|
---|
1339 |
|
---|
1340 | static int smb_full_audit_link(vfs_handle_struct *handle,
|
---|
1341 | const char *oldpath, const char *newpath)
|
---|
1342 | {
|
---|
1343 | int result;
|
---|
1344 |
|
---|
1345 | result = SMB_VFS_NEXT_LINK(handle, oldpath, newpath);
|
---|
1346 |
|
---|
1347 | do_log(SMB_VFS_OP_LINK, (result >= 0), handle,
|
---|
1348 | "%s|%s", oldpath, newpath);
|
---|
1349 |
|
---|
1350 | return result;
|
---|
1351 | }
|
---|
1352 |
|
---|
1353 | static int smb_full_audit_mknod(vfs_handle_struct *handle,
|
---|
1354 | const char *pathname, mode_t mode, SMB_DEV_T dev)
|
---|
1355 | {
|
---|
1356 | int result;
|
---|
1357 |
|
---|
1358 | result = SMB_VFS_NEXT_MKNOD(handle, pathname, mode, dev);
|
---|
1359 |
|
---|
1360 | do_log(SMB_VFS_OP_MKNOD, (result >= 0), handle, "%s", pathname);
|
---|
1361 |
|
---|
1362 | return result;
|
---|
1363 | }
|
---|
1364 |
|
---|
1365 | static char *smb_full_audit_realpath(vfs_handle_struct *handle,
|
---|
1366 | const char *path)
|
---|
1367 | {
|
---|
1368 | char *result;
|
---|
1369 |
|
---|
1370 | result = SMB_VFS_NEXT_REALPATH(handle, path);
|
---|
1371 |
|
---|
1372 | do_log(SMB_VFS_OP_REALPATH, (result != NULL), handle, "%s", path);
|
---|
1373 |
|
---|
1374 | return result;
|
---|
1375 | }
|
---|
1376 |
|
---|
1377 | static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
|
---|
1378 | struct sys_notify_context *ctx,
|
---|
1379 | struct notify_entry *e,
|
---|
1380 | void (*callback)(struct sys_notify_context *ctx,
|
---|
1381 | void *private_data,
|
---|
1382 | struct notify_event *ev),
|
---|
1383 | void *private_data, void *handle_p)
|
---|
1384 | {
|
---|
1385 | NTSTATUS result;
|
---|
1386 |
|
---|
1387 | result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback, private_data, handle_p);
|
---|
1388 |
|
---|
1389 | do_log(SMB_VFS_OP_NOTIFY_WATCH, NT_STATUS_IS_OK(result), handle, "");
|
---|
1390 |
|
---|
1391 | return result;
|
---|
1392 | }
|
---|
1393 |
|
---|
1394 | static int smb_full_audit_chflags(vfs_handle_struct *handle,
|
---|
1395 | const char *path, unsigned int flags)
|
---|
1396 | {
|
---|
1397 | int result;
|
---|
1398 |
|
---|
1399 | result = SMB_VFS_NEXT_CHFLAGS(handle, path, flags);
|
---|
1400 |
|
---|
1401 | do_log(SMB_VFS_OP_CHFLAGS, (result != 0), handle, "%s", path);
|
---|
1402 |
|
---|
1403 | return result;
|
---|
1404 | }
|
---|
1405 |
|
---|
1406 | static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
|
---|
1407 | const SMB_STRUCT_STAT *sbuf)
|
---|
1408 | {
|
---|
1409 | struct file_id id_zero;
|
---|
1410 | struct file_id result;
|
---|
1411 |
|
---|
1412 | ZERO_STRUCT(id_zero);
|
---|
1413 |
|
---|
1414 | result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, sbuf);
|
---|
1415 |
|
---|
1416 | do_log(SMB_VFS_OP_FILE_ID_CREATE,
|
---|
1417 | !file_id_equal(&id_zero, &result),
|
---|
1418 | handle, "%s", file_id_string_tos(&result));
|
---|
1419 |
|
---|
1420 | return result;
|
---|
1421 | }
|
---|
1422 |
|
---|
1423 | static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
|
---|
1424 | struct files_struct *fsp,
|
---|
1425 | const char *fname,
|
---|
1426 | TALLOC_CTX *mem_ctx,
|
---|
1427 | unsigned int *pnum_streams,
|
---|
1428 | struct stream_struct **pstreams)
|
---|
1429 | {
|
---|
1430 | NTSTATUS result;
|
---|
1431 |
|
---|
1432 | result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
|
---|
1433 | pnum_streams, pstreams);
|
---|
1434 |
|
---|
1435 | do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle,
|
---|
1436 | "%s", fname);
|
---|
1437 |
|
---|
1438 | return result;
|
---|
1439 | }
|
---|
1440 |
|
---|
1441 | static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
|
---|
1442 | const char *path,
|
---|
1443 | const char *name,
|
---|
1444 | TALLOC_CTX *mem_ctx,
|
---|
1445 | char **found_name)
|
---|
1446 | {
|
---|
1447 | int result;
|
---|
1448 |
|
---|
1449 | result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
|
---|
1450 | found_name);
|
---|
1451 |
|
---|
1452 | do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle,
|
---|
1453 | "%s/%s->%s", path, name, (result == 0) ? "" : *found_name);
|
---|
1454 |
|
---|
1455 | return result;
|
---|
1456 | }
|
---|
1457 |
|
---|
1458 | static const char *smb_full_audit_connectpath(vfs_handle_struct *handle,
|
---|
1459 | const char *fname)
|
---|
1460 | {
|
---|
1461 | const char *result;
|
---|
1462 |
|
---|
1463 | result = SMB_VFS_NEXT_CONNECTPATH(handle, fname);
|
---|
1464 |
|
---|
1465 | do_log(SMB_VFS_OP_CONNECTPATH, result != NULL, handle,
|
---|
1466 | "%s", fname);
|
---|
1467 |
|
---|
1468 | return result;
|
---|
1469 | }
|
---|
1470 |
|
---|
1471 | static NTSTATUS smb_full_audit_brl_lock_windows(struct vfs_handle_struct *handle,
|
---|
1472 | struct byte_range_lock *br_lck,
|
---|
1473 | struct lock_struct *plock,
|
---|
1474 | bool blocking_lock,
|
---|
1475 | struct blocking_lock_record *blr)
|
---|
1476 | {
|
---|
1477 | NTSTATUS result;
|
---|
1478 |
|
---|
1479 | result = SMB_VFS_NEXT_BRL_LOCK_WINDOWS(handle, br_lck, plock,
|
---|
1480 | blocking_lock, blr);
|
---|
1481 |
|
---|
1482 | do_log(SMB_VFS_OP_BRL_LOCK_WINDOWS, NT_STATUS_IS_OK(result), handle,
|
---|
1483 | "%s:%llu-%llu. type=%d. blocking=%d", fsp_str_do_log(br_lck->fsp),
|
---|
1484 | plock->start, plock->size, plock->lock_type, blocking_lock );
|
---|
1485 |
|
---|
1486 | return result;
|
---|
1487 | }
|
---|
1488 |
|
---|
1489 | static bool smb_full_audit_brl_unlock_windows(struct vfs_handle_struct *handle,
|
---|
1490 | struct messaging_context *msg_ctx,
|
---|
1491 | struct byte_range_lock *br_lck,
|
---|
1492 | const struct lock_struct *plock)
|
---|
1493 | {
|
---|
1494 | bool result;
|
---|
1495 |
|
---|
1496 | result = SMB_VFS_NEXT_BRL_UNLOCK_WINDOWS(handle, msg_ctx, br_lck,
|
---|
1497 | plock);
|
---|
1498 |
|
---|
1499 | do_log(SMB_VFS_OP_BRL_UNLOCK_WINDOWS, (result == 0), handle,
|
---|
1500 | "%s:%llu-%llu:%d", fsp_str_do_log(br_lck->fsp), plock->start,
|
---|
1501 | plock->size, plock->lock_type);
|
---|
1502 |
|
---|
1503 | return result;
|
---|
1504 | }
|
---|
1505 |
|
---|
1506 | static bool smb_full_audit_brl_cancel_windows(struct vfs_handle_struct *handle,
|
---|
1507 | struct byte_range_lock *br_lck,
|
---|
1508 | struct lock_struct *plock,
|
---|
1509 | struct blocking_lock_record *blr)
|
---|
1510 | {
|
---|
1511 | bool result;
|
---|
1512 |
|
---|
1513 | result = SMB_VFS_NEXT_BRL_CANCEL_WINDOWS(handle, br_lck, plock, blr);
|
---|
1514 |
|
---|
1515 | do_log(SMB_VFS_OP_BRL_CANCEL_WINDOWS, (result == 0), handle,
|
---|
1516 | "%s:%llu-%llu:%d", fsp_str_do_log(br_lck->fsp), plock->start,
|
---|
1517 | plock->size);
|
---|
1518 |
|
---|
1519 | return result;
|
---|
1520 | }
|
---|
1521 |
|
---|
1522 | static bool smb_full_audit_strict_lock(struct vfs_handle_struct *handle,
|
---|
1523 | struct files_struct *fsp,
|
---|
1524 | struct lock_struct *plock)
|
---|
1525 | {
|
---|
1526 | bool result;
|
---|
1527 |
|
---|
1528 | result = SMB_VFS_NEXT_STRICT_LOCK(handle, fsp, plock);
|
---|
1529 |
|
---|
1530 | do_log(SMB_VFS_OP_STRICT_LOCK, result, handle,
|
---|
1531 | "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
|
---|
1532 | plock->size);
|
---|
1533 |
|
---|
1534 | return result;
|
---|
1535 | }
|
---|
1536 |
|
---|
1537 | static void smb_full_audit_strict_unlock(struct vfs_handle_struct *handle,
|
---|
1538 | struct files_struct *fsp,
|
---|
1539 | struct lock_struct *plock)
|
---|
1540 | {
|
---|
1541 | SMB_VFS_NEXT_STRICT_UNLOCK(handle, fsp, plock);
|
---|
1542 |
|
---|
1543 | do_log(SMB_VFS_OP_STRICT_UNLOCK, true, handle,
|
---|
1544 | "%s:%llu-%llu:%d", fsp_str_do_log(fsp), plock->start,
|
---|
1545 | plock->size);
|
---|
1546 |
|
---|
1547 | return;
|
---|
1548 | }
|
---|
1549 |
|
---|
1550 | static NTSTATUS smb_full_audit_translate_name(struct vfs_handle_struct *handle,
|
---|
1551 | const char *name,
|
---|
1552 | enum vfs_translate_direction direction,
|
---|
1553 | TALLOC_CTX *mem_ctx,
|
---|
1554 | char **mapped_name)
|
---|
1555 | {
|
---|
1556 | NTSTATUS result;
|
---|
1557 |
|
---|
1558 | result = SMB_VFS_NEXT_TRANSLATE_NAME(handle, name, direction, mem_ctx,
|
---|
1559 | mapped_name);
|
---|
1560 |
|
---|
1561 | do_log(SMB_VFS_OP_TRANSLATE_NAME, NT_STATUS_IS_OK(result), handle, "");
|
---|
1562 |
|
---|
1563 | return result;
|
---|
1564 | }
|
---|
1565 |
|
---|
1566 | static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1567 | uint32 security_info,
|
---|
1568 | struct security_descriptor **ppdesc)
|
---|
1569 | {
|
---|
1570 | NTSTATUS result;
|
---|
1571 |
|
---|
1572 | result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
|
---|
1573 |
|
---|
1574 | do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
|
---|
1575 | "%s", fsp_str_do_log(fsp));
|
---|
1576 |
|
---|
1577 | return result;
|
---|
1578 | }
|
---|
1579 |
|
---|
1580 | static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
|
---|
1581 | const char *name,
|
---|
1582 | uint32 security_info,
|
---|
1583 | struct security_descriptor **ppdesc)
|
---|
1584 | {
|
---|
1585 | NTSTATUS result;
|
---|
1586 |
|
---|
1587 | result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
|
---|
1588 |
|
---|
1589 | do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
|
---|
1590 | "%s", name);
|
---|
1591 |
|
---|
1592 | return result;
|
---|
1593 | }
|
---|
1594 |
|
---|
1595 | static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1596 | uint32 security_info_sent,
|
---|
1597 | const struct security_descriptor *psd)
|
---|
1598 | {
|
---|
1599 | NTSTATUS result;
|
---|
1600 |
|
---|
1601 | result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
|
---|
1602 |
|
---|
1603 | do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s",
|
---|
1604 | fsp_str_do_log(fsp));
|
---|
1605 |
|
---|
1606 | return result;
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
|
---|
1610 | const char *path, mode_t mode)
|
---|
1611 | {
|
---|
1612 | int result;
|
---|
1613 |
|
---|
1614 | result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
|
---|
1615 |
|
---|
1616 | do_log(SMB_VFS_OP_CHMOD_ACL, (result >= 0), handle,
|
---|
1617 | "%s|%o", path, mode);
|
---|
1618 |
|
---|
1619 | return result;
|
---|
1620 | }
|
---|
1621 |
|
---|
1622 | static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1623 | mode_t mode)
|
---|
1624 | {
|
---|
1625 | int result;
|
---|
1626 |
|
---|
1627 | result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode);
|
---|
1628 |
|
---|
1629 | do_log(SMB_VFS_OP_FCHMOD_ACL, (result >= 0), handle,
|
---|
1630 | "%s|%o", fsp_str_do_log(fsp), mode);
|
---|
1631 |
|
---|
1632 | return result;
|
---|
1633 | }
|
---|
1634 |
|
---|
1635 | static int smb_full_audit_sys_acl_get_entry(vfs_handle_struct *handle,
|
---|
1636 |
|
---|
1637 | SMB_ACL_T theacl, int entry_id,
|
---|
1638 | SMB_ACL_ENTRY_T *entry_p)
|
---|
1639 | {
|
---|
1640 | int result;
|
---|
1641 |
|
---|
1642 | result = SMB_VFS_NEXT_SYS_ACL_GET_ENTRY(handle, theacl, entry_id,
|
---|
1643 | entry_p);
|
---|
1644 |
|
---|
1645 | do_log(SMB_VFS_OP_SYS_ACL_GET_ENTRY, (result >= 0), handle,
|
---|
1646 | "");
|
---|
1647 |
|
---|
1648 | return result;
|
---|
1649 | }
|
---|
1650 |
|
---|
1651 | static int smb_full_audit_sys_acl_get_tag_type(vfs_handle_struct *handle,
|
---|
1652 |
|
---|
1653 | SMB_ACL_ENTRY_T entry_d,
|
---|
1654 | SMB_ACL_TAG_T *tag_type_p)
|
---|
1655 | {
|
---|
1656 | int result;
|
---|
1657 |
|
---|
1658 | result = SMB_VFS_NEXT_SYS_ACL_GET_TAG_TYPE(handle, entry_d,
|
---|
1659 | tag_type_p);
|
---|
1660 |
|
---|
1661 | do_log(SMB_VFS_OP_SYS_ACL_GET_TAG_TYPE, (result >= 0), handle,
|
---|
1662 | "");
|
---|
1663 |
|
---|
1664 | return result;
|
---|
1665 | }
|
---|
1666 |
|
---|
1667 | static int smb_full_audit_sys_acl_get_permset(vfs_handle_struct *handle,
|
---|
1668 |
|
---|
1669 | SMB_ACL_ENTRY_T entry_d,
|
---|
1670 | SMB_ACL_PERMSET_T *permset_p)
|
---|
1671 | {
|
---|
1672 | int result;
|
---|
1673 |
|
---|
1674 | result = SMB_VFS_NEXT_SYS_ACL_GET_PERMSET(handle, entry_d,
|
---|
1675 | permset_p);
|
---|
1676 |
|
---|
1677 | do_log(SMB_VFS_OP_SYS_ACL_GET_PERMSET, (result >= 0), handle,
|
---|
1678 | "");
|
---|
1679 |
|
---|
1680 | return result;
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 | static void * smb_full_audit_sys_acl_get_qualifier(vfs_handle_struct *handle,
|
---|
1684 |
|
---|
1685 | SMB_ACL_ENTRY_T entry_d)
|
---|
1686 | {
|
---|
1687 | void *result;
|
---|
1688 |
|
---|
1689 | result = SMB_VFS_NEXT_SYS_ACL_GET_QUALIFIER(handle, entry_d);
|
---|
1690 |
|
---|
1691 | do_log(SMB_VFS_OP_SYS_ACL_GET_QUALIFIER, (result != NULL), handle,
|
---|
1692 | "");
|
---|
1693 |
|
---|
1694 | return result;
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | static SMB_ACL_T smb_full_audit_sys_acl_get_file(vfs_handle_struct *handle,
|
---|
1698 | const char *path_p,
|
---|
1699 | SMB_ACL_TYPE_T type)
|
---|
1700 | {
|
---|
1701 | SMB_ACL_T result;
|
---|
1702 |
|
---|
1703 | result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, path_p, type);
|
---|
1704 |
|
---|
1705 | do_log(SMB_VFS_OP_SYS_ACL_GET_FILE, (result != NULL), handle,
|
---|
1706 | "%s", path_p);
|
---|
1707 |
|
---|
1708 | return result;
|
---|
1709 | }
|
---|
1710 |
|
---|
1711 | static SMB_ACL_T smb_full_audit_sys_acl_get_fd(vfs_handle_struct *handle,
|
---|
1712 | files_struct *fsp)
|
---|
1713 | {
|
---|
1714 | SMB_ACL_T result;
|
---|
1715 |
|
---|
1716 | result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp);
|
---|
1717 |
|
---|
1718 | do_log(SMB_VFS_OP_SYS_ACL_GET_FD, (result != NULL), handle,
|
---|
1719 | "%s", fsp_str_do_log(fsp));
|
---|
1720 |
|
---|
1721 | return result;
|
---|
1722 | }
|
---|
1723 |
|
---|
1724 | static int smb_full_audit_sys_acl_clear_perms(vfs_handle_struct *handle,
|
---|
1725 |
|
---|
1726 | SMB_ACL_PERMSET_T permset)
|
---|
1727 | {
|
---|
1728 | int result;
|
---|
1729 |
|
---|
1730 | result = SMB_VFS_NEXT_SYS_ACL_CLEAR_PERMS(handle, permset);
|
---|
1731 |
|
---|
1732 | do_log(SMB_VFS_OP_SYS_ACL_CLEAR_PERMS, (result >= 0), handle,
|
---|
1733 | "");
|
---|
1734 |
|
---|
1735 | return result;
|
---|
1736 | }
|
---|
1737 |
|
---|
1738 | static int smb_full_audit_sys_acl_add_perm(vfs_handle_struct *handle,
|
---|
1739 |
|
---|
1740 | SMB_ACL_PERMSET_T permset,
|
---|
1741 | SMB_ACL_PERM_T perm)
|
---|
1742 | {
|
---|
1743 | int result;
|
---|
1744 |
|
---|
1745 | result = SMB_VFS_NEXT_SYS_ACL_ADD_PERM(handle, permset, perm);
|
---|
1746 |
|
---|
1747 | do_log(SMB_VFS_OP_SYS_ACL_ADD_PERM, (result >= 0), handle,
|
---|
1748 | "");
|
---|
1749 |
|
---|
1750 | return result;
|
---|
1751 | }
|
---|
1752 |
|
---|
1753 | static char * smb_full_audit_sys_acl_to_text(vfs_handle_struct *handle,
|
---|
1754 | SMB_ACL_T theacl,
|
---|
1755 | ssize_t *plen)
|
---|
1756 | {
|
---|
1757 | char * result;
|
---|
1758 |
|
---|
1759 | result = SMB_VFS_NEXT_SYS_ACL_TO_TEXT(handle, theacl, plen);
|
---|
1760 |
|
---|
1761 | do_log(SMB_VFS_OP_SYS_ACL_TO_TEXT, (result != NULL), handle,
|
---|
1762 | "");
|
---|
1763 |
|
---|
1764 | return result;
|
---|
1765 | }
|
---|
1766 |
|
---|
1767 | static SMB_ACL_T smb_full_audit_sys_acl_init(vfs_handle_struct *handle,
|
---|
1768 |
|
---|
1769 | int count)
|
---|
1770 | {
|
---|
1771 | SMB_ACL_T result;
|
---|
1772 |
|
---|
1773 | result = SMB_VFS_NEXT_SYS_ACL_INIT(handle, count);
|
---|
1774 |
|
---|
1775 | do_log(SMB_VFS_OP_SYS_ACL_INIT, (result != NULL), handle,
|
---|
1776 | "");
|
---|
1777 |
|
---|
1778 | return result;
|
---|
1779 | }
|
---|
1780 |
|
---|
1781 | static int smb_full_audit_sys_acl_create_entry(vfs_handle_struct *handle,
|
---|
1782 | SMB_ACL_T *pacl,
|
---|
1783 | SMB_ACL_ENTRY_T *pentry)
|
---|
1784 | {
|
---|
1785 | int result;
|
---|
1786 |
|
---|
1787 | result = SMB_VFS_NEXT_SYS_ACL_CREATE_ENTRY(handle, pacl, pentry);
|
---|
1788 |
|
---|
1789 | do_log(SMB_VFS_OP_SYS_ACL_CREATE_ENTRY, (result >= 0), handle,
|
---|
1790 | "");
|
---|
1791 |
|
---|
1792 | return result;
|
---|
1793 | }
|
---|
1794 |
|
---|
1795 | static int smb_full_audit_sys_acl_set_tag_type(vfs_handle_struct *handle,
|
---|
1796 |
|
---|
1797 | SMB_ACL_ENTRY_T entry,
|
---|
1798 | SMB_ACL_TAG_T tagtype)
|
---|
1799 | {
|
---|
1800 | int result;
|
---|
1801 |
|
---|
1802 | result = SMB_VFS_NEXT_SYS_ACL_SET_TAG_TYPE(handle, entry,
|
---|
1803 | tagtype);
|
---|
1804 |
|
---|
1805 | do_log(SMB_VFS_OP_SYS_ACL_SET_TAG_TYPE, (result >= 0), handle,
|
---|
1806 | "");
|
---|
1807 |
|
---|
1808 | return result;
|
---|
1809 | }
|
---|
1810 |
|
---|
1811 | static int smb_full_audit_sys_acl_set_qualifier(vfs_handle_struct *handle,
|
---|
1812 |
|
---|
1813 | SMB_ACL_ENTRY_T entry,
|
---|
1814 | void *qual)
|
---|
1815 | {
|
---|
1816 | int result;
|
---|
1817 |
|
---|
1818 | result = SMB_VFS_NEXT_SYS_ACL_SET_QUALIFIER(handle, entry, qual);
|
---|
1819 |
|
---|
1820 | do_log(SMB_VFS_OP_SYS_ACL_SET_QUALIFIER, (result >= 0), handle,
|
---|
1821 | "");
|
---|
1822 |
|
---|
1823 | return result;
|
---|
1824 | }
|
---|
1825 |
|
---|
1826 | static int smb_full_audit_sys_acl_set_permset(vfs_handle_struct *handle,
|
---|
1827 |
|
---|
1828 | SMB_ACL_ENTRY_T entry,
|
---|
1829 | SMB_ACL_PERMSET_T permset)
|
---|
1830 | {
|
---|
1831 | int result;
|
---|
1832 |
|
---|
1833 | result = SMB_VFS_NEXT_SYS_ACL_SET_PERMSET(handle, entry, permset);
|
---|
1834 |
|
---|
1835 | do_log(SMB_VFS_OP_SYS_ACL_SET_PERMSET, (result >= 0), handle,
|
---|
1836 | "");
|
---|
1837 |
|
---|
1838 | return result;
|
---|
1839 | }
|
---|
1840 |
|
---|
1841 | static int smb_full_audit_sys_acl_valid(vfs_handle_struct *handle,
|
---|
1842 |
|
---|
1843 | SMB_ACL_T theacl )
|
---|
1844 | {
|
---|
1845 | int result;
|
---|
1846 |
|
---|
1847 | result = SMB_VFS_NEXT_SYS_ACL_VALID(handle, theacl);
|
---|
1848 |
|
---|
1849 | do_log(SMB_VFS_OP_SYS_ACL_VALID, (result >= 0), handle,
|
---|
1850 | "");
|
---|
1851 |
|
---|
1852 | return result;
|
---|
1853 | }
|
---|
1854 |
|
---|
1855 | static int smb_full_audit_sys_acl_set_file(vfs_handle_struct *handle,
|
---|
1856 |
|
---|
1857 | const char *name, SMB_ACL_TYPE_T acltype,
|
---|
1858 | SMB_ACL_T theacl)
|
---|
1859 | {
|
---|
1860 | int result;
|
---|
1861 |
|
---|
1862 | result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, name, acltype,
|
---|
1863 | theacl);
|
---|
1864 |
|
---|
1865 | do_log(SMB_VFS_OP_SYS_ACL_SET_FILE, (result >= 0), handle,
|
---|
1866 | "%s", name);
|
---|
1867 |
|
---|
1868 | return result;
|
---|
1869 | }
|
---|
1870 |
|
---|
1871 | static int smb_full_audit_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
|
---|
1872 | SMB_ACL_T theacl)
|
---|
1873 | {
|
---|
1874 | int result;
|
---|
1875 |
|
---|
1876 | result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
|
---|
1877 |
|
---|
1878 | do_log(SMB_VFS_OP_SYS_ACL_SET_FD, (result >= 0), handle,
|
---|
1879 | "%s", fsp_str_do_log(fsp));
|
---|
1880 |
|
---|
1881 | return result;
|
---|
1882 | }
|
---|
1883 |
|
---|
1884 | static int smb_full_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
|
---|
1885 |
|
---|
1886 | const char *path)
|
---|
1887 | {
|
---|
1888 | int result;
|
---|
1889 |
|
---|
1890 | result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, path);
|
---|
1891 |
|
---|
1892 | do_log(SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, (result >= 0), handle,
|
---|
1893 | "%s", path);
|
---|
1894 |
|
---|
1895 | return result;
|
---|
1896 | }
|
---|
1897 |
|
---|
1898 | static int smb_full_audit_sys_acl_get_perm(vfs_handle_struct *handle,
|
---|
1899 |
|
---|
1900 | SMB_ACL_PERMSET_T permset,
|
---|
1901 | SMB_ACL_PERM_T perm)
|
---|
1902 | {
|
---|
1903 | int result;
|
---|
1904 |
|
---|
1905 | result = SMB_VFS_NEXT_SYS_ACL_GET_PERM(handle, permset, perm);
|
---|
1906 |
|
---|
1907 | do_log(SMB_VFS_OP_SYS_ACL_GET_PERM, (result >= 0), handle,
|
---|
1908 | "");
|
---|
1909 |
|
---|
1910 | return result;
|
---|
1911 | }
|
---|
1912 |
|
---|
1913 | static int smb_full_audit_sys_acl_free_text(vfs_handle_struct *handle,
|
---|
1914 |
|
---|
1915 | char *text)
|
---|
1916 | {
|
---|
1917 | int result;
|
---|
1918 |
|
---|
1919 | result = SMB_VFS_NEXT_SYS_ACL_FREE_TEXT(handle, text);
|
---|
1920 |
|
---|
1921 | do_log(SMB_VFS_OP_SYS_ACL_FREE_TEXT, (result >= 0), handle,
|
---|
1922 | "");
|
---|
1923 |
|
---|
1924 | return result;
|
---|
1925 | }
|
---|
1926 |
|
---|
1927 | static int smb_full_audit_sys_acl_free_acl(vfs_handle_struct *handle,
|
---|
1928 |
|
---|
1929 | SMB_ACL_T posix_acl)
|
---|
1930 | {
|
---|
1931 | int result;
|
---|
1932 |
|
---|
1933 | result = SMB_VFS_NEXT_SYS_ACL_FREE_ACL(handle, posix_acl);
|
---|
1934 |
|
---|
1935 | do_log(SMB_VFS_OP_SYS_ACL_FREE_ACL, (result >= 0), handle,
|
---|
1936 | "");
|
---|
1937 |
|
---|
1938 | return result;
|
---|
1939 | }
|
---|
1940 |
|
---|
1941 | static int smb_full_audit_sys_acl_free_qualifier(vfs_handle_struct *handle,
|
---|
1942 | void *qualifier,
|
---|
1943 | SMB_ACL_TAG_T tagtype)
|
---|
1944 | {
|
---|
1945 | int result;
|
---|
1946 |
|
---|
1947 | result = SMB_VFS_NEXT_SYS_ACL_FREE_QUALIFIER(handle, qualifier,
|
---|
1948 | tagtype);
|
---|
1949 |
|
---|
1950 | do_log(SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, (result >= 0), handle,
|
---|
1951 | "");
|
---|
1952 |
|
---|
1953 | return result;
|
---|
1954 | }
|
---|
1955 |
|
---|
1956 | static ssize_t smb_full_audit_getxattr(struct vfs_handle_struct *handle,
|
---|
1957 | const char *path,
|
---|
1958 | const char *name, void *value, size_t size)
|
---|
1959 | {
|
---|
1960 | ssize_t result;
|
---|
1961 |
|
---|
1962 | result = SMB_VFS_NEXT_GETXATTR(handle, path, name, value, size);
|
---|
1963 |
|
---|
1964 | do_log(SMB_VFS_OP_GETXATTR, (result >= 0), handle,
|
---|
1965 | "%s|%s", path, name);
|
---|
1966 |
|
---|
1967 | return result;
|
---|
1968 | }
|
---|
1969 |
|
---|
1970 | static ssize_t smb_full_audit_lgetxattr(struct vfs_handle_struct *handle,
|
---|
1971 | const char *path, const char *name,
|
---|
1972 | void *value, size_t size)
|
---|
1973 | {
|
---|
1974 | ssize_t result;
|
---|
1975 |
|
---|
1976 | result = SMB_VFS_NEXT_LGETXATTR(handle, path, name, value, size);
|
---|
1977 |
|
---|
1978 | do_log(SMB_VFS_OP_LGETXATTR, (result >= 0), handle,
|
---|
1979 | "%s|%s", path, name);
|
---|
1980 |
|
---|
1981 | return result;
|
---|
1982 | }
|
---|
1983 |
|
---|
1984 | static ssize_t smb_full_audit_fgetxattr(struct vfs_handle_struct *handle,
|
---|
1985 | struct files_struct *fsp,
|
---|
1986 | const char *name, void *value, size_t size)
|
---|
1987 | {
|
---|
1988 | ssize_t result;
|
---|
1989 |
|
---|
1990 | result = SMB_VFS_NEXT_FGETXATTR(handle, fsp, name, value, size);
|
---|
1991 |
|
---|
1992 | do_log(SMB_VFS_OP_FGETXATTR, (result >= 0), handle,
|
---|
1993 | "%s|%s", fsp_str_do_log(fsp), name);
|
---|
1994 |
|
---|
1995 | return result;
|
---|
1996 | }
|
---|
1997 |
|
---|
1998 | static ssize_t smb_full_audit_listxattr(struct vfs_handle_struct *handle,
|
---|
1999 | const char *path, char *list, size_t size)
|
---|
2000 | {
|
---|
2001 | ssize_t result;
|
---|
2002 |
|
---|
2003 | result = SMB_VFS_NEXT_LISTXATTR(handle, path, list, size);
|
---|
2004 |
|
---|
2005 | do_log(SMB_VFS_OP_LISTXATTR, (result >= 0), handle, "%s", path);
|
---|
2006 |
|
---|
2007 | return result;
|
---|
2008 | }
|
---|
2009 |
|
---|
2010 | static ssize_t smb_full_audit_llistxattr(struct vfs_handle_struct *handle,
|
---|
2011 | const char *path, char *list, size_t size)
|
---|
2012 | {
|
---|
2013 | ssize_t result;
|
---|
2014 |
|
---|
2015 | result = SMB_VFS_NEXT_LLISTXATTR(handle, path, list, size);
|
---|
2016 |
|
---|
2017 | do_log(SMB_VFS_OP_LLISTXATTR, (result >= 0), handle, "%s", path);
|
---|
2018 |
|
---|
2019 | return result;
|
---|
2020 | }
|
---|
2021 |
|
---|
2022 | static ssize_t smb_full_audit_flistxattr(struct vfs_handle_struct *handle,
|
---|
2023 | struct files_struct *fsp, char *list,
|
---|
2024 | size_t size)
|
---|
2025 | {
|
---|
2026 | ssize_t result;
|
---|
2027 |
|
---|
2028 | result = SMB_VFS_NEXT_FLISTXATTR(handle, fsp, list, size);
|
---|
2029 |
|
---|
2030 | do_log(SMB_VFS_OP_FLISTXATTR, (result >= 0), handle,
|
---|
2031 | "%s", fsp_str_do_log(fsp));
|
---|
2032 |
|
---|
2033 | return result;
|
---|
2034 | }
|
---|
2035 |
|
---|
2036 | static int smb_full_audit_removexattr(struct vfs_handle_struct *handle,
|
---|
2037 | const char *path,
|
---|
2038 | const char *name)
|
---|
2039 | {
|
---|
2040 | int result;
|
---|
2041 |
|
---|
2042 | result = SMB_VFS_NEXT_REMOVEXATTR(handle, path, name);
|
---|
2043 |
|
---|
2044 | do_log(SMB_VFS_OP_REMOVEXATTR, (result >= 0), handle,
|
---|
2045 | "%s|%s", path, name);
|
---|
2046 |
|
---|
2047 | return result;
|
---|
2048 | }
|
---|
2049 |
|
---|
2050 | static int smb_full_audit_lremovexattr(struct vfs_handle_struct *handle,
|
---|
2051 | const char *path,
|
---|
2052 | const char *name)
|
---|
2053 | {
|
---|
2054 | int result;
|
---|
2055 |
|
---|
2056 | result = SMB_VFS_NEXT_LREMOVEXATTR(handle, path, name);
|
---|
2057 |
|
---|
2058 | do_log(SMB_VFS_OP_LREMOVEXATTR, (result >= 0), handle,
|
---|
2059 | "%s|%s", path, name);
|
---|
2060 |
|
---|
2061 | return result;
|
---|
2062 | }
|
---|
2063 |
|
---|
2064 | static int smb_full_audit_fremovexattr(struct vfs_handle_struct *handle,
|
---|
2065 | struct files_struct *fsp,
|
---|
2066 | const char *name)
|
---|
2067 | {
|
---|
2068 | int result;
|
---|
2069 |
|
---|
2070 | result = SMB_VFS_NEXT_FREMOVEXATTR(handle, fsp, name);
|
---|
2071 |
|
---|
2072 | do_log(SMB_VFS_OP_FREMOVEXATTR, (result >= 0), handle,
|
---|
2073 | "%s|%s", fsp_str_do_log(fsp), name);
|
---|
2074 |
|
---|
2075 | return result;
|
---|
2076 | }
|
---|
2077 |
|
---|
2078 | static int smb_full_audit_setxattr(struct vfs_handle_struct *handle,
|
---|
2079 | const char *path,
|
---|
2080 | const char *name, const void *value, size_t size,
|
---|
2081 | int flags)
|
---|
2082 | {
|
---|
2083 | int result;
|
---|
2084 |
|
---|
2085 | result = SMB_VFS_NEXT_SETXATTR(handle, path, name, value, size,
|
---|
2086 | flags);
|
---|
2087 |
|
---|
2088 | do_log(SMB_VFS_OP_SETXATTR, (result >= 0), handle,
|
---|
2089 | "%s|%s", path, name);
|
---|
2090 |
|
---|
2091 | return result;
|
---|
2092 | }
|
---|
2093 |
|
---|
2094 | static int smb_full_audit_lsetxattr(struct vfs_handle_struct *handle,
|
---|
2095 | const char *path,
|
---|
2096 | const char *name, const void *value, size_t size,
|
---|
2097 | int flags)
|
---|
2098 | {
|
---|
2099 | int result;
|
---|
2100 |
|
---|
2101 | result = SMB_VFS_NEXT_LSETXATTR(handle, path, name, value, size,
|
---|
2102 | flags);
|
---|
2103 |
|
---|
2104 | do_log(SMB_VFS_OP_LSETXATTR, (result >= 0), handle,
|
---|
2105 | "%s|%s", path, name);
|
---|
2106 |
|
---|
2107 | return result;
|
---|
2108 | }
|
---|
2109 |
|
---|
2110 | static int smb_full_audit_fsetxattr(struct vfs_handle_struct *handle,
|
---|
2111 | struct files_struct *fsp, const char *name,
|
---|
2112 | const void *value, size_t size, int flags)
|
---|
2113 | {
|
---|
2114 | int result;
|
---|
2115 |
|
---|
2116 | result = SMB_VFS_NEXT_FSETXATTR(handle, fsp, name, value, size, flags);
|
---|
2117 |
|
---|
2118 | do_log(SMB_VFS_OP_FSETXATTR, (result >= 0), handle,
|
---|
2119 | "%s|%s", fsp_str_do_log(fsp), name);
|
---|
2120 |
|
---|
2121 | return result;
|
---|
2122 | }
|
---|
2123 |
|
---|
2124 | static int smb_full_audit_aio_read(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
2125 | {
|
---|
2126 | int result;
|
---|
2127 |
|
---|
2128 | result = SMB_VFS_NEXT_AIO_READ(handle, fsp, aiocb);
|
---|
2129 | do_log(SMB_VFS_OP_AIO_READ, (result >= 0), handle,
|
---|
2130 | "%s", fsp_str_do_log(fsp));
|
---|
2131 |
|
---|
2132 | return result;
|
---|
2133 | }
|
---|
2134 |
|
---|
2135 | static int smb_full_audit_aio_write(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
2136 | {
|
---|
2137 | int result;
|
---|
2138 |
|
---|
2139 | result = SMB_VFS_NEXT_AIO_WRITE(handle, fsp, aiocb);
|
---|
2140 | do_log(SMB_VFS_OP_AIO_WRITE, (result >= 0), handle,
|
---|
2141 | "%s", fsp_str_do_log(fsp));
|
---|
2142 |
|
---|
2143 | return result;
|
---|
2144 | }
|
---|
2145 |
|
---|
2146 | static ssize_t smb_full_audit_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
2147 | {
|
---|
2148 | int result;
|
---|
2149 |
|
---|
2150 | result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
|
---|
2151 | do_log(SMB_VFS_OP_AIO_RETURN, (result >= 0), handle,
|
---|
2152 | "%s", fsp_str_do_log(fsp));
|
---|
2153 |
|
---|
2154 | return result;
|
---|
2155 | }
|
---|
2156 |
|
---|
2157 | static int smb_full_audit_aio_cancel(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
2158 | {
|
---|
2159 | int result;
|
---|
2160 |
|
---|
2161 | result = SMB_VFS_NEXT_AIO_CANCEL(handle, fsp, aiocb);
|
---|
2162 | do_log(SMB_VFS_OP_AIO_CANCEL, (result >= 0), handle,
|
---|
2163 | "%s", fsp_str_do_log(fsp));
|
---|
2164 |
|
---|
2165 | return result;
|
---|
2166 | }
|
---|
2167 |
|
---|
2168 | static int smb_full_audit_aio_error(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
|
---|
2169 | {
|
---|
2170 | int result;
|
---|
2171 |
|
---|
2172 | result = SMB_VFS_NEXT_AIO_ERROR(handle, fsp, aiocb);
|
---|
2173 | do_log(SMB_VFS_OP_AIO_ERROR, (result >= 0), handle,
|
---|
2174 | "%s", fsp_str_do_log(fsp));
|
---|
2175 |
|
---|
2176 | return result;
|
---|
2177 | }
|
---|
2178 |
|
---|
2179 | static int smb_full_audit_aio_fsync(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb)
|
---|
2180 | {
|
---|
2181 | int result;
|
---|
2182 |
|
---|
2183 | result = SMB_VFS_NEXT_AIO_FSYNC(handle, fsp, op, aiocb);
|
---|
2184 | do_log(SMB_VFS_OP_AIO_FSYNC, (result >= 0), handle,
|
---|
2185 | "%s", fsp_str_do_log(fsp));
|
---|
2186 |
|
---|
2187 | return result;
|
---|
2188 | }
|
---|
2189 |
|
---|
2190 | 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)
|
---|
2191 | {
|
---|
2192 | int result;
|
---|
2193 |
|
---|
2194 | result = SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts);
|
---|
2195 | do_log(SMB_VFS_OP_AIO_SUSPEND, (result >= 0), handle,
|
---|
2196 | "%s", fsp_str_do_log(fsp));
|
---|
2197 |
|
---|
2198 | return result;
|
---|
2199 | }
|
---|
2200 |
|
---|
2201 | static bool smb_full_audit_aio_force(struct vfs_handle_struct *handle,
|
---|
2202 | struct files_struct *fsp)
|
---|
2203 | {
|
---|
2204 | bool result;
|
---|
2205 |
|
---|
2206 | result = SMB_VFS_NEXT_AIO_FORCE(handle, fsp);
|
---|
2207 | do_log(SMB_VFS_OP_AIO_FORCE, result, handle,
|
---|
2208 | "%s", fsp_str_do_log(fsp));
|
---|
2209 |
|
---|
2210 | return result;
|
---|
2211 | }
|
---|
2212 |
|
---|
2213 | static bool smb_full_audit_is_offline(struct vfs_handle_struct *handle,
|
---|
2214 | const struct smb_filename *fname,
|
---|
2215 | SMB_STRUCT_STAT *sbuf)
|
---|
2216 | {
|
---|
2217 | bool result;
|
---|
2218 |
|
---|
2219 | result = SMB_VFS_NEXT_IS_OFFLINE(handle, fname, sbuf);
|
---|
2220 | do_log(SMB_VFS_OP_IS_OFFLINE, result, handle, "%s",
|
---|
2221 | smb_fname_str_do_log(fname));
|
---|
2222 | return result;
|
---|
2223 | }
|
---|
2224 |
|
---|
2225 | static int smb_full_audit_set_offline(struct vfs_handle_struct *handle,
|
---|
2226 | const struct smb_filename *fname)
|
---|
2227 | {
|
---|
2228 | int result;
|
---|
2229 |
|
---|
2230 | result = SMB_VFS_NEXT_SET_OFFLINE(handle, fname);
|
---|
2231 | do_log(SMB_VFS_OP_SET_OFFLINE, result >= 0, handle, "%s",
|
---|
2232 | smb_fname_str_do_log(fname));
|
---|
2233 | return result;
|
---|
2234 | }
|
---|
2235 |
|
---|
2236 | static struct vfs_fn_pointers vfs_full_audit_fns = {
|
---|
2237 |
|
---|
2238 | /* Disk operations */
|
---|
2239 |
|
---|
2240 | .connect_fn = smb_full_audit_connect,
|
---|
2241 | .disconnect = smb_full_audit_disconnect,
|
---|
2242 | .disk_free = smb_full_audit_disk_free,
|
---|
2243 | .get_quota = smb_full_audit_get_quota,
|
---|
2244 | .set_quota = smb_full_audit_set_quota,
|
---|
2245 | .get_shadow_copy_data = smb_full_audit_get_shadow_copy_data,
|
---|
2246 | .statvfs = smb_full_audit_statvfs,
|
---|
2247 | .fs_capabilities = smb_full_audit_fs_capabilities,
|
---|
2248 | .opendir = smb_full_audit_opendir,
|
---|
2249 | .fdopendir = smb_full_audit_fdopendir,
|
---|
2250 | .readdir = smb_full_audit_readdir,
|
---|
2251 | .seekdir = smb_full_audit_seekdir,
|
---|
2252 | .telldir = smb_full_audit_telldir,
|
---|
2253 | .rewind_dir = smb_full_audit_rewinddir,
|
---|
2254 | .mkdir = smb_full_audit_mkdir,
|
---|
2255 | .rmdir = smb_full_audit_rmdir,
|
---|
2256 | .closedir = smb_full_audit_closedir,
|
---|
2257 | .init_search_op = smb_full_audit_init_search_op,
|
---|
2258 | .open_fn = smb_full_audit_open,
|
---|
2259 | .create_file = smb_full_audit_create_file,
|
---|
2260 | .close_fn = smb_full_audit_close,
|
---|
2261 | .vfs_read = smb_full_audit_read,
|
---|
2262 | .pread = smb_full_audit_pread,
|
---|
2263 | .write = smb_full_audit_write,
|
---|
2264 | .pwrite = smb_full_audit_pwrite,
|
---|
2265 | .lseek = smb_full_audit_lseek,
|
---|
2266 | .sendfile = smb_full_audit_sendfile,
|
---|
2267 | .recvfile = smb_full_audit_recvfile,
|
---|
2268 | .rename = smb_full_audit_rename,
|
---|
2269 | .fsync = smb_full_audit_fsync,
|
---|
2270 | .stat = smb_full_audit_stat,
|
---|
2271 | .fstat = smb_full_audit_fstat,
|
---|
2272 | .lstat = smb_full_audit_lstat,
|
---|
2273 | .get_alloc_size = smb_full_audit_get_alloc_size,
|
---|
2274 | .unlink = smb_full_audit_unlink,
|
---|
2275 | .chmod = smb_full_audit_chmod,
|
---|
2276 | .fchmod = smb_full_audit_fchmod,
|
---|
2277 | .chown = smb_full_audit_chown,
|
---|
2278 | .fchown = smb_full_audit_fchown,
|
---|
2279 | .lchown = smb_full_audit_lchown,
|
---|
2280 | .chdir = smb_full_audit_chdir,
|
---|
2281 | .getwd = smb_full_audit_getwd,
|
---|
2282 | .ntimes = smb_full_audit_ntimes,
|
---|
2283 | .ftruncate = smb_full_audit_ftruncate,
|
---|
2284 | .fallocate = smb_full_audit_fallocate,
|
---|
2285 | .lock = smb_full_audit_lock,
|
---|
2286 | .kernel_flock = smb_full_audit_kernel_flock,
|
---|
2287 | .linux_setlease = smb_full_audit_linux_setlease,
|
---|
2288 | .getlock = smb_full_audit_getlock,
|
---|
2289 | .symlink = smb_full_audit_symlink,
|
---|
2290 | .vfs_readlink = smb_full_audit_readlink,
|
---|
2291 | .link = smb_full_audit_link,
|
---|
2292 | .mknod = smb_full_audit_mknod,
|
---|
2293 | .realpath = smb_full_audit_realpath,
|
---|
2294 | .notify_watch = smb_full_audit_notify_watch,
|
---|
2295 | .chflags = smb_full_audit_chflags,
|
---|
2296 | .file_id_create = smb_full_audit_file_id_create,
|
---|
2297 | .streaminfo = smb_full_audit_streaminfo,
|
---|
2298 | .get_real_filename = smb_full_audit_get_real_filename,
|
---|
2299 | .connectpath = smb_full_audit_connectpath,
|
---|
2300 | .brl_lock_windows = smb_full_audit_brl_lock_windows,
|
---|
2301 | .brl_unlock_windows = smb_full_audit_brl_unlock_windows,
|
---|
2302 | .brl_cancel_windows = smb_full_audit_brl_cancel_windows,
|
---|
2303 | .strict_lock = smb_full_audit_strict_lock,
|
---|
2304 | .strict_unlock = smb_full_audit_strict_unlock,
|
---|
2305 | .translate_name = smb_full_audit_translate_name,
|
---|
2306 | .fget_nt_acl = smb_full_audit_fget_nt_acl,
|
---|
2307 | .get_nt_acl = smb_full_audit_get_nt_acl,
|
---|
2308 | .fset_nt_acl = smb_full_audit_fset_nt_acl,
|
---|
2309 | .chmod_acl = smb_full_audit_chmod_acl,
|
---|
2310 | .fchmod_acl = smb_full_audit_fchmod_acl,
|
---|
2311 | .sys_acl_get_entry = smb_full_audit_sys_acl_get_entry,
|
---|
2312 | .sys_acl_get_tag_type = smb_full_audit_sys_acl_get_tag_type,
|
---|
2313 | .sys_acl_get_permset = smb_full_audit_sys_acl_get_permset,
|
---|
2314 | .sys_acl_get_qualifier = smb_full_audit_sys_acl_get_qualifier,
|
---|
2315 | .sys_acl_get_file = smb_full_audit_sys_acl_get_file,
|
---|
2316 | .sys_acl_get_fd = smb_full_audit_sys_acl_get_fd,
|
---|
2317 | .sys_acl_clear_perms = smb_full_audit_sys_acl_clear_perms,
|
---|
2318 | .sys_acl_add_perm = smb_full_audit_sys_acl_add_perm,
|
---|
2319 | .sys_acl_to_text = smb_full_audit_sys_acl_to_text,
|
---|
2320 | .sys_acl_init = smb_full_audit_sys_acl_init,
|
---|
2321 | .sys_acl_create_entry = smb_full_audit_sys_acl_create_entry,
|
---|
2322 | .sys_acl_set_tag_type = smb_full_audit_sys_acl_set_tag_type,
|
---|
2323 | .sys_acl_set_qualifier = smb_full_audit_sys_acl_set_qualifier,
|
---|
2324 | .sys_acl_set_permset = smb_full_audit_sys_acl_set_permset,
|
---|
2325 | .sys_acl_valid = smb_full_audit_sys_acl_valid,
|
---|
2326 | .sys_acl_set_file = smb_full_audit_sys_acl_set_file,
|
---|
2327 | .sys_acl_set_fd = smb_full_audit_sys_acl_set_fd,
|
---|
2328 | .sys_acl_delete_def_file = smb_full_audit_sys_acl_delete_def_file,
|
---|
2329 | .sys_acl_get_perm = smb_full_audit_sys_acl_get_perm,
|
---|
2330 | .sys_acl_free_text = smb_full_audit_sys_acl_free_text,
|
---|
2331 | .sys_acl_free_acl = smb_full_audit_sys_acl_free_acl,
|
---|
2332 | .sys_acl_free_qualifier = smb_full_audit_sys_acl_free_qualifier,
|
---|
2333 | .getxattr = smb_full_audit_getxattr,
|
---|
2334 | .lgetxattr = smb_full_audit_lgetxattr,
|
---|
2335 | .fgetxattr = smb_full_audit_fgetxattr,
|
---|
2336 | .listxattr = smb_full_audit_listxattr,
|
---|
2337 | .llistxattr = smb_full_audit_llistxattr,
|
---|
2338 | .flistxattr = smb_full_audit_flistxattr,
|
---|
2339 | .removexattr = smb_full_audit_removexattr,
|
---|
2340 | .lremovexattr = smb_full_audit_lremovexattr,
|
---|
2341 | .fremovexattr = smb_full_audit_fremovexattr,
|
---|
2342 | .setxattr = smb_full_audit_setxattr,
|
---|
2343 | .lsetxattr = smb_full_audit_lsetxattr,
|
---|
2344 | .fsetxattr = smb_full_audit_fsetxattr,
|
---|
2345 | .aio_read = smb_full_audit_aio_read,
|
---|
2346 | .aio_write = smb_full_audit_aio_write,
|
---|
2347 | .aio_return_fn = smb_full_audit_aio_return,
|
---|
2348 | .aio_cancel = smb_full_audit_aio_cancel,
|
---|
2349 | .aio_error_fn = smb_full_audit_aio_error,
|
---|
2350 | .aio_fsync = smb_full_audit_aio_fsync,
|
---|
2351 | .aio_suspend = smb_full_audit_aio_suspend,
|
---|
2352 | .aio_force = smb_full_audit_aio_force,
|
---|
2353 | .is_offline = smb_full_audit_is_offline,
|
---|
2354 | .set_offline = smb_full_audit_set_offline,
|
---|
2355 | };
|
---|
2356 |
|
---|
2357 | NTSTATUS vfs_full_audit_init(void)
|
---|
2358 | {
|
---|
2359 | NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
|
---|
2360 | "full_audit", &vfs_full_audit_fns);
|
---|
2361 |
|
---|
2362 | if (!NT_STATUS_IS_OK(ret))
|
---|
2363 | return ret;
|
---|
2364 |
|
---|
2365 | vfs_full_audit_debug_level = debug_add_class("full_audit");
|
---|
2366 | if (vfs_full_audit_debug_level == -1) {
|
---|
2367 | vfs_full_audit_debug_level = DBGC_VFS;
|
---|
2368 | DEBUG(0, ("vfs_full_audit: Couldn't register custom debugging "
|
---|
2369 | "class!\n"));
|
---|
2370 | } else {
|
---|
2371 | DEBUG(10, ("vfs_full_audit: Debug class number of "
|
---|
2372 | "'full_audit': %d\n", vfs_full_audit_debug_level));
|
---|
2373 | }
|
---|
2374 |
|
---|
2375 | return ret;
|
---|
2376 | }
|
---|