VFS: Modify chown to take a const struct smb_filename * instead of const char *
[kai/samba-autobuild/.git] / source3 / modules / vfs_full_audit.c
index 3dd200510cc5208d4e9c3159c208c338d021f1c9..309158a41c2769d3ee2b35b936ae547873578fde 100644 (file)
@@ -776,13 +776,16 @@ static NTSTATUS smb_full_audit_snap_delete(struct vfs_handle_struct *handle,
 }
 
 static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
-                         const char *fname, const char *mask, uint32_t attr)
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        DIR *result;
 
-       result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
 
-       do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
+       do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
+               smb_fname->base_name);
 
        return result;
 }
@@ -1020,7 +1023,7 @@ struct smb_full_audit_pread_state {
        vfs_handle_struct *handle;
        files_struct *fsp;
        ssize_t ret;
-       int err;
+       struct vfs_aio_state vfs_aio_state;
 };
 
 static void smb_full_audit_pread_done(struct tevent_req *subreq);
@@ -1063,17 +1066,18 @@ static void smb_full_audit_pread_done(struct tevent_req *subreq)
        struct smb_full_audit_pread_state *state = tevent_req_data(
                req, struct smb_full_audit_pread_state);
 
-       state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
+       state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
        TALLOC_FREE(subreq);
        tevent_req_done(req);
 }
 
-static ssize_t smb_full_audit_pread_recv(struct tevent_req *req, int *err)
+static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
+                                        struct vfs_aio_state *vfs_aio_state)
 {
        struct smb_full_audit_pread_state *state = tevent_req_data(
                req, struct smb_full_audit_pread_state);
 
-       if (tevent_req_is_unix_error(req, err)) {
+       if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
                do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
                       fsp_str_do_log(state->fsp));
                return -1;
@@ -1082,7 +1086,7 @@ static ssize_t smb_full_audit_pread_recv(struct tevent_req *req, int *err)
        do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
               fsp_str_do_log(state->fsp));
 
-       *err = state->err;
+       *vfs_aio_state = state->vfs_aio_state;
        return state->ret;
 }
 
@@ -1117,7 +1121,7 @@ struct smb_full_audit_pwrite_state {
        vfs_handle_struct *handle;
        files_struct *fsp;
        ssize_t ret;
-       int err;
+       struct vfs_aio_state vfs_aio_state;
 };
 
 static void smb_full_audit_pwrite_done(struct tevent_req *subreq);
@@ -1161,17 +1165,18 @@ static void smb_full_audit_pwrite_done(struct tevent_req *subreq)
        struct smb_full_audit_pwrite_state *state = tevent_req_data(
                req, struct smb_full_audit_pwrite_state);
 
-       state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
+       state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
        TALLOC_FREE(subreq);
        tevent_req_done(req);
 }
 
-static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req, int *err)
+static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req,
+                                         struct vfs_aio_state *vfs_aio_state)
 {
        struct smb_full_audit_pwrite_state *state = tevent_req_data(
                req, struct smb_full_audit_pwrite_state);
 
-       if (tevent_req_is_unix_error(req, err)) {
+       if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
                do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
                       fsp_str_do_log(state->fsp));
                return -1;
@@ -1180,7 +1185,7 @@ static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req, int *err)
        do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
               fsp_str_do_log(state->fsp));
 
-       *err = state->err;
+       *vfs_aio_state = state->vfs_aio_state;
        return state->ret;
 }
 
@@ -1258,7 +1263,7 @@ struct smb_full_audit_fsync_state {
        vfs_handle_struct *handle;
        files_struct *fsp;
        int ret;
-       int err;
+       struct vfs_aio_state vfs_aio_state;
 };
 
 static void smb_full_audit_fsync_done(struct tevent_req *subreq);
@@ -1299,17 +1304,18 @@ static void smb_full_audit_fsync_done(struct tevent_req *subreq)
        struct smb_full_audit_fsync_state *state = tevent_req_data(
                req, struct smb_full_audit_fsync_state);
 
-       state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
+       state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
        TALLOC_FREE(subreq);
        tevent_req_done(req);
 }
 
-static int smb_full_audit_fsync_recv(struct tevent_req *req, int *err)
+static int smb_full_audit_fsync_recv(struct tevent_req *req,
+                                    struct vfs_aio_state *vfs_aio_state)
 {
        struct smb_full_audit_fsync_state *state = tevent_req_data(
                req, struct smb_full_audit_fsync_state);
 
-       if (tevent_req_is_unix_error(req, err)) {
+       if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
                do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
                       fsp_str_do_log(state->fsp));
                return -1;
@@ -1318,7 +1324,7 @@ static int smb_full_audit_fsync_recv(struct tevent_req *req, int *err)
        do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
               fsp_str_do_log(state->fsp));
 
-       *err = state->err;
+       *vfs_aio_state = state->vfs_aio_state;
        return state->ret;
 }
 
@@ -1388,13 +1394,16 @@ static int smb_full_audit_unlink(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_chmod(vfs_handle_struct *handle,
-                      const char *path, mode_t mode)
+                               const struct smb_filename *smb_fname,
+                               mode_t mode)
 {
        int result;
 
-       result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+       result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
 
-       do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o", path, mode);
+       do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o",
+               smb_fname->base_name,
+               mode);
 
        return result;
 }
@@ -1413,14 +1422,16 @@ static int smb_full_audit_fchmod(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int smb_full_audit_chown(vfs_handle_struct *handle,
-                      const char *path, uid_t uid, gid_t gid)
+                       const struct smb_filename *smb_fname,
+                       uid_t uid,
+                       gid_t gid)
 {
        int result;
 
-       result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
+       result = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
 
        do_log(SMB_VFS_OP_CHOWN, (result >= 0), handle, "%s|%ld|%ld",
-              path, (long int)uid, (long int)gid);
+              smb_fname->base_name, (long int)uid, (long int)gid);
 
        return result;
 }
@@ -1942,14 +1953,15 @@ static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_stru
 }
 
 static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
-                          const char *path, mode_t mode)
+                               const struct smb_filename *smb_fname,
+                               mode_t mode)
 {
        int result;
        
-       result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+       result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
 
        do_log(SMB_VFS_OP_CHMOD_ACL, (result >= 0), handle,
-              "%s|%o", path, mode);
+              "%s|%o", smb_fname->base_name, mode);
 
        return result;
 }