svn commit: samba r17761 - in branches: SAMBA_3_0/source/libsmb SAMBA_3_0/source/torture SAMBA_3_0_23/source/libsmb SAMBA_3_0_23/source/torture

jra at samba.org jra at samba.org
Wed Aug 23 22:33:52 GMT 2006


Author: jra
Date: 2006-08-23 22:33:50 +0000 (Wed, 23 Aug 2006)
New Revision: 17761

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17761

Log:
Handle times consistently across all client utils.
Fixes bugs reported in libsmbclient.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/clilist.c
   branches/SAMBA_3_0/source/libsmb/clirap.c
   branches/SAMBA_3_0/source/libsmb/libsmbclient.c
   branches/SAMBA_3_0/source/torture/torture.c
   branches/SAMBA_3_0_23/source/libsmb/clilist.c
   branches/SAMBA_3_0_23/source/libsmb/clirap.c
   branches/SAMBA_3_0_23/source/libsmb/libsmbclient.c
   branches/SAMBA_3_0_23/source/torture/torture.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clilist.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clilist.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0/source/libsmb/clilist.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -94,27 +94,13 @@
 			}
 			p += 4; /* fileindex */
 				
-			/* these dates appear to arrive in a
-			   weird way. It seems to be localtime
-			   plus the serverzone given in the
-			   initial connect. This is GMT when
-			   DST is not in effect and one hour
-			   from GMT otherwise. Can this really
-			   be right??
-			   
-			   I suppose this could be called
-			   kludge-GMT. Is is the GMT you get
-			   by using the current DST setting on
-			   a different localtime. It will be
-			   cheap to calculate, I suppose, as
-			   no DST tables will be needed */
-			
-			finfo->ctime = interpret_long_date(p);
+			/* Offset zero is "create time", not "change time". */
 			p += 8;
 			finfo->atime = interpret_long_date(p);
 			p += 8;
 			finfo->mtime = interpret_long_date(p);
 			p += 8;
+			finfo->ctime = interpret_long_date(p);
 			p += 8;
 			finfo->size = IVAL2_TO_SMB_BIG_UINT(p,0);
 			p += 8;

Modified: branches/SAMBA_3_0/source/libsmb/clirap.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clirap.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0/source/libsmb/clirap.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -553,9 +553,10 @@
 /****************************************************************************
 send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
 ****************************************************************************/
+
 BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
-		    time_t *c_time, time_t *a_time, time_t *m_time, 
-		    time_t *w_time, SMB_OFF_T *size, uint16 *mode,
+		    time_t *create_time, time_t *access_time, time_t *write_time, 
+		    time_t *change_time, SMB_OFF_T *size, uint16 *mode,
 		    SMB_INO_T *ino)
 {
 	unsigned int data_len = 0;
@@ -593,17 +594,17 @@
 		return False;
 	}
         
-	if (c_time) {
-                *c_time = interpret_long_date(rdata+0);
+	if (create_time) {
+                *create_time = interpret_long_date(rdata+0);
 	}
-	if (a_time) {
-		*a_time = interpret_long_date(rdata+8);
+	if (access_time) {
+		*access_time = interpret_long_date(rdata+8);
 	}
-	if (w_time) {
-		*w_time = interpret_long_date(rdata+16);
+	if (write_time) {
+		*write_time = interpret_long_date(rdata+16);
 	}
-	if (m_time) {
-		*m_time = interpret_long_date(rdata+24);
+	if (change_time) {
+		*change_time = interpret_long_date(rdata+24);
 	}
 	if (mode) {
 		*mode = SVAL(rdata, 32);
@@ -669,8 +670,8 @@
 ****************************************************************************/
 BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
 		   uint16 *mode, SMB_OFF_T *size,
-		   time_t *c_time, time_t *a_time, time_t *m_time, 
-		   time_t *w_time, SMB_INO_T *ino)
+		   time_t *create_time, time_t *access_time, time_t *write_time, 
+		   time_t *change_time, SMB_INO_T *ino)
 {
 	unsigned int data_len = 0;
 	unsigned int param_len = 0;
@@ -708,17 +709,17 @@
 		return False;
 	}
 
-	if (c_time) {
-		*c_time = interpret_long_date(rdata+0) - cli->serverzone;
+	if (create_time) {
+		*create_time = interpret_long_date(rdata+0);
 	}
-	if (a_time) {
-		*a_time = interpret_long_date(rdata+8) - cli->serverzone;
+	if (access_time) {
+		*access_time = interpret_long_date(rdata+8);
 	}
-	if (m_time) {
-		*m_time = interpret_long_date(rdata+16) - cli->serverzone;
+	if (write_time) {
+		*write_time = interpret_long_date(rdata+16);
 	}
-	if (w_time) {
-		*w_time = interpret_long_date(rdata+24) - cli->serverzone;
+	if (change_time) {
+		*change_time = interpret_long_date(rdata+24);
 	}
 	if (mode) {
 		*mode = SVAL(rdata, 32);
@@ -793,9 +794,9 @@
 		return False;
 	}
 
-	sbuf->st_atime = interpret_long_date( rdata+8 );
-	sbuf->st_mtime = interpret_long_date( rdata+16 );
-	sbuf->st_ctime = interpret_long_date( rdata+24 );
+	sbuf->st_atime = interpret_long_date( rdata+8 ); /* Access time. */
+	sbuf->st_mtime = interpret_long_date( rdata+16 ); /* Write time. */
+	sbuf->st_ctime = interpret_long_date( rdata+24 ); /* Change time. */
 	
 	*attributes = IVAL( rdata, 32 );
 	

Modified: branches/SAMBA_3_0/source/libsmb/libsmbclient.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/libsmbclient.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0/source/libsmb/libsmbclient.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -1514,7 +1514,7 @@
   
 	if (!srv->no_pathinfo2 &&
             cli_qpathinfo2(targetcli, targetpath,
-                           c_time, a_time, m_time, NULL, size, mode, ino)) {
+                           NULL, a_time, m_time, c_time, size, mode, ino)) {
             return True;
         }
 
@@ -2182,7 +2182,7 @@
 	/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
 
 	if (!cli_qfileinfo(targetcli, file->cli_fd, &mode, &size,
-                           &c_time, &a_time, &m_time, NULL, &ino)) {
+                           NULL, &a_time, &m_time, &c_time, &ino)) {
 	    if (!cli_getattrE(targetcli, file->cli_fd, &mode, &size,
                               &c_time, &a_time, &m_time)) {
 

Modified: branches/SAMBA_3_0/source/torture/torture.c
===================================================================
--- branches/SAMBA_3_0/source/torture/torture.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0/source/torture/torture.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -2539,8 +2539,8 @@
 	fnum = cli_open(cli, fname, 
 			O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
 	cli_close(cli, fnum);
-	if (!cli_qpathinfo2(cli, fname, &c_time, &a_time, &m_time, 
-			    &w_time, &size, NULL, NULL)) {
+	if (!cli_qpathinfo2(cli, fname, &c_time, &a_time, &w_time, 
+			    &m_time, &size, NULL, NULL)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli));
 		correct = False;
 	} else {
@@ -2561,8 +2561,8 @@
 		correct = False;
 	}
 	sleep(3);
-	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &m_time, 
-			    &w_time, &size, NULL, NULL)) {
+	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &w_time, 
+			    &m_time, &size, NULL, NULL)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli));
 		correct = False;
 	}
@@ -2571,8 +2571,8 @@
 			O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
 	cli_write(cli, fnum,  0, (char *)&fnum, 0, sizeof(fnum));
 	cli_close(cli, fnum);
-	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &m_time2, 
-			    &w_time, &size, NULL, NULL)) {
+	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &w_time, 
+			    &m_time2, &size, NULL, NULL)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli));
 		correct = False;
 	} else {

Modified: branches/SAMBA_3_0_23/source/libsmb/clilist.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/clilist.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0_23/source/libsmb/clilist.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -94,27 +94,13 @@
 			}
 			p += 4; /* fileindex */
 				
-			/* these dates appear to arrive in a
-			   weird way. It seems to be localtime
-			   plus the serverzone given in the
-			   initial connect. This is GMT when
-			   DST is not in effect and one hour
-			   from GMT otherwise. Can this really
-			   be right??
-			   
-			   I suppose this could be called
-			   kludge-GMT. Is is the GMT you get
-			   by using the current DST setting on
-			   a different localtime. It will be
-			   cheap to calculate, I suppose, as
-			   no DST tables will be needed */
-			
-			finfo->ctime = interpret_long_date(p);
+			/* Offset zero is "create time", not "change time". */
 			p += 8;
 			finfo->atime = interpret_long_date(p);
 			p += 8;
 			finfo->mtime = interpret_long_date(p);
 			p += 8;
+			finfo->ctime = interpret_long_date(p);
 			p += 8;
 			finfo->size = IVAL2_TO_SMB_BIG_UINT(p,0);
 			p += 8;

Modified: branches/SAMBA_3_0_23/source/libsmb/clirap.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/clirap.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0_23/source/libsmb/clirap.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -553,9 +553,10 @@
 /****************************************************************************
 send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
 ****************************************************************************/
+
 BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, 
-		    time_t *c_time, time_t *a_time, time_t *m_time, 
-		    time_t *w_time, SMB_OFF_T *size, uint16 *mode,
+		    time_t *create_time, time_t *access_time, time_t *write_time, 
+		    time_t *change_time, SMB_OFF_T *size, uint16 *mode,
 		    SMB_INO_T *ino)
 {
 	unsigned int data_len = 0;
@@ -593,17 +594,17 @@
 		return False;
 	}
         
-	if (c_time) {
-                *c_time = interpret_long_date(rdata+0);
+	if (create_time) {
+                *create_time = interpret_long_date(rdata+0);
 	}
-	if (a_time) {
-		*a_time = interpret_long_date(rdata+8);
+	if (access_time) {
+		*access_time = interpret_long_date(rdata+8);
 	}
-	if (w_time) {
-		*w_time = interpret_long_date(rdata+16);
+	if (write_time) {
+		*write_time = interpret_long_date(rdata+16);
 	}
-	if (m_time) {
-		*m_time = interpret_long_date(rdata+24);
+	if (change_time) {
+		*change_time = interpret_long_date(rdata+24);
 	}
 	if (mode) {
 		*mode = SVAL(rdata, 32);
@@ -669,8 +670,8 @@
 ****************************************************************************/
 BOOL cli_qfileinfo(struct cli_state *cli, int fnum, 
 		   uint16 *mode, SMB_OFF_T *size,
-		   time_t *c_time, time_t *a_time, time_t *m_time, 
-		   time_t *w_time, SMB_INO_T *ino)
+		   time_t *create_time, time_t *access_time, time_t *write_time, 
+		   time_t *change_time, SMB_INO_T *ino)
 {
 	unsigned int data_len = 0;
 	unsigned int param_len = 0;
@@ -708,17 +709,17 @@
 		return False;
 	}
 
-	if (c_time) {
-		*c_time = interpret_long_date(rdata+0) - cli->serverzone;
+	if (create_time) {
+		*create_time = interpret_long_date(rdata+0);
 	}
-	if (a_time) {
-		*a_time = interpret_long_date(rdata+8) - cli->serverzone;
+	if (access_time) {
+		*access_time = interpret_long_date(rdata+8);
 	}
-	if (m_time) {
-		*m_time = interpret_long_date(rdata+16) - cli->serverzone;
+	if (write_time) {
+		*write_time = interpret_long_date(rdata+16);
 	}
-	if (w_time) {
-		*w_time = interpret_long_date(rdata+24) - cli->serverzone;
+	if (change_time) {
+		*change_time = interpret_long_date(rdata+24);
 	}
 	if (mode) {
 		*mode = SVAL(rdata, 32);
@@ -793,9 +794,9 @@
 		return False;
 	}
 
-	sbuf->st_atime = interpret_long_date( rdata+8 );
-	sbuf->st_mtime = interpret_long_date( rdata+16 );
-	sbuf->st_ctime = interpret_long_date( rdata+24 );
+	sbuf->st_atime = interpret_long_date( rdata+8 ); /* Access time. */
+	sbuf->st_mtime = interpret_long_date( rdata+16 ); /* Write time. */
+	sbuf->st_ctime = interpret_long_date( rdata+24 ); /* Change time. */
 	
 	*attributes = IVAL( rdata, 32 );
 	

Modified: branches/SAMBA_3_0_23/source/libsmb/libsmbclient.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/libsmbclient.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0_23/source/libsmb/libsmbclient.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -1516,7 +1516,7 @@
   
 	if (!srv->no_pathinfo2 &&
             cli_qpathinfo2(targetcli, targetpath,
-                           c_time, a_time, m_time, NULL, size, mode, ino)) {
+                           NULL, a_time, m_time, c_time, size, mode, ino)) {
             return True;
         }
 
@@ -2184,7 +2184,7 @@
 	/*d_printf(">>>fstat: resolved path as %s\n", targetpath);*/
 
 	if (!cli_qfileinfo(targetcli, file->cli_fd, &mode, &size,
-                           &c_time, &a_time, &m_time, NULL, &ino)) {
+                           NULL, &a_time, &m_time, &c_time, &ino)) {
 	    if (!cli_getattrE(targetcli, file->cli_fd, &mode, &size,
                               &c_time, &a_time, &m_time)) {
 

Modified: branches/SAMBA_3_0_23/source/torture/torture.c
===================================================================
--- branches/SAMBA_3_0_23/source/torture/torture.c	2006-08-23 21:04:47 UTC (rev 17760)
+++ branches/SAMBA_3_0_23/source/torture/torture.c	2006-08-23 22:33:50 UTC (rev 17761)
@@ -2433,8 +2433,8 @@
 	fnum = cli_open(cli, fname, 
 			O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
 	cli_close(cli, fnum);
-	if (!cli_qpathinfo2(cli, fname, &c_time, &a_time, &m_time, 
-			    &w_time, &size, NULL, NULL)) {
+	if (!cli_qpathinfo2(cli, fname, &c_time, &a_time, &w_time, 
+			    &m_time, &size, NULL, NULL)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli));
 		correct = False;
 	} else {
@@ -2455,8 +2455,8 @@
 		correct = False;
 	}
 	sleep(3);
-	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &m_time, 
-			    &w_time, &size, NULL, NULL)) {
+	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &w_time, 
+			    &m_time, &size, NULL, NULL)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli));
 		correct = False;
 	}
@@ -2465,8 +2465,8 @@
 			O_RDWR | O_CREAT | O_TRUNC, DENY_NONE);
 	cli_write(cli, fnum,  0, (char *)&fnum, 0, sizeof(fnum));
 	cli_close(cli, fnum);
-	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &m_time2, 
-			    &w_time, &size, NULL, NULL)) {
+	if (!cli_qpathinfo2(cli, "\\trans2\\", &c_time, &a_time, &w_time, 
+			    &m_time2, &size, NULL, NULL)) {
 		printf("ERROR: qpathinfo2 failed (%s)\n", cli_errstr(cli));
 		correct = False;
 	} else {



More information about the samba-cvs mailing list