summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-03-10 01:30:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:57 -0500
commiteb546db88d9d4ad8da3709b2edc4d455a88e6119 (patch)
tree80ac0ae2baf53cc8c73c65e0b7c1d9423463a91a /source3/smbd/reply.c
parentcbe4adaec7fe3a4f6a2ec443f6951ea61fb17f63 (diff)
downloadsamba-eb546db88d9d4ad8da3709b2edc4d455a88e6119.tar.gz
samba-eb546db88d9d4ad8da3709b2edc4d455a88e6119.tar.bz2
samba-eb546db88d9d4ad8da3709b2edc4d455a88e6119.zip
r5720: Attempt to fix bug #2382 (Excel shared workbook stops working). Also
incorporates part of the fix created by ke_miyata@itg.hitachi.co.jp for bug #2045 (MS-Office behavior of timestamp). Jeremy. (This used to be commit 4f3b12ac73487f4ccb37c17506af1abf5acc80cd)
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2dfeebbb9f..f149b79f79 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2876,6 +2876,13 @@ int reply_close(connection_struct *conn, char *inbuf,char *outbuf, int size,
conn->num_files_open));
/*
+ * Take care of any time sent in the close.
+ */
+
+ mtime = make_unix_date3(inbuf+smb_vwv1);
+ fsp_set_pending_modtime(fsp, mtime);
+
+ /*
* close_file() returns the unix errno if an error
* was detected on close - normally this is due to
* a disk full error. If not then it was probably an I/O error.
@@ -2886,16 +2893,6 @@ int reply_close(connection_struct *conn, char *inbuf,char *outbuf, int size,
END_PROFILE(SMBclose);
return (UNIXERROR(ERRHRD,ERRgeneral));
}
-
- /*
- * Now take care of any time sent in the close.
- */
-
- mtime = make_unix_date3(inbuf+smb_vwv1);
-
- /* try and set the date */
- set_filetime(conn, file_name, mtime);
-
}
/* We have a cached error */
@@ -4233,7 +4230,7 @@ static BOOL copy_file(char *src,char *dest1,connection_struct *conn, int ofun,
close_file(fsp1,False);
/* Ensure the modtime is set correctly on the destination file. */
- fsp2->pending_modtime = src_sbuf.st_mtime;
+ fsp_set_pending_modtime( fsp2, src_sbuf.st_mtime);
/*
* As we are opening fsp1 read-only we only expect
@@ -4917,7 +4914,7 @@ int reply_setattrE(connection_struct *conn, char *inbuf,char *outbuf, int size,
* Sometimes times are sent as zero - ignore them.
*/
- if ((unix_times.actime == 0) && (unix_times.modtime == 0)) {
+ if (null_mtime(unix_times.actime) && null_mtime(unix_times.modtime)) {
/* Ignore request */
if( DEBUGLVL( 3 ) ) {
dbgtext( "reply_setattrE fnum=%d ", fsp->fnum);
@@ -4925,12 +4922,13 @@ int reply_setattrE(connection_struct *conn, char *inbuf,char *outbuf, int size,
}
END_PROFILE(SMBsetattrE);
return(outsize);
- } else if ((unix_times.actime != 0) && (unix_times.modtime == 0)) {
- /* set modify time = to access time if modify time was 0 */
+ } else if (!null_mtime(unix_times.actime) && null_mtime(unix_times.modtime)) {
+ /* set modify time = to access time if modify time was unset */
unix_times.modtime = unix_times.actime;
}
/* Set the date on this file */
+ /* Should we set pending modtime here ? JRA */
if(file_utime(conn, fsp->fsp_name, &unix_times)) {
END_PROFILE(SMBsetattrE);
return ERROR_DOS(ERRDOS,ERRnoaccess);
@@ -5170,6 +5168,7 @@ int reply_getattrE(connection_struct *conn, char *inbuf,char *outbuf, int size,
put_dos_date2(outbuf,smb_vwv0,get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn))));
put_dos_date2(outbuf,smb_vwv2,sbuf.st_atime);
+ /* Should we check pending modtime here ? JRA */
put_dos_date2(outbuf,smb_vwv4,sbuf.st_mtime);
if (mode & aDIR) {