summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-04-25 14:00:42 -0700
committerVolker Lendecke <vl@samba.org>2013-04-27 14:11:05 +0200
commita91aac4a5f0bd2077be267e49d1fc4f0321bb39c (patch)
treee808311b4c595eeaaf9994a271e4436a73fc4cde /source3
parent0d88b37fc63023eeb749080713449b124e346e9e (diff)
downloadsamba-a91aac4a5f0bd2077be267e49d1fc4f0321bb39c.tar.gz
samba-a91aac4a5f0bd2077be267e49d1fc4f0321bb39c.tar.bz2
samba-a91aac4a5f0bd2077be267e49d1fc4f0321bb39c.zip
Remove indentation around code wrapped by unneeded CAN_WRITE.
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dosmode.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index cd7a1fdca1..1fb00886f7 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -705,6 +705,7 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
int ret = -1, lret = -1;
uint32_t old_mode;
struct timespec new_create_timespec;
+ files_struct *fsp = NULL;
if (!CAN_WRITE(conn)) {
errno = EROFS;
@@ -855,29 +856,25 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
bits on a file. Just like file_ntimes below.
*/
- /* Check if we have write access. */
- if (CAN_WRITE(conn)) {
- /*
- * We need to open the file with write access whilst
- * still in our current user context. This ensures we
- * are not violating security in doing the fchmod.
- */
- files_struct *fsp;
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname,
- &fsp)))
- return -1;
- become_root();
- ret = SMB_VFS_FCHMOD(fsp, unixmode);
- unbecome_root();
- close_file(NULL, fsp, NORMAL_CLOSE);
- if (!newfile) {
- notify_fname(conn, NOTIFY_ACTION_MODIFIED,
- FILE_NOTIFY_CHANGE_ATTRIBUTES,
- smb_fname->base_name);
- }
- if (ret == 0) {
- smb_fname->st.st_ex_mode = unixmode;
- }
+ /*
+ * We need to open the file with write access whilst
+ * still in our current user context. This ensures we
+ * are not violating security in doing the fchmod.
+ */
+ if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname,
+ &fsp)))
+ return -1;
+ become_root();
+ ret = SMB_VFS_FCHMOD(fsp, unixmode);
+ unbecome_root();
+ close_file(NULL, fsp, NORMAL_CLOSE);
+ if (!newfile) {
+ notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+ FILE_NOTIFY_CHANGE_ATTRIBUTES,
+ smb_fname->base_name);
+ }
+ if (ret == 0) {
+ smb_fname->st.st_ex_mode = unixmode;
}
return( ret );