Author: jra
Date: 2005-10-11 04:25:47 +0000 (Tue, 11 Oct 2005)
New Revision: 10885

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10885

Log:
Fix bug where read-only share files are always seen as
read-only. Noticed by Andrew Bartlett.
Jeremy

Modified:
   branches/SAMBA_3_0/source/smbd/dosmode.c
   branches/SAMBA_3_0/source/smbd/posix_acls.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/dosmode.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/dosmode.c    2005-10-10 22:18:12 UTC (rev 
10884)
+++ branches/SAMBA_3_0/source/smbd/dosmode.c    2005-10-11 04:25:47 UTC (rev 
10885)
@@ -479,7 +479,7 @@
         */
 
        /* 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);

Modified: branches/SAMBA_3_0/source/smbd/posix_acls.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/posix_acls.c 2005-10-10 22:18:12 UTC (rev 
10884)
+++ branches/SAMBA_3_0/source/smbd/posix_acls.c 2005-10-11 04:25:47 UTC (rev 
10885)
@@ -4149,16 +4149,13 @@
 /****************************************************************************
  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;

Reply via email to