void init(void) { app_init(); doi_init(); exchange_init(); group_init(); ipsec_init(); isakmp_doi_init(); libcrypto_init(); timer_init(); /* The following group are depending on timer_init having run. */ conf_init(); connection_init(); /* This depends on conf_init, thus check as soon as possible. */ log_reinit(); /* policy_init depends on conf_init having run. */ policy_init(); /* Depends on conf_init and policy_init having run */ cert_init(); crl_init(); sa_init(); transport_init(); virtual_init(); udp_init(); nat_t_init(); udp_encap_init(); vendor_init(); }
/* Reinitialize, either after a SIGHUP reception or by FIFO UI cmd. */ void reinit(void) { log_print("isakmpd: reinitializing daemon"); /* * XXX Remove all(/some?) pending exchange timers? - they may not be * possible to complete after we've re-read the config file. * User-initiated SIGHUP's maybe "authorizes" a wait until * next connection-check. * XXX This means we discard exchange->last_msg, is this really ok? */ #if defined(INSECURE_RAND) /* Reinitialize PRNG if we are in deterministic mode. */ if (regrand) srandom(seed); #endif /* Reread config file. */ conf_reinit(); log_reinit(); /* Reread the policies. */ policy_init(); /* Reinitialize certificates */ cert_init(); crl_init(); /* Reinitialize our connection list. */ connection_reinit(); /* * Rescan interfaces (call reinit() in all transports). */ transport_reinit(); /* * XXX "These" (non-existent) reinitializations should not be done. * cookie_reinit (); * ui_reinit (); */ sa_reinit(); }
void lprintf(int level, const char * format, ...) { va_list vptr; if (!logpriv) log_reinit(); if (logpriv->level < level) return; va_start(vptr, format); if (logpriv->daemon) { vsyslog(level, format, vptr); } else { vfprintf(stderr, format, vptr); fprintf(stderr, "\r\n"); } va_end(vptr); return; }
void lperror(int level, const char * format, ...) { static char logmsg[LOG_MSG_LENGTH]; va_list vptr; if (!logpriv) log_reinit(); if (logpriv->level < level) return; va_start(vptr, format); vsnprintf(logmsg, LOG_MSG_LENGTH, format, vptr); va_end(vptr); if (logpriv->daemon) syslog(level, "%s: %s", logmsg, strerror(errno)); else fprintf(stderr, "%s: %s\n", logmsg, strerror(errno)); return; }
static void _jobcomp_child (char * script, struct jobcomp_info *job) { char * args[] = {script, NULL}; const char *tmpdir; char **env; #ifdef _PATH_TMP tmpdir = _PATH_TMP; #else tmpdir = "/tmp"; #endif /* * Reinitialize log so we can log any errors for * diagnosis */ log_reinit (); if (_redirect_stdio () < 0) exit (1); if (chdir (tmpdir) != 0) { error ("jobcomp/script: chdir (%s): %m", tmpdir); exit(1); } if (!(env = _create_environment (job))) { error ("jobcomp/script: Failed to create env!"); exit (1); } execve(script, args, env); /* * Failure of execve implies error */ error ("jobcomp/script: execve(%s): %m", script); exit (1); }