Update vfs version as I've added a const to the security_descriptor paramter in fset_...
[samba.git] / source3 / modules / vfs_full_audit.c
index 19218cc47d12a2edb69b40ea953d6bddd8cafe7e..9fadcd9e0cb994471fd5dd02f8520c6586defcd7 100644 (file)
@@ -59,8 +59,6 @@
 
 #include "includes.h"
 
-extern userdom_struct current_user_info;
-
 static int vfs_full_audit_debug_level = DBGC_VFS;
 
 struct vfs_full_audit_private_data {
@@ -111,7 +109,7 @@ static int smb_full_audit_closedir(vfs_handle_struct *handle,
                          SMB_STRUCT_DIR *dirp);
 static int smb_full_audit_open(vfs_handle_struct *handle,
                      const char *fname, files_struct *fsp, int flags, mode_t mode);
-static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd);
+static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp);
 static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp,
                          void *data, size_t n);
 static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp,
@@ -190,18 +188,21 @@ static int smb_full_audit_chflags(vfs_handle_struct *handle,
                            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_streaminfo(vfs_handle_struct *handle,
+                                         struct files_struct *fsp,
+                                         const char *fname,
+                                         TALLOC_CTX *mem_ctx,
+                                         unsigned int *pnum_streams,
+                                         struct stream_struct **pstreams);
 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                                uint32 security_info,
                                SEC_DESC **ppdesc);
-static NTSTATUS 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,
                               const char *name, uint32 security_info,
                               SEC_DESC **ppdesc);
 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                              uint32 security_info_sent,
-                             SEC_DESC *psd);
-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);
+                             const SEC_DESC *psd);
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
                           const char *path, mode_t mode);
 static int smb_full_audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp,
@@ -422,6 +423,8 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_file_id_create),     SMB_VFS_OP_FILE_ID_CREATE,
         SMB_VFS_LAYER_LOGGER},
+       {SMB_VFS_OP(smb_full_audit_streaminfo), SMB_VFS_OP_STREAMINFO,
+        SMB_VFS_LAYER_LOGGER},
 
        /* NT ACL operations. */
 
@@ -431,8 +434,6 @@ static vfs_op_tuple audit_op_tuples[] = {
         SMB_VFS_LAYER_LOGGER},
        {SMB_VFS_OP(smb_full_audit_fset_nt_acl),        SMB_VFS_OP_FSET_NT_ACL,
         SMB_VFS_LAYER_LOGGER},
-       {SMB_VFS_OP(smb_full_audit_set_nt_acl), SMB_VFS_OP_SET_NT_ACL,
-        SMB_VFS_LAYER_LOGGER},
 
        /* POSIX ACL operations. */
 
@@ -563,6 +564,7 @@ static struct {
        { SMB_VFS_OP_PWRITE,    "pwrite" },
        { SMB_VFS_OP_LSEEK,     "lseek" },
        { SMB_VFS_OP_SENDFILE,  "sendfile" },
+       { SMB_VFS_OP_RECVFILE,  "recvfile" },
        { SMB_VFS_OP_RENAME,    "rename" },
        { SMB_VFS_OP_FSYNC,     "fsync" },
        { SMB_VFS_OP_STAT,      "stat" },
@@ -590,10 +592,10 @@ static struct {
        { SMB_VFS_OP_NOTIFY_WATCH, "notify_watch" },
        { SMB_VFS_OP_CHFLAGS,   "chflags" },
        { SMB_VFS_OP_FILE_ID_CREATE,    "file_id_create" },
+       { SMB_VFS_OP_STREAMINFO,        "streaminfo" },
        { 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" },
-       { SMB_VFS_OP_SET_NT_ACL,        "set_nt_acl" },
        { SMB_VFS_OP_CHMOD_ACL, "chmod_acl" },
        { SMB_VFS_OP_FCHMOD_ACL,        "fchmod_acl" },
        { SMB_VFS_OP_SYS_ACL_GET_ENTRY, "sys_acl_get_entry" },
@@ -699,10 +701,12 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
                return NULL;
        }
        return talloc_sub_advanced(ctx,
-                       lp_servicename(SNUM(conn)), conn->user,
-                       conn->connectpath, conn->gid,
-                       get_current_username(),
-                       current_user_info.domain,
+                       lp_servicename(SNUM(conn)),
+                       conn->server_info->unix_name,
+                       conn->connectpath,
+                       conn->server_info->utok.gid,
+                       conn->server_info->sanitized_username,
+                       pdb_get_domain(conn->server_info->sam_account),
                        prefix);
 }
 
@@ -1083,11 +1087,11 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
+static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp)
 {
        int result;
        
-       result = SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
+       result = SMB_VFS_NEXT_CLOSE(handle, fsp);
 
        do_log(SMB_VFS_OP_CLOSE, (result >= 0), handle, "%s", fsp->fsp_name);
 
@@ -1529,6 +1533,24 @@ static struct file_id smb_full_audit_file_id_create(struct vfs_handle_struct *ha
        return result;
 }
 
+static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
+                                         struct files_struct *fsp,
+                                         const char *fname,
+                                         TALLOC_CTX *mem_ctx,
+                                         unsigned int *pnum_streams,
+                                         struct stream_struct **pstreams)
+{
+       NTSTATUS result;
+
+       result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx,
+                                        pnum_streams, pstreams);
+
+       do_log(SMB_VFS_OP_STREAMINFO, NT_STATUS_IS_OK(result), handle,
+              "%s", fname);
+
+       return result;
+}
+
 static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                                uint32 security_info,
                                SEC_DESC **ppdesc)
@@ -1544,7 +1566,6 @@ static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_stru
 }
 
 static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
-                                         files_struct *fsp,
                                          const char *name,
                                          uint32 security_info,
                                          SEC_DESC **ppdesc)
@@ -1554,14 +1575,14 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
        result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info, ppdesc);
 
        do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
-              "%s", fsp->fsp_name);
+              "%s", name);
 
        return result;
 }
 
 static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
                              uint32 security_info_sent,
-                             SEC_DESC *psd)
+                             const SEC_DESC *psd)
 {
        NTSTATUS result;
 
@@ -1572,20 +1593,6 @@ static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_stru
        return result;
 }
 
-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)
-{
-       NTSTATUS result;
-
-       result = SMB_VFS_NEXT_SET_NT_ACL(handle, fsp, name, security_info_sent,
-                                        psd);
-
-       do_log(SMB_VFS_OP_SET_NT_ACL, NT_STATUS_IS_OK(result), handle, "%s", fsp->fsp_name);
-
-       return result;
-}
-
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
                           const char *path, mode_t mode)
 {