r10276: Fix for bug #3104 from Leo Weppelman <leo@wau.mis.ah.nl>.
authorJeremy Allison <jra@samba.org>
Fri, 16 Sep 2005 20:06:10 +0000 (20:06 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:03:40 +0000 (11:03 -0500)
Don't update the time on read-only shares.
We need this as set_filetime (which can be called on
close and other paths) can end up calling this function
without the NEED_WRITE protection.
Jeremy.
(This used to be commit 54eab3828aa0405288b68f6954abba201564c9e7)

source3/smbd/dosmode.c

index a2bc424b8e751734ed075146526973218ed3875d..ee2f1095fad21592f3aa87ea5db88f7a14b0ff19 100644 (file)
@@ -451,6 +451,17 @@ int file_utime(connection_struct *conn, const char *fname, struct utimbuf *times
        errno = 0;
        ZERO_STRUCT(sbuf);
 
+       /* Don't update the time on read-only shares */
+       /* We need this as set_filetime (which can be called on
+          close and other paths) can end up calling this function
+          without the NEED_WRITE protection. Found by : 
+          Leo Weppelman <leo@wau.mis.ah.nl>
+       */
+
+       if (!CAN_WRITE(conn)) {
+               return 0;
+       }
+
        if(SMB_VFS_UTIME(conn,fname, times) == 0)
                return 0;