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 1b44e02375b0b40ec8c4f6f074c7447c7613a7b9..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 {
@@ -190,15 +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);
+                             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,
@@ -419,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. */
 
@@ -558,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" },
@@ -585,6 +592,7 @@ 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" },
@@ -693,11 +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,
+                       lp_servicename(SNUM(conn)),
+                       conn->server_info->unix_name,
                        conn->connectpath,
-                       conn->server_info->gid,
-                       get_current_username(),
-                       current_user_info.domain,
+                       conn->server_info->utok.gid,
+                       conn->server_info->sanitized_username,
+                       pdb_get_domain(conn->server_info->sam_account),
                        prefix);
 }
 
@@ -1524,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)
@@ -1539,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)
@@ -1549,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;