r11936: Fix bug in returning remote time found by Thomas Bork <tombork@web.de>.
authorJeremy Allison <jra@samba.org>
Sun, 27 Nov 2005 21:51:46 +0000 (21:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:37 +0000 (11:05 -0500)
get_time_zone() was overwriting static buffer returned by
gmtime(). Lars - this is a mandatory fix for the next patch...
Jeremy.
(This used to be commit 68d03a7a74738ce62e7531127aa4533147217e6d)

source3/rpc_server/srv_srvsvc_nt.c

index a7162c929db8e2f1da49b2659ce54f2efba79178..0e7ded39f5721fa535860f8506dfbee953e5164c 100644 (file)
@@ -1924,6 +1924,9 @@ WERROR _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_NET
        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 @@ WERROR _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_NET
                              t->tm_min,
                              t->tm_sec,
                              0,
-                             get_time_zone(unixdate)/60,
+                             zone,
                              10000,
                              t->tm_mday,
                              t->tm_mon + 1,