X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Ftincd.c;h=c732b7c2154f1672ae86e3a077f0131edabec3d3;hp=e53f5776bf95d5da320df4dafbae8fed67ba979a;hb=4c1a4e8a790584e4c7d5c0f2485706f4c01e1911;hpb=cc603e2765f17555ecdc2b74c27ebf96e6691bf6 diff --git a/src/tincd.c b/src/tincd.c index e53f5776..c732b7c2 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.13 2002/04/13 10:25:38 zarq Exp $ + $Id: tincd.c,v 1.16 2002/05/02 11:50:07 zarq Exp $ */ #include "config.h" @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -38,20 +37,28 @@ # include #endif +#ifdef USE_OPENSSL #include #include #include #include +#endif + +#ifdef USE_GCRYPT +#include +#endif #include #include -#include "conf.h" +#include "callbacks.h" +#include "read_conf.h" #include "net.h" #include "netutl.h" #include "process.h" #include "protocol.h" #include "subnet.h" +#include "logging.h" #include "system.h" @@ -231,6 +238,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 +291,7 @@ int keygen(int bits) return 0; } +#endif /* Set all files and paths according to netname @@ -296,7 +305,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); } @@ -347,6 +356,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 @@ -361,6 +371,7 @@ cp read_server_config(); exit(keygen(generate_keys)); } +#endif if(kill_tincd) exit(kill_other(kill_tincd)); @@ -370,6 +381,8 @@ cp cp if(detach()) exit(0); + + init_callbacks(); cp for(;;) { @@ -379,17 +392,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); } }