The branch, v4-0-test has been updated
       via  9328284 When message-type is drvupgrade, MSG_DEBUG should be 
replaced with MSG_PRINTER_DRVUPGRADE.
       via  865765c Check for WRITE_ACCESS on the file before overriding an 
EACCESS.
       via  e90f140 Ensure we don't try the open_file_fchmod() if we can't 
write to the file.
       via  02a9d78 Remove indentation around code wrapped by unneeded 
CAN_WRITE.
       via  7391cae Add early return in file_set_dosmode() on a read only share.
      from  d0ec11d BUG 9881: Check for system libtevent.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 93282840a193e107cb482494c76b26b681e8bd8d
Author: Peng Haitao <pen...@cn.fujitsu.com>
Date:   Wed May 22 14:03:13 2013 -0700

    When message-type is drvupgrade, MSG_DEBUG should be replaced with 
MSG_PRINTER_DRVUPGRADE.
    
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Michael Adam <ob...@samba.org>
    
    Fix bug #9941 - Fix a bug of drvupgrade of smbcontrol.
    
    Autobuild-User(v4-0-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-0-test): Mon Jun 10 23:09:33 CEST 2013 on sn-devel-104

commit 865765c24c45625b1f1bf901147f157667f397e5
Author: Jeremy Allison <j...@samba.org>
Date:   Thu Apr 25 14:06:03 2013 -0700

    Check for WRITE_ACCESS on the file before overriding an EACCESS.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    
    Autobuild-User(master): Volker Lendecke <v...@samba.org>
    Autobuild-Date(master): Sat Apr 27 15:57:17 CEST 2013 on sn-devel-104
    (cherry picked from commit 5185460067229a342ddf3951ecc968017c2ed4df)
    
    The last 4 patches address bug #9794 - opening/editing or copying MS files
    causes a core dump with invalid lock order.

commit e90f140baf54c2e8fcbefc273e1d760900deea9a
Author: Jeremy Allison <j...@samba.org>
Date:   Thu Apr 25 14:02:24 2013 -0700

    Ensure we don't try the open_file_fchmod() if we can't write to the file.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    (cherry picked from commit 77e3099483489ef4d59087dc6542fe7f7b589224)

commit 02a9d789d1c81fff2889109dd162be3f829bc126
Author: Jeremy Allison <j...@samba.org>
Date:   Thu Apr 25 14:00:42 2013 -0700

    Remove indentation around code wrapped by unneeded CAN_WRITE.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    (cherry picked from commit a91aac4a5f0bd2077be267e49d1fc4f0321bb39c)

commit 7391caec00d05963dd6f4e05130a86a207294669
Author: Jeremy Allison <j...@samba.org>
Date:   Thu Apr 25 13:59:22 2013 -0700

    Add early return in file_set_dosmode() on a read only share.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    (cherry picked from commit 0d88b37fc63023eeb749080713449b124e346e9e)

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/dosmode.c     |   57 ++++++++++++++++++++++++++-----------------
 source3/utils/smbcontrol.c |    2 +-
 2 files changed, 35 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index ad04a65..3152631 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -419,6 +419,10 @@ static bool set_ea_dos_attribute(connection_struct *conn,
                if(!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
                        return false;
 
+               if (!can_write_to_file(conn, smb_fname)) {
+                       return false;
+               }
+
                /*
                 * We need to open the file with write access whilst
                 * still in our current user context. This ensures we
@@ -706,6 +710,12 @@ int file_set_dosmode(connection_struct *conn, struct 
smb_filename *smb_fname,
        int ret = -1, lret = -1;
        uint32_t old_mode;
        struct timespec new_create_timespec;
+       files_struct *fsp = NULL;
+
+       if (!CAN_WRITE(conn)) {
+               errno = EROFS;
+               return -1;
+       }
 
        /* We only allow READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE here. */
        dosmode &= (SAMBA_ATTRIBUTES_MASK | FILE_ATTRIBUTE_OFFLINE);
@@ -848,29 +858,30 @@ int file_set_dosmode(connection_struct *conn, struct 
smb_filename *smb_fname,
                bits on a file. Just like file_ntimes below.
        */
 
-       /* Check if we have write access. */
-       if (CAN_WRITE(conn)) {
-               /*
-                * We need to open the file with write access whilst
-                * still in our current user context. This ensures we
-                * are not violating security in doing the fchmod.
-                */
-               files_struct *fsp;
-               if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname,
-                                    &fsp)))
-                       return -1;
-               become_root();
-               ret = SMB_VFS_FCHMOD(fsp, unixmode);
-               unbecome_root();
-               close_file(NULL, fsp, NORMAL_CLOSE);
-               if (!newfile) {
-                       notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-                                    FILE_NOTIFY_CHANGE_ATTRIBUTES,
-                                    smb_fname->base_name);
-               }
-               if (ret == 0) {
-                       smb_fname->st.st_ex_mode = unixmode;
-               }
+       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
+        * are not violating security in doing the fchmod.
+        */
+       if (!NT_STATUS_IS_OK(open_file_fchmod(conn, smb_fname,
+                            &fsp)))
+               return -1;
+       become_root();
+       ret = SMB_VFS_FCHMOD(fsp, unixmode);
+       unbecome_root();
+       close_file(NULL, fsp, NORMAL_CLOSE);
+       if (!newfile) {
+               notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+                            FILE_NOTIFY_CHANGE_ATTRIBUTES,
+                            smb_fname->base_name);
+       }
+       if (ret == 0) {
+               smb_fname->st.st_ex_mode = unixmode;
        }
 
        return( ret );
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 900ae9a..a522782 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -926,7 +926,7 @@ static bool do_drvupgrade(struct tevent_context *ev_ctx,
                return False;
        }
 
-       return send_message(msg_ctx, pid, MSG_DEBUG, argv[1],
+       return send_message(msg_ctx, pid, MSG_PRINTER_DRVUPGRADE, argv[1],
                            strlen(argv[1]) + 1);
 }
 


-- 
Samba Shared Repository

Reply via email to