summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/client/client.c2
-rw-r--r--source3/client/smbmount.c2
-rw-r--r--source3/client/smbspool.c2
-rw-r--r--source3/lib/time.c38
-rw-r--r--source3/nmbd/nmbd.c2
-rw-r--r--source3/nsswitch/wbinfo.c2
-rw-r--r--source3/nsswitch/winbindd.c2
-rw-r--r--source3/nsswitch/wins.c1
-rw-r--r--source3/rpcclient/rpcclient.c2
-rw-r--r--source3/rpcclient/samsync.c2
-rw-r--r--source3/smbd/server.c2
-rw-r--r--source3/torture/locktest.c2
-rw-r--r--source3/torture/locktest2.c2
-rw-r--r--source3/torture/masktest.c2
-rw-r--r--source3/torture/msgtest.c1
-rw-r--r--source3/torture/rpctorture.c2
-rw-r--r--source3/utils/nmblookup.c2
-rw-r--r--source3/utils/pdbedit.c2
-rw-r--r--source3/utils/smbcacls.c2
-rw-r--r--source3/utils/smbcontrol.c1
-rw-r--r--source3/utils/smbfilter.c2
-rw-r--r--source3/utils/smbgroupedit.c2
-rw-r--r--source3/utils/smbpasswd.c2
-rw-r--r--source3/utils/smbtree.c2
-rw-r--r--source3/utils/status.c1
-rw-r--r--source3/utils/testparm.c2
-rw-r--r--source3/utils/testprns.c2
27 files changed, 26 insertions, 60 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index b4b48da285..7baab4b204 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2450,8 +2450,6 @@ static int do_message_op(void)
}
}
- TimeInit();
-
in_client = True; /* Make sure that we tell lp_load we are */
old_debug = DEBUGLEVEL;
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index f8fc0558ce..f330dcff8d 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -827,8 +827,6 @@ static void parse_mount_smb(int argc, char **argv)
else
setenv("CLI_FORCE_ASCII", "true", 1);
- TimeInit();
-
in_client = True; /* Make sure that we tell lp_load we are */
if (getenv("USER")) {
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 03d4a34060..3d049b588e 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -187,8 +187,6 @@ static int smb_print(struct cli_state *, char *, FILE *);
setup_logging("smbspool", True);
- TimeInit();
-
in_client = True; /* Make sure that we tell lp_load we are */
if (!lp_load(dyn_CONFIGFILE, True, False, False))
diff --git a/source3/lib/time.c b/source3/lib/time.c
index cf088e8ee4..b302726a95 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -27,7 +27,6 @@
*/
-int serverzone=0;
int extra_time_offset = 0;
#ifndef CHAR_BIT
@@ -105,21 +104,36 @@ static int TimeZone(time_t t)
}
+static BOOL done_serverzone_init;
-/*******************************************************************
-init the time differences
-********************************************************************/
-void TimeInit(void)
+/* Return the smb serverzone value */
+
+static int get_serverzone(void)
{
- serverzone = TimeZone(time(NULL));
+ static int serverzone;
- if ((serverzone % 60) != 0) {
- DEBUG(1,("WARNING: Your timezone is not a multiple of 1 minute.\n"));
- }
+ if (!done_serverzone_init) {
+ serverzone = TimeZone(time(NULL));
+
+ if ((serverzone % 60) != 0) {
+ DEBUG(1,("WARNING: Your timezone is not a multiple of 1 minute.\n"));
+ }
- DEBUG(4,("Serverzone is %d\n",serverzone));
+ DEBUG(4,("Serverzone is %d\n",serverzone));
+
+ done_serverzone_init = True;
+ }
+
+ return serverzone;
}
+/* Re-read the smb serverzone value */
+
+void TimeInit(void)
+{
+ done_serverzone_init = False;
+ get_serverzone();
+}
/*******************************************************************
return the same value as TimeZone, but it should be more efficient.
@@ -284,7 +298,7 @@ time_t nt_time_to_unix(NTTIME *nt)
ret = (time_t)(d+0.5);
/* this takes us from kludge-GMT to real GMT */
- ret -= serverzone;
+ ret -= get_serverzone();
ret += LocTimeDiff(ret);
return(ret);
@@ -331,7 +345,7 @@ void unix_to_nt_time(NTTIME *nt, time_t t)
}
/* this converts GMT to kludge-GMT */
- t -= LocTimeDiff(t) - serverzone;
+ t -= LocTimeDiff(t) - get_serverzone();
d = (double)(t);
d += TIME_FIXUP_CONSTANT;
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 595a65a0cd..314eead565 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -673,8 +673,6 @@ static void usage(char *pname)
sys_srandom(time(NULL) ^ sys_getpid());
- TimeInit();
-
slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", dyn_LOGFILEBASE);
setup_logging( argv[0], False );
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index 8dd2e44caa..11185624d1 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -459,8 +459,6 @@ int main(int argc, char **argv)
}
}
- TimeInit();
-
if (!lp_load(dyn_CONFIGFILE, True, False, False)) {
DEBUG(0, ("error opening config file\n"));
exit(1);
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index 9c8b022f53..ad3d4e7ac3 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -735,8 +735,6 @@ int main(int argc, char **argv)
*p = 0;
}
- TimeInit();
-
if (!reload_services_file(False)) {
DEBUG(0, ("error opening config file\n"));
exit(1);
diff --git a/source3/nsswitch/wins.c b/source3/nsswitch/wins.c
index b66ef88e04..e23cf9ea03 100644
--- a/source3/nsswitch/wins.c
+++ b/source3/nsswitch/wins.c
@@ -73,7 +73,6 @@ struct in_addr *lookup_backend(const char *name, int *count)
if (!initialised) {
initialised = 1;
DEBUGLEVEL = 0;
- TimeInit();
setup_logging("nss_wins",True);
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 773548a7db..c7d1604a0b 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -716,8 +716,6 @@ static void usage(void)
load_interfaces();
- TimeInit();
-
get_myname((*global_myname)?NULL:global_myname);
strupper(global_myname);
diff --git a/source3/rpcclient/samsync.c b/source3/rpcclient/samsync.c
index 9cd5c481b5..6d75722f35 100644
--- a/source3/rpcclient/samsync.c
+++ b/source3/rpcclient/samsync.c
@@ -309,8 +309,6 @@ static struct cli_state *init_connection(struct cli_state *cli,
load_interfaces();
- TimeInit();
-
/* Check arguments make sense */
if (do_sam_sync && do_sam_repl) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index c48cb37615..b08c8e8bda 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -667,8 +667,6 @@ static void usage(char *pname)
append_log = True;
- TimeInit();
-
if(!specified_logfile) {
slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd",
dyn_LOGFILEBASE);
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index 26c0dcbd29..ccff2b2624 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -568,8 +568,6 @@ static void usage(void)
argc -= NSERVERS;
argv += NSERVERS;
- TimeInit();
-
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c
index 5be9e9c02c..db5e17921c 100644
--- a/source3/torture/locktest2.c
+++ b/source3/torture/locktest2.c
@@ -558,8 +558,6 @@ static void usage(void)
argc -= 4;
argv += 4;
- TimeInit();
-
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index e39caf46bd..d57b26bee4 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -441,8 +441,6 @@ static void usage(void)
argc -= 1;
argv += 1;
- TimeInit();
-
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c
index 31bc1ee6e8..9f3c083b80 100644
--- a/source3/torture/msgtest.c
+++ b/source3/torture/msgtest.c
@@ -42,7 +42,6 @@ void pong_message(int msg_type, pid_t src, void *buf, size_t len)
int i, n;
char buf[12];
- TimeInit();
setup_logging(argv[0],True);
lp_load(dyn_CONFIGFILE,False,False,False);
diff --git a/source3/torture/rpctorture.c b/source3/torture/rpctorture.c
index 27693f5575..e767c715e9 100644
--- a/source3/torture/rpctorture.c
+++ b/source3/torture/rpctorture.c
@@ -292,8 +292,6 @@ enum client_action
setup_logging(pname, True);
- TimeInit();
-
myumask = umask(0);
umask(myumask);
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 44f0558bf6..cad9bf85c3 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -199,8 +199,6 @@ int main(int argc,char *argv[])
DEBUGLEVEL = 1;
*lookup = 0;
- TimeInit();
-
setup_logging(argv[0],True);
while ((opt = getopt(argc, argv, "d:B:U:i:s:SMrhART")) != EOF)
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 749e33958b..782848d626 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -552,8 +552,6 @@ int main (int argc, char **argv)
char *profile_path = NULL;
char *smbpasswd = NULL;
- TimeInit();
-
setup_logging("tdbedit", True);
if (argc < 2) {
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index e1d206e0ee..ae03e193e1 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -829,8 +829,6 @@ You can string acls together with spaces, commas or newlines\n\
argc -= 2;
argv += 2;
- TimeInit();
-
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 8295280974..ce04d7a215 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -379,7 +379,6 @@ static BOOL do_command(char *dest, char *msg_name, int iparams, char **params)
extern int optind;
BOOL interactive = False;
- TimeInit();
setup_logging(argv[0],True);
if (argc < 2) usage(True);
diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c
index 1a5aedc485..c7df7458d2 100644
--- a/source3/utils/smbfilter.c
+++ b/source3/utils/smbfilter.c
@@ -224,8 +224,6 @@ int main(int argc, char *argv[])
char *desthost;
pstring configfile;
- TimeInit();
-
setup_logging(argv[0],True);
pstrcpy(configfile,dyn_CONFIGFILE);
diff --git a/source3/utils/smbgroupedit.c b/source3/utils/smbgroupedit.c
index 3e92834d17..8d99e8e600 100644
--- a/source3/utils/smbgroupedit.c
+++ b/source3/utils/smbgroupedit.c
@@ -217,8 +217,6 @@ int main (int argc, char **argv)
enum SID_NAME_USE sid_type;
- TimeInit();
-
setup_logging("groupedit", True);
if (argc < 2) {
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index b60f919e79..8d50b94a0a 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -900,8 +900,6 @@ int main(int argc, char **argv)
set_auth_parameters(argc, argv);
#endif /* HAVE_SET_AUTH_PARAMETERS */
- TimeInit();
-
setup_logging("smbpasswd", True);
if(!initialize_password_db(True)) {
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 9ce8120bba..13df0451f0 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -338,8 +338,6 @@ static BOOL print_tree(struct user_auth_info *user_info)
setup_logging(argv[0],True);
- TimeInit();
-
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 5febdd98d8..e17a6589ef 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -548,7 +548,6 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
int profile_only = 0, new_debuglevel = -1;
TDB_CONTEXT *tdb;
- TimeInit();
setup_logging(argv[0],True);
DEBUGLEVEL = 0;
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 53adbaae91..c1b8b10a84 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -188,8 +188,6 @@ int main(int argc, char *argv[])
*term_code = 0;
- TimeInit();
-
setup_logging(argv[0],True);
while ((opt = getopt(argc, argv,"shL:t:")) != EOF) {
diff --git a/source3/utils/testprns.c b/source3/utils/testprns.c
index cf26e8aa40..c3aa25ada8 100644
--- a/source3/utils/testprns.c
+++ b/source3/utils/testprns.c
@@ -38,8 +38,6 @@ int main(int argc, char *argv[])
{
char *pszTemp;
- TimeInit();
-
setup_logging(argv[0],True);
if (argc < 2 || argc > 3)