3.0.21rc1 and net time

Jeremy Allison jra at samba.org
Sun Nov 27 21:51:49 GMT 2005


On Sun, Nov 27, 2005 at 08:24:47AM +0100, Thomas Bork wrote:
> Thomas Bork wrote:
> 
> >there is an error between the showed time and the time which will be set 
> >with 'net time' on the client (client has GMT+01:00):
> >
> >deveis # netdate time.fu-berlin.de
> >Trying 130.133.1.10...
> >time.fu-berlin.de -3604.222 Thu Nov 24 22:57:01.000
> >deveis # date
> >Thu Nov 24 22:57:08 CET 2005
> >
> >C:\Dokumente und Einstellungen\tb>time /T
> >22:57
> >
> >C:\Dokumente und Einstellungen\tb>net time \\deveis
> >Aktuelle Zeit auf \\deveis ist 11/24/2005 10:57 PM.
> >
> >Der Befehl wurde erfolgreich ausgeführt.
> >
> >
> >C:\Dokumente und Einstellungen\tb>net time \\deveis /set /yes
> >Aktuelle Zeit auf \\deveis ist 11/24/2005 10:57 PM.
> >
> >Der Befehl wurde erfolgreich ausgeführt.
> >
> >
> >C:\Dokumente und Einstellungen\tb>time /T
> >23:57
> >
> >23:57 is *not* 22:57.
> >This is new in 3.0.21rc1 and not the case in 3.0.20b.
> 
> Also in 3.0.21pre3-SVN-build-11927.
> Must be revision 11511:
> 
> http://websvn.samba.org/cgi-bin/viewcvs.cgi?rev=11511&view=rev

This is the patch. The problem was the call to get_time_zone()
was overwriting the static buffer being used to return the time
value. Doh !

Thanks,

	Jeremy.
-------------- next part --------------
Index: rpc_server/srv_srvsvc_nt.c
===================================================================
--- rpc_server/srv_srvsvc_nt.c	(revision 11927)
+++ rpc_server/srv_srvsvc_nt.c	(working copy)
@@ -1924,6 +1924,9 @@
 	TIME_OF_DAY_INFO *tod;
 	struct tm *t;
 	time_t unixdate = time(NULL);
+	/* We do this call first as if we do it *after* the gmtime call
+	   it overwrites the pointed-to values. JRA */
+	uint32 zone = get_time_zone(unixdate)/60;
 
 	tod = TALLOC_P(p->mem_ctx, TIME_OF_DAY_INFO);
 	if (!tod)
@@ -1947,7 +1950,7 @@
 	                      t->tm_min,
 	                      t->tm_sec,
 	                      0,
-	                      get_time_zone(unixdate)/60,
+	                      zone,
 	                      10000,
 	                      t->tm_mday,
 	                      t->tm_mon + 1,


More information about the samba-technical mailing list