r10885: Fix bug where read-only share files are always seen as
authorJeremy Allison <jra@samba.org>
Tue, 11 Oct 2005 04:25:47 +0000 (04:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:04:55 +0000 (11:04 -0500)
read-only. Noticed by Andrew Bartlett.
Jeremy

source/smbd/dosmode.c
source/smbd/posix_acls.c

index efbd5f04cb957103f8a3428de5b1af4b945496dd..6aee6ba426c597b0639ff401b58126da299e07e4 100644 (file)
@@ -479,7 +479,7 @@ int file_utime(connection_struct *conn, const char *fname, struct utimbuf *times
         */
 
        /* Check if we have write access. */
-       if (can_write_to_file(conn, fname, &sbuf)) {
+       if (CAN_WRITE(conn) && can_write_to_file(conn, fname, &sbuf)) {
                /* We are allowed to become root and change the filetime. */
                become_root();
                ret = SMB_VFS_UTIME(conn,fname, times);
index f1c9426676a023c434a69e918173ad0ea0dd441c..818bf95b3f9e7542ab15fc5e7aaaf2cc7d7a531a 100644 (file)
@@ -4149,16 +4149,13 @@ BOOL can_delete_file_in_directory(connection_struct *conn, const char *fname)
 /****************************************************************************
  Actually emulate the in-kernel access checking for write access. We need
  this to successfully check for ability to write for dos filetimes.
+ Note this doesn't take into account share write permissions.
 ****************************************************************************/
 
 BOOL can_write_to_file(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf)
 {
        int ret;
 
-       if (!CAN_WRITE(conn)) {
-               return False;
-       }
-
        if (current_user.uid == 0 || conn->admin_user) {
                /* I'm sorry sir, I didn't know you were root... */
                return True;