Ensure we don't try the open_file_fchmod() if we can't write to the file.
authorJeremy Allison <jra@samba.org>
Thu, 25 Apr 2013 21:02:24 +0000 (14:02 -0700)
committerVolker Lendecke <vl@samba.org>
Sat, 27 Apr 2013 12:11:10 +0000 (14:11 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/dosmode.c

index 1fb00886f7588b4ad35de7f1c02685907fe67149..4a34947e254b3cf1080d9cbfc0f1101f7035aeb0 100644 (file)
@@ -856,6 +856,11 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
                bits on a file. Just like file_ntimes below.
        */
 
+       if (!can_write_to_file(conn, smb_fname)) {
+               errno = EACCES;
+               return -1;
+       }
+
        /*
         * We need to open the file with write access whilst
         * still in our current user context. This ensures we