}
/* 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);
}
/* 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 {
status = map_nt_error_from_unix(errno);
}
+ out:
+
if (as_root) {
vfs_ChDir(fsp->conn,saved_dir);
TALLOC_FREE(saved_dir);