From 6f22cd10ad30bd9077916c4fecbc8f7bb08c68b9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 2 Oct 2009 13:45:38 -0700 Subject: Remove lots of duplicate code and move it into one function vfs_stat_fsp(). Stops code looking at fsp->posix_open except for exceptional circumstances. Jeremy. --- source3/smbd/posix_acls.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'source3/smbd/posix_acls.c') diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 6b5a9af45b..32a04c51e4 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3739,7 +3739,6 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC bool set_acl_as_root = false; bool acl_set_support = false; bool ret = false; - int sret; DEBUG(10,("set_nt_acl: called for file %s\n", fsp_str_dbg(fsp))); @@ -3753,19 +3752,9 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC * Get the current state of the file. */ - if(fsp->is_directory || fsp->fh->fd == -1) { - if (fsp->posix_open) { - sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name); - } else { - sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name); - } - if (sret == -1) { - return map_nt_error_from_unix(errno); - } - } else { - if(SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) != 0) { - return map_nt_error_from_unix(errno); - } + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { + return status; } /* Save the original element we check against. */ @@ -3809,18 +3798,9 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC * (suid/sgid bits, for instance) */ - if(fsp->is_directory || fsp->fh->fd == -1) { - if (fsp->posix_open) { - sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name); - } else { - sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name); - } - } else { - sret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st); - } - - if(sret == -1) { - return map_nt_error_from_unix(errno); + status = vfs_stat_fsp(fsp); + if (!NT_STATUS_IS_OK(status)) { + return status; } /* Save the original element we check against. */ -- cgit