summaryrefslogtreecommitdiffstats
path: root/source3/smbd/vfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r--source3/smbd/vfs.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index ed5009885be..c6edef282fa 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1501,7 +1501,7 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
}
/* cd into the parent dir to pin it. */
- ret = SMB_VFS_CHDIR(fsp->conn, parent_dir);
+ ret = vfs_ChDir(fsp->conn, parent_dir);
if (ret == -1) {
return map_nt_error_from_unix(errno);
}
@@ -1512,12 +1512,14 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
/* Must use lstat here. */
ret = SMB_VFS_LSTAT(fsp->conn, &local_fname);
if (ret == -1) {
- return map_nt_error_from_unix(errno);
+ status = map_nt_error_from_unix(errno);
+ goto out;
}
/* Ensure it matches the fsp stat. */
if (!check_same_stat(&local_fname.st, &fsp->fsp_name->st)) {
- return NT_STATUS_ACCESS_DENIED;
+ status = NT_STATUS_ACCESS_DENIED;
+ goto out;
}
path = final_component;
} else {
@@ -1540,6 +1542,8 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
status = map_nt_error_from_unix(errno);
}
+ out:
+
if (as_root) {
vfs_ChDir(fsp->conn,saved_dir);
TALLOC_FREE(saved_dir);