The branch, v3-2-test has been updated
       via  39d265375cf55eedddef2c4faa65398df73d5ed2 (commit)
      from  8fbefe18a2dc23adb0ebe488cfb37ab4a382207d (commit)

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


- Log -----------------------------------------------------------------
commit 39d265375cf55eedddef2c4faa65398df73d5ed2
Author: Jeremy Allison <[EMAIL PROTECTED]>
Date:   Wed Oct 31 15:45:45 2007 -0700

    Fix some cases where file_set_dosmode was being passed
    False instead of NULL. Fix more of the notifications to
    be correct for Samba4 RAW-NOTIFY torture (we had missed
    one when calling set_ea_dos_attribute().
    Jeremy.

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

Summary of changes:
 source/script/tests/selftest.sh |    2 ++
 source/smbd/dosmode.c           |   19 ++++++++++++++-----
 source/smbd/fileio.c            |    9 +++++++--
 source/smbd/nttrans.c           |    2 +-
 source/smbd/open.c              |    6 ++++--
 source/smbd/reply.c             |    2 +-
 source/smbd/trans2.c            |    2 +-
 7 files changed, 30 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/script/tests/selftest.sh b/source/script/tests/selftest.sh
index 8de6420..30355a8 100755
--- a/source/script/tests/selftest.sh
+++ b/source/script/tests/selftest.sh
@@ -139,6 +139,8 @@ cat >$SERVERCONFFILE<<EOF
        printing = bsd
        printcap name = /dev/null
 
+#      min receivefile size = 4000
+
 [tmp]
        path = $PREFIX_ABS/tmp
        read only = no
diff --git a/source/smbd/dosmode.c b/source/smbd/dosmode.c
index ed622d3..18e6439 100644
--- a/source/smbd/dosmode.c
+++ b/source/smbd/dosmode.c
@@ -425,7 +425,8 @@ uint32 dos_mode(connection_struct *conn, const char 
*path,SMB_STRUCT_STAT *sbuf)
 
 int file_set_dosmode(connection_struct *conn, const char *fname,
                     uint32 dosmode, SMB_STRUCT_STAT *st,
-                    const char *parent_dir)
+                    const char *parent_dir,
+                    bool newfile)
 {
        SMB_STRUCT_STAT st1;
        int mask=0;
@@ -455,6 +456,10 @@ int file_set_dosmode(connection_struct *conn, const char 
*fname,
 
        /* Store the DOS attributes in an EA by preference. */
        if (set_ea_dos_attribute(conn, fname, st, dosmode)) {
+               if (!newfile) {
+                       notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+                               FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+               }
                return 0;
        }
 
@@ -491,8 +496,10 @@ int file_set_dosmode(connection_struct *conn, const char 
*fname,
        }
 
        if ((ret = SMB_VFS_CHMOD(conn,fname,unixmode)) == 0) {
-               notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-                            FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+               if (!newfile) {
+                       notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+                               FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+               }
                return 0;
        }
 
@@ -523,8 +530,10 @@ int file_set_dosmode(connection_struct *conn, const char 
*fname,
                ret = SMB_VFS_FCHMOD(fsp, fsp->fh->fd, unixmode);
                unbecome_root();
                close_file_fchmod(fsp);
-               notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-                            FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+               if (!newfile) {
+                       notify_fname(conn, NOTIFY_ACTION_MODIFIED,
+                               FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
+               }
        }
 
        return( ret );
diff --git a/source/smbd/fileio.c b/source/smbd/fileio.c
index 9e296f2..74f2c67 100644
--- a/source/smbd/fileio.c
+++ b/source/smbd/fileio.c
@@ -230,8 +230,13 @@ ssize_t write_file(struct smb_request *req,
 
                if (SMB_VFS_FSTAT(fsp,fsp->fh->fd,&st) == 0) {
                        int dosmode = dos_mode(fsp->conn,fsp->fsp_name,&st);
-                       if ((lp_store_dos_attributes(SNUM(fsp->conn)) || 
MAP_ARCHIVE(fsp->conn)) && !IS_DOS_ARCHIVE(dosmode)) {
-                               
file_set_dosmode(fsp->conn,fsp->fsp_name,dosmode | aARCH,&st, False);
+                       if ((lp_store_dos_attributes(SNUM(fsp->conn)) ||
+                                       MAP_ARCHIVE(fsp->conn)) &&
+                                       !IS_DOS_ARCHIVE(dosmode)) {
+                               file_set_dosmode(fsp->conn,fsp->fsp_name,
+                                               dosmode | aARCH,&st,
+                                               NULL,
+                                               false);
                        }
 
                        /*
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index bbbde06..da926d1 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -1971,7 +1971,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
           creates the file. This isn't the correct thing to do in the copy
           case. JRA */
        file_set_dosmode(conn, newname, fattr, &sbuf2,
-                        parent_dirname(newname));
+                        parent_dirname(newname),false);
 
        if (ret < (SMB_OFF_T)sbuf1.st_size) {
                return NT_STATUS_DISK_FULL;
diff --git a/source/smbd/open.c b/source/smbd/open.c
index 4ed3a70..53fc1be 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -1866,7 +1866,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                        if (!posix_open) {
                                file_set_dosmode(conn, fname,
                                         new_dos_attributes | aARCH, NULL,
-                                        parent_dir);
+                                        parent_dir,
+                                        true);
                        }
                }
        }
@@ -2035,7 +2036,8 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
                if (!posix_open) {
                        file_set_dosmode(conn, name,
                                 file_attributes | aDIR, NULL,
-                                parent_dir);
+                                parent_dir,
+                                true);
                }
        }
 
diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 531e71f..d2aa6c6 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -1114,7 +1114,7 @@ void reply_setatr(connection_struct *conn, struct 
smb_request *req)
                else
                        mode &= ~aDIR;
 
-               if (file_set_dosmode(conn,fname,mode,&sbuf,False) != 0) {
+               if (file_set_dosmode(conn,fname,mode,&sbuf,NULL,false) != 0) {
                        reply_unixerror(req, ERRDOS, ERRnoaccess);
                        END_PROFILE(SMBsetatr);
                        return;
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index d75f6a2..58d44a8 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -4563,7 +4563,7 @@ static NTSTATUS smb_set_file_dosmode(connection_struct 
*conn,
                DEBUG(10,("smb_set_file_dosmode: file %s : setting dos mode 
0x%x\n",
                                        fname, (unsigned int)dosmode ));
 
-               if(file_set_dosmode(conn, fname, dosmode, psbuf, False)) {
+               if(file_set_dosmode(conn, fname, dosmode, psbuf, NULL, false)) {
                        DEBUG(2,("smb_set_file_dosmode: file_set_dosmode of %s 
failed (%s)\n",
                                                fname, strerror(errno)));
                        return map_nt_error_from_unix(errno);


-- 
Samba Shared Repository

Reply via email to