From: Alexander Bokovoy Date: Wed, 6 Feb 2008 06:10:50 +0000 (+0300) Subject: Change the file time before we change the file mode. X-Git-Tag: samba-3.2.0pre2~37^2~432 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=7da6c675440b0253ab37ee6097f769a2e45c7b7b;p=samba.git Change the file time before we change the file mode. 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. --- diff --git a/source/smbd/reply.c b/source/smbd/reply.c index bced8ed984a..baebff83dec 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -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 ) );