]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_full_audit. Implement renameat().
authorJeremy Allison <jra@samba.org>
Fri, 9 Aug 2019 21:25:21 +0000 (14:25 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 16 Aug 2019 19:52:32 +0000 (19:52 +0000)
Currently identical to rename().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_full_audit.c

index 7a2e15d59601a8340d2e714ff31688171384583b..fd01d23b202a119af047b5c33fdb07f413a7e8d7 100644 (file)
@@ -129,6 +129,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_SENDFILE,
        SMB_VFS_OP_RECVFILE,
        SMB_VFS_OP_RENAME,
+       SMB_VFS_OP_RENAMEAT,
        SMB_VFS_OP_FSYNC,
        SMB_VFS_OP_FSYNC_SEND,
        SMB_VFS_OP_FSYNC_RECV,
@@ -272,6 +273,7 @@ static struct {
        { SMB_VFS_OP_SENDFILE,  "sendfile" },
        { SMB_VFS_OP_RECVFILE,  "recvfile" },
        { SMB_VFS_OP_RENAME,    "rename" },
+       { SMB_VFS_OP_RENAMEAT,  "renameat" },
        { SMB_VFS_OP_FSYNC,     "fsync" },
        { SMB_VFS_OP_FSYNC_SEND,        "fsync_send" },
        { SMB_VFS_OP_FSYNC_RECV,        "fsync_recv" },
@@ -1364,6 +1366,27 @@ static int smb_full_audit_rename(vfs_handle_struct *handle,
        return result;    
 }
 
+static int smb_full_audit_renameat(vfs_handle_struct *handle,
+                               files_struct *srcfsp,
+                               const struct smb_filename *smb_fname_src,
+                               files_struct *dstfsp,
+                               const struct smb_filename *smb_fname_dst)
+{
+       int result;
+
+       result = SMB_VFS_NEXT_RENAMEAT(handle,
+                               srcfsp,
+                               smb_fname_src,
+                               dstfsp,
+                               smb_fname_dst);
+
+       do_log(SMB_VFS_OP_RENAMEAT, (result >= 0), handle, "%s|%s",
+              smb_fname_str_do_log(handle->conn, smb_fname_src),
+              smb_fname_str_do_log(handle->conn, smb_fname_dst));
+
+       return result;
+}
+
 struct smb_full_audit_fsync_state {
        vfs_handle_struct *handle;
        files_struct *fsp;
@@ -2847,6 +2870,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .sendfile_fn = smb_full_audit_sendfile,
        .recvfile_fn = smb_full_audit_recvfile,
        .rename_fn = smb_full_audit_rename,
+       .renameat_fn = smb_full_audit_renameat,
        .fsync_send_fn = smb_full_audit_fsync_send,
        .fsync_recv_fn = smb_full_audit_fsync_recv,
        .stat_fn = smb_full_audit_stat,