Add early return in file_set_dosmode() on a read only share.
authorJeremy Allison <jra@samba.org>
Thu, 25 Apr 2013 20:59:22 +0000 (13:59 -0700)
committerVolker Lendecke <vl@samba.org>
Sat, 27 Apr 2013 12:10:52 +0000 (14:10 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/dosmode.c

index 19b7675a542fc990e872ef64f56e35315c94e9d0..cd7a1fdca18b3a65727e7efd505621b3c07d2f43 100644 (file)
@@ -706,6 +706,11 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
        uint32_t old_mode;
        struct timespec new_create_timespec;
 
+       if (!CAN_WRITE(conn)) {
+               errno = EROFS;
+               return -1;
+       }
+
        /* We only allow READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE here. */
        dosmode &= (SAMBA_ATTRIBUTES_MASK | FILE_ATTRIBUTE_OFFLINE);