1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

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 commit is contained in:
Tim Potter -
parent 8f01a8b078
commit 8fc772c9e5
27 changed files with 26 additions and 60 deletions

View File

@ -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;

View File

@ -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")) {

View File

@ -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))

View File

@ -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));
DEBUG(4,("Serverzone is %d\n",serverzone));
if ((serverzone % 60) != 0) {
DEBUG(1,("WARNING: Your timezone is not a multiple of 1 minute.\n"));
}
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;

View File

@ -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 );

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -716,8 +716,6 @@ static void usage(void)
load_interfaces();
TimeInit();
get_myname((*global_myname)?NULL:global_myname);
strupper(global_myname);

View File

@ -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) {

View File

@ -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);

View File

@ -568,8 +568,6 @@ static void usage(void)
argc -= NSERVERS;
argv += NSERVERS;
TimeInit();
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();

View File

@ -558,8 +558,6 @@ static void usage(void)
argc -= 4;
argv += 4;
TimeInit();
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();

View File

@ -441,8 +441,6 @@ static void usage(void)
argc -= 1;
argv += 1;
TimeInit();
lp_load(dyn_CONFIGFILE,True,False,False);
load_interfaces();

View File

@ -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);

View File

@ -292,8 +292,6 @@ enum client_action
setup_logging(pname, True);
TimeInit();
myumask = umask(0);
umask(myumask);

View File

@ -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)

View File

@ -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) {

View File

@ -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();

View File

@ -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);

View File

@ -224,8 +224,6 @@ int main(int argc, char *argv[])
char *desthost;
pstring configfile;
TimeInit();
setup_logging(argv[0],True);
pstrcpy(configfile,dyn_CONFIGFILE);

View File

@ -217,8 +217,6 @@ int main (int argc, char **argv)
enum SID_NAME_USE sid_type;
TimeInit();
setup_logging("groupedit", True);
if (argc < 2) {

View File

@ -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)) {

View File

@ -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();

View File

@ -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;

View File

@ -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) {

View File

@ -38,8 +38,6 @@ int main(int argc, char *argv[])
{
char *pszTemp;
TimeInit();
setup_logging(argv[0],True);
if (argc < 2 || argc > 3)