Remove redundant parameter fd from SMB_VFS_PWRITE().
[ira/wip.git] / source3 / modules / vfs_full_audit.c
index 79a511df41defbc7e2dc2cd1a7718ea7219594e1..c0bc40cc67f002304dda976bdda25408b04431ff 100644 (file)
@@ -10,7 +10,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *  
  * This program is distributed in the hope that it will be useful,
@@ -19,8 +19,7 @@
  * GNU General Public License for more details.
  *  
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -79,7 +78,7 @@ static int smb_full_audit_connect(vfs_handle_struct *handle,
 static void smb_full_audit_disconnect(vfs_handle_struct *handle);
 static SMB_BIG_UINT smb_full_audit_disk_free(vfs_handle_struct *handle,
                                    const char *path,
-                                   BOOL small_query, SMB_BIG_UINT *bsize, 
+                                   bool small_query, SMB_BIG_UINT *bsize, 
                                    SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
 static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
                           enum SMB_QUOTA_TYPE qtype, unid_t id,
@@ -89,7 +88,7 @@ static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
                           SMB_DISK_QUOTA *qt);
 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
                                 struct files_struct *fsp,
-                                SHADOW_COPY_DATA *shadow_copy_data, BOOL labels);
+                                SHADOW_COPY_DATA *shadow_copy_data, bool labels);
 static int smb_full_audit_statvfs(struct vfs_handle_struct *handle,
                                const char *path,
                                struct vfs_statvfs_struct *statbuf);
@@ -116,11 +115,11 @@ static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, in
 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
                          int fd, void *data, size_t n);
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, void *data, size_t n, SMB_OFF_T offset);
+                          void *data, size_t n, SMB_OFF_T offset);
 static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp,
                           int fd, const void *data, size_t n);
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, const void *data, size_t n,
+                           const void *data, size_t n,
                            SMB_OFF_T offset);
 static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp,
                             int filedes, SMB_OFF_T offset, int whence);
@@ -128,6 +127,10 @@ static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
                              files_struct *fsp, int fromfd,
                              const DATA_BLOB *hdr, SMB_OFF_T offset,
                              size_t n);
+static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
+                             files_struct *fsp, int tofd,
+                             SMB_OFF_T offset,
+                             size_t n);
 static int smb_full_audit_rename(vfs_handle_struct *handle,
                        const char *oldname, const char *newname);
 static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd);
@@ -147,6 +150,8 @@ static int smb_full_audit_chown(vfs_handle_struct *handle,
                       const char *path, uid_t uid, gid_t gid);
 static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd,
                        uid_t uid, gid_t gid);
+static int smb_full_audit_lchown(vfs_handle_struct *handle,
+                      const char *path, uid_t uid, gid_t gid);
 static int smb_full_audit_chdir(vfs_handle_struct *handle,
                       const char *path);
 static char *smb_full_audit_getwd(vfs_handle_struct *handle,
@@ -155,14 +160,14 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle,
                       const char *path, const struct timespec ts[2]);
 static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp,
                           int fd, SMB_OFF_T len);
-static BOOL smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
 static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
                                       struct files_struct *fsp, int fd,
                                       uint32 share_mode);
 static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct *fsp,
                                        int fd, int leasetype);
-static BOOL smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
                       SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid);
 static int smb_full_audit_symlink(vfs_handle_struct *handle,
                         const char *oldpath, const char *newpath);
@@ -174,18 +179,27 @@ static int smb_full_audit_mknod(vfs_handle_struct *handle,
                       const char *pathname, mode_t mode, SMB_DEV_T dev);
 static char *smb_full_audit_realpath(vfs_handle_struct *handle,
                            const char *path, char *resolved_path);
+static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
+                       struct sys_notify_context *ctx,
+                       struct notify_entry *e,
+                       void (*callback)(struct sys_notify_context *ctx,
+                                       void *private_data,
+                                       struct notify_event *ev),
+                       void *private_data, void *handle_p);
 static int smb_full_audit_chflags(vfs_handle_struct *handle,
-                           const char *path, uint flags);
-static size_t smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, uint32 security_info,
+                           const char *path, unsigned int flags);
+static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
+                                                   SMB_DEV_T dev, SMB_INO_T inode);
+static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+                               uint32 security_info,
                                SEC_DESC **ppdesc);
-static size_t smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                               const char *name, uint32 security_info,
                               SEC_DESC **ppdesc);
-static BOOL smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                             int fd, uint32 security_info_sent,
+static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+                             uint32 security_info_sent,
                              SEC_DESC *psd);
-static BOOL smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                             const char *name, uint32 security_info_sent,
                             SEC_DESC *psd);
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
@@ -353,6 +367,8 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_sendfile),   SMB_VFS_OP_SENDFILE,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_recvfile),   SMB_VFS_OP_RECVFILE,
+        SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_rename),     SMB_VFS_OP_RENAME,
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_fsync),      SMB_VFS_OP_FSYNC,
@@ -373,6 +389,8 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_fchown),     SMB_VFS_OP_FCHOWN,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_lchown),     SMB_VFS_OP_LCHOWN,
+        SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_chdir),      SMB_VFS_OP_CHDIR,
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_getwd),      SMB_VFS_OP_GETWD,
@@ -399,8 +417,12 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_realpath),   SMB_VFS_OP_REALPATH,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_notify_watch),SMB_VFS_OP_NOTIFY_WATCH,
+        SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_chflags),    SMB_VFS_OP_CHFLAGS,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_file_id_create),     SMB_VFS_OP_FILE_ID_CREATE,
+        SMB_VFS_LAYER_LOGGER},
 
        /* NT ACL operations. */
 
@@ -551,6 +573,7 @@ static struct {
        { SMB_VFS_OP_FCHMOD,    "fchmod" },
        { SMB_VFS_OP_CHOWN,     "chown" },
        { SMB_VFS_OP_FCHOWN,    "fchown" },
+       { SMB_VFS_OP_LCHOWN,    "lchown" },
        { SMB_VFS_OP_CHDIR,     "chdir" },
        { SMB_VFS_OP_GETWD,     "getwd" },
        { SMB_VFS_OP_NTIMES,    "ntimes" },
@@ -564,7 +587,9 @@ static struct {
        { SMB_VFS_OP_LINK,      "link" },
        { SMB_VFS_OP_MKNOD,     "mknod" },
        { SMB_VFS_OP_REALPATH,  "realpath" },
+       { SMB_VFS_OP_NOTIFY_WATCH, "notify_watch" },
        { SMB_VFS_OP_CHFLAGS,   "chflags" },
+       { SMB_VFS_OP_FILE_ID_CREATE,    "file_id_create" },
        { SMB_VFS_OP_FGET_NT_ACL,       "fget_nt_acl" },
        { SMB_VFS_OP_GET_NT_ACL,        "get_nt_acl" },
        { SMB_VFS_OP_FSET_NT_ACL,       "fset_nt_acl" },
@@ -656,21 +681,25 @@ static int audit_syslog_priority(vfs_handle_struct *handle)
        return priority;
 }
 
-static char *audit_prefix(connection_struct *conn)
+static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
 {
-       static pstring prefix;
+       char *prefix = NULL;
 
-       pstrcpy(prefix, lp_parm_const_string(SNUM(conn), "full_audit",
+       prefix = talloc_strdup(ctx,
+                       lp_parm_const_string(SNUM(conn), "full_audit",
                                             "prefix", "%u|%I"));
-       standard_sub_advanced(lp_servicename(SNUM(conn)), conn->user,
-                             conn->connectpath, conn->gid,
-                             get_current_username(),
-                             current_user_info.domain,
-                             prefix, sizeof(prefix));
-       return prefix;
+       if (!prefix) {
+               return NULL;
+       }
+       return talloc_sub_advanced(ctx,
+                       lp_servicename(SNUM(conn)), conn->user,
+                       conn->connectpath, conn->gid,
+                       get_current_username(),
+                       current_user_info.domain,
+                       prefix);
 }
 
-static BOOL log_success(vfs_handle_struct *handle, vfs_op_type op)
+static bool log_success(vfs_handle_struct *handle, vfs_op_type op)
 {
        struct vfs_full_audit_private_data *pd = NULL;
 
@@ -685,7 +714,7 @@ static BOOL log_success(vfs_handle_struct *handle, vfs_op_type op)
        return bitmap_query(pd->success_ops, op);
 }
 
-static BOOL log_failure(vfs_handle_struct *handle, vfs_op_type op)
+static bool log_failure(vfs_handle_struct *handle, vfs_op_type op)
 {
        struct vfs_full_audit_private_data *pd = NULL;
 
@@ -701,7 +730,7 @@ static BOOL log_failure(vfs_handle_struct *handle, vfs_op_type op)
 
 static void init_bitmap(struct bitmap **bm, const char **ops)
 {
-       BOOL log_all = False;
+       bool log_all = False;
 
        if (*bm != NULL)
                return;
@@ -716,7 +745,7 @@ static void init_bitmap(struct bitmap **bm, const char **ops)
 
        while (*ops != NULL) {
                int i;
-               BOOL found = False;
+               bool found = False;
 
                if (strequal(*ops, "all")) {
                        log_all = True;
@@ -761,12 +790,13 @@ static const char *audit_opname(vfs_op_type op)
        return vfs_op_names[op].name;
 }
 
-static void do_log(vfs_op_type op, BOOL success, vfs_handle_struct *handle,
+static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
                   const char *format, ...)
 {
        fstring err_msg;
-       pstring op_msg;
+       char *audit_pre = NULL;
        va_list ap;
+       char *op_msg = NULL;
 
        if (success && (!log_success(handle, op)))
                return;
@@ -780,11 +810,20 @@ static void do_log(vfs_op_type op, BOOL success, vfs_handle_struct *handle,
                fstr_sprintf(err_msg, "fail (%s)", strerror(errno));
 
        va_start(ap, format);
-       vsnprintf(op_msg, sizeof(op_msg), format, ap);
+       op_msg = talloc_vasprintf(NULL, format, ap);
        va_end(ap);
 
+       if (!op_msg) {
+               return;
+       }
+
+       audit_pre = audit_prefix(NULL, handle->conn);
        syslog(audit_syslog_priority(handle), "%s|%s|%s|%s\n",
-              audit_prefix(handle->conn), audit_opname(op), err_msg, op_msg);
+               audit_pre ? audit_pre : "",
+               audit_opname(op), err_msg, op_msg);
+
+       TALLOC_FREE(audit_pre);
+       TALLOC_FREE(op_msg);
 
        return;
 }
@@ -862,7 +901,7 @@ static void smb_full_audit_disconnect(vfs_handle_struct *handle)
 
 static SMB_BIG_UINT smb_full_audit_disk_free(vfs_handle_struct *handle,
                                    const char *path,
-                                   BOOL small_query, SMB_BIG_UINT *bsize, 
+                                   bool small_query, SMB_BIG_UINT *bsize, 
                                    SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
 {
        SMB_BIG_UINT result;
@@ -906,7 +945,7 @@ static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
 
 static int smb_full_audit_get_shadow_copy_data(struct vfs_handle_struct *handle,
                                struct files_struct *fsp,
-                               SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
+                               SHADOW_COPY_DATA *shadow_copy_data, bool labels)
 {
        int result;
 
@@ -1061,11 +1100,11 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
-                          int fd, void *data, size_t n, SMB_OFF_T offset)
+                          void *data, size_t n, SMB_OFF_T offset)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset);
+       result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 
        do_log(SMB_VFS_OP_PREAD, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1085,12 +1124,12 @@ static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp
 }
 
 static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp,
-                           int fd, const void *data, size_t n,
+                           const void *data, size_t n,
                            SMB_OFF_T offset)
 {
        ssize_t result;
 
-       result = SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset);
+       result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 
        do_log(SMB_VFS_OP_PWRITE, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1126,6 +1165,22 @@ static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd,
        return result;
 }
 
+static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd,
+                             files_struct *fsp, int tofd,
+                             SMB_OFF_T offset,
+                             size_t n)
+{
+       ssize_t result;
+
+       result = SMB_VFS_NEXT_RECVFILE(handle, fromfd, fsp, tofd,
+                                      offset, n);
+
+       do_log(SMB_VFS_OP_RECVFILE, (result >= 0), handle,
+              "%s", fsp->fsp_name);
+
+       return result;
+}
+
 static int smb_full_audit_rename(vfs_handle_struct *handle,
                        const char *oldname, const char *newname)
 {
@@ -1248,6 +1303,19 @@ static int smb_full_audit_fchown(vfs_handle_struct *handle, files_struct *fsp, i
        return result;
 }
 
+static int smb_full_audit_lchown(vfs_handle_struct *handle,
+                      const char *path, uid_t uid, gid_t gid)
+{
+       int result;
+
+       result = SMB_VFS_NEXT_LCHOWN(handle, path, uid, gid);
+
+       do_log(SMB_VFS_OP_LCHOWN, (result >= 0), handle, "%s|%ld|%ld",
+              path, (long int)uid, (long int)gid);
+
+       return result;
+}
+
 static int smb_full_audit_chdir(vfs_handle_struct *handle,
                       const char *path)
 {
@@ -1297,14 +1365,14 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp
        return result;
 }
 
-static BOOL smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, int fd,
                       int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
 {
-       BOOL result;
+       bool result;
 
        result = SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type);
 
-       do_log(SMB_VFS_OP_LOCK, (result >= 0), handle, "%s", fsp->fsp_name);
+       do_log(SMB_VFS_OP_LOCK, result, handle, "%s", fsp->fsp_name);
 
        return result;
 }
@@ -1336,14 +1404,14 @@ static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct
         return result;
 }
 
-static BOOL smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
+static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd,
                       SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
 {
-       BOOL result;
+       bool result;
 
        result = SMB_VFS_NEXT_GETLOCK(handle, fsp, fd, poffset, pcount, ptype, ppid);
 
-       do_log(SMB_VFS_OP_GETLOCK, (result >= 0), handle, "%s", fsp->fsp_name);
+       do_log(SMB_VFS_OP_GETLOCK, result, handle, "%s", fsp->fsp_name);
 
        return result;
 }
@@ -1410,8 +1478,25 @@ static char *smb_full_audit_realpath(vfs_handle_struct *handle,
        return result;
 }
 
+static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
+                       struct sys_notify_context *ctx,
+                       struct notify_entry *e,
+                       void (*callback)(struct sys_notify_context *ctx,
+                                       void *private_data,
+                                       struct notify_event *ev),
+                       void *private_data, void *handle_p)
+{
+       NTSTATUS result;
+
+       result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, e, callback, private_data, handle_p);
+
+       do_log(SMB_VFS_OP_NOTIFY_WATCH, NT_STATUS_IS_OK(result), handle, "");
+
+       return result;
+}
+
 static int smb_full_audit_chflags(vfs_handle_struct *handle,
-                           const char *path, uint flags)
+                           const char *path, unsigned int flags)
 {
        int result;
 
@@ -1422,60 +1507,76 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle,
        return result;
 }
 
-static size_t smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                               int fd, uint32 security_info,
+static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *handle,
+                                                   SMB_DEV_T dev, SMB_INO_T inode)
+{
+       struct file_id id_zero;
+       struct file_id result;
+
+       ZERO_STRUCT(id_zero);
+
+       result = SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode);
+
+       do_log(SMB_VFS_OP_FILE_ID_CREATE,
+              !file_id_equal(&id_zero, &result),
+              handle, "%s", file_id_string_tos(&result));
+
+       return result;
+}
+
+static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+                               uint32 security_info,
                                SEC_DESC **ppdesc)
 {
-       size_t result;
+       NTSTATUS result;
 
-       result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, fd, security_info,
-                                         ppdesc);
+       result = SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc);
 
-       do_log(SMB_VFS_OP_FGET_NT_ACL, (result > 0), handle,
+       do_log(SMB_VFS_OP_FGET_NT_ACL, NT_STATUS_IS_OK(result), handle,
               "%s", fsp->fsp_name);
 
        return result;
 }
 
-static size_t smb_full_audit_get_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                              const char *name, uint32 security_info,
-                              SEC_DESC **ppdesc)
+static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
+                                         files_struct *fsp,
+                                         const char *name,
+                                         uint32 security_info,
+                                         SEC_DESC **ppdesc)
 {
-       size_t result;
+       NTSTATUS result;
 
-       result = SMB_VFS_NEXT_GET_NT_ACL(handle, fsp, name, security_info,
-                                        ppdesc);
+       result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
 
-       do_log(SMB_VFS_OP_GET_NT_ACL, (result > 0), handle,
+       do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
               "%s", fsp->fsp_name);
 
        return result;
 }
 
-static BOOL smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
-                             int fd, uint32 security_info_sent,
+static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+                             uint32 security_info_sent,
                              SEC_DESC *psd)
 {
-       BOOL result;
+       NTSTATUS result;
 
-       result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, fd, security_info_sent,
-                                         psd);
+       result = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
 
-       do_log(SMB_VFS_OP_FSET_NT_ACL, result, handle, "%s", fsp->fsp_name);
+       do_log(SMB_VFS_OP_FSET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name);
 
        return result;
 }
 
-static BOOL smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
+static NTSTATUS smb_full_audit_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                             const char *name, uint32 security_info_sent,
                             SEC_DESC *psd)
 {
-       BOOL result;
+       NTSTATUS result;
 
        result = SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent,
                                         psd);
 
-       do_log(SMB_VFS_OP_SET_NT_ACL, result, handle, "%s", fsp->fsp_name);
+       do_log(SMB_VFS_OP_SET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name);
 
        return result;
 }