X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Ftincd.c;h=0f518372707c0d51087a0b92148cbc464592a718;hp=c02ce5cfdefa775b059f3180517e5d88fada8b0f;hb=04d33be4bd102de67bb6dba5c449e12fea0db4d2;hpb=462ab530e546f5732dfd51134751da6f6910d679 diff --git a/src/tincd.c b/src/tincd.c index c02ce5cf..0f518372 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: tincd.c,v 1.12 2002/04/09 15:26:01 zarq Exp $ + $Id: tincd.c,v 1.15 2002/04/28 12:46:26 zarq Exp $ */ #include "config.h" @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -38,10 +37,16 @@ # include #endif +#ifdef USE_OPENSSL #include #include #include #include +#endif + +#ifdef USE_GCRYPT +#include +#endif #include #include @@ -52,6 +57,7 @@ #include "process.h" #include "protocol.h" #include "subnet.h" +#include "logging.h" #include "system.h" @@ -231,6 +237,7 @@ void indicator(int a, int b, void *p) } } +#ifdef USE_OPENSSL /* Generate a public/private RSA keypair, and ask for a file to store them in. @@ -283,6 +290,7 @@ int keygen(int bits) return 0; } +#endif /* Set all files and paths according to netname @@ -296,7 +304,7 @@ void make_names(void) if(!confbase) asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname); else - syslog(LOG_INFO, _("Both netname and configuration directory given, using the latter...")); + log(0, TLOG_INFO, _("Both netname and configuration directory given, using the latter...")); if(!identname) asprintf(&identname, "tinc.%s", netname); } @@ -338,11 +346,7 @@ main(int argc, char **argv, char **envp) if(show_help) usage(0); -#ifdef HAVE_SOLARIS - openlog("tinc", LOG_CONS, LOG_DAEMON); /* Catch all syslog() calls issued before detaching */ -#else - openlog("tinc", LOG_PERROR, LOG_DAEMON); /* Catch all syslog() calls issued before detaching */ -#endif + log_add_hook(log_default); g_argv = argv; @@ -351,6 +355,7 @@ main(int argc, char **argv, char **envp) /* Slllluuuuuuurrrrp! */ cp +#ifdef USE_OPENSSL RAND_load_file("/dev/urandom", 1024); #ifdef HAVE_SSLEAY_ADD_ALL_ALGORITHMS @@ -365,6 +370,7 @@ cp read_server_config(); exit(keygen(generate_keys)); } +#endif if(kill_tincd) exit(kill_other(kill_tincd)); @@ -383,17 +389,17 @@ cp cleanup_and_exit(1); } - syslog(LOG_ERR, _("Unrecoverable error")); + log(0, TLOG_ERROR, _("Unrecoverable error")); cp_trace(); if(do_detach) { - syslog(LOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout); + log(0, TLOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout); sleep(maxtimeout); } else { - syslog(LOG_ERR, _("Not restarting.")); + log(0, TLOG_ERROR, _("Not restarting.")); exit(1); } }