summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-23 00:52:29 +0000
committerTim Potter <tpot@samba.org>2001-11-23 00:52:29 +0000
commit79b34d1b11e685d068b9c0ac9a0ec06eaa263d82 (patch)
tree7333a5c9d1ce43319880185d936a373b0fd8caa2 /source3
parent5788899a480c3b4c79a1970dbd1634cc3fed4de6 (diff)
downloadsamba-79b34d1b11e685d068b9c0ac9a0ec06eaa263d82.tar.gz
samba-79b34d1b11e685d068b9c0ac9a0ec06eaa263d82.tar.xz
samba-79b34d1b11e685d068b9c0ac9a0ec06eaa263d82.zip
Removed TimeInit() call from every client program (except for one place
in smbd/process.c where the timezone is reinitialised. Was replaced with check for a static is_initialised boolean. (This used to be commit 8fc772c9e5770cd3a8857670214dcff033ebae32)
Diffstat (limited to 'source3')
-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 b4b48da285f..7baab4b2043 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 f8fc0558ceb..f330dcff8d3 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 03d4a34060e..3d049b588e1 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 cf088e8ee43..b302726a959 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 595a65a0cd2..314eead5650 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 8dd2e44caa9..11185624d18 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 9c8b022f531..ad3d4e7ac31 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 b66ef88e04e..e23cf9ea030 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 773548a7db3..c7d1604a0ba 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 9cd5c481b5f..6d75722f35b 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 c48cb376154..b08c8e8bda2 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 26c0dcbd29e..ccff2b2624a 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 5be9e9c02c4..db5e17921c6 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 e39caf46bd5..d57b26bee4d 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 31bc1ee6e8d..9f3c083b809 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 27693f55755..e767c715e99 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 44f0558bf6c..cad9bf85c35 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 749e33958b3..782848d6268 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 e1d206e0ee3..ae03e193e18 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 82952809742..ce04d7a2158 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 1a5aedc4850..c7df7458d23 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 3e92834d17f..8d99e8e600d 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 b60f919e790..8d50b94a0a1 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 9ce8120bbad..13df0451f0f 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 5febdd98d86..e17a6589efe 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 53adbaae91b..c1b8b10a84a 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 cf26e8aa40c..c3aa25ada86 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)