Change the file time before we change the file mode.
authorAlexander Bokovoy <ab@samba.org>
Wed, 6 Feb 2008 06:10:50 +0000 (09:10 +0300)
committerAlexander Bokovoy <ab@samba.org>
Wed, 6 Feb 2008 06:10:50 +0000 (09:10 +0300)
This doesn't matter for most applications, but for offline files it matters as it allows you to set
files offline from windows clients even with HSM systems that refuse to offline newly created files.
Merge from Tridge's v3-0-ctdb tree.

source/smbd/reply.c

index bced8ed984ae766f62baf47c88eb256a4730d2f8..baebff83decbc0e5446e0a45bb85e3c259f91969 100644 (file)
@@ -1110,6 +1110,12 @@ void reply_setatr(struct smb_request *req)
        mode = SVAL(req->inbuf,smb_vwv0);
        mtime = srv_make_unix_date3(req->inbuf+smb_vwv1);
 
+       if (!set_filetime(conn,fname,convert_time_t_to_timespec(mtime))) {
+               reply_unixerror(req, ERRDOS, ERRnoaccess);
+               END_PROFILE(SMBsetatr);
+               return;
+       }
+
        if (mode != FILE_ATTRIBUTE_NORMAL) {
                if (VALID_STAT_OF_DIR(sbuf))
                        mode |= aDIR;
@@ -1123,12 +1129,6 @@ void reply_setatr(struct smb_request *req)
                }
        }
 
-       if (!set_filetime(conn,fname,convert_time_t_to_timespec(mtime))) {
-               reply_unixerror(req, ERRDOS, ERRnoaccess);
-               END_PROFILE(SMBsetatr);
-               return;
-       }
-
        reply_outbuf(req, 0, 0);
  
        DEBUG( 3, ( "setatr name=%s mode=%d\n", fname, mode ) );