projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Finishing touch: encrypt the meta connections
[tinc]
/
src
/
tincd.c
diff --git
a/src/tincd.c
b/src/tincd.c
index
a06f3fe
..
ba17b30
100644
(file)
--- 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.
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.10.4.
15 2000/10/21 11:52:08
guus Exp $
+ $Id: tincd.c,v 1.10.4.
21 2000/10/29 22:55:15
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-33,6
+33,8
@@
#include <signal.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <signal.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
+#include <openssl/err.h>
+#include <string.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
@@
-43,10
+45,10
@@
#include <xalloc.h>
#include "conf.h"
#include <xalloc.h>
#include "conf.h"
-#include "encr.h"
#include "net.h"
#include "netutl.h"
#include "protocol.h"
#include "net.h"
#include "netutl.h"
#include "protocol.h"
+#include "subnet.h"
#include "system.h"
#include "system.h"
@@
-118,8
+120,7
@@
parse_options(int argc, char **argv, char **envp)
{
int r;
int option_index = 0;
{
int r;
int option_index = 0;
- config_t *p;
-
+
while((r = getopt_long(argc, argv, "c:Ddkn:K::", long_options, &option_index)) != EOF)
{
switch(r)
while((r = getopt_long(argc, argv, "c:Ddkn:K::", long_options, &option_index)) != EOF)
{
switch(r)
@@
-204,9
+205,6
@@
int keygen(int bits)
{
RSA *rsa_key;
{
RSA *rsa_key;
- fprintf(stderr, _("Seeding the PRNG: please press some keys or move\nthe mouse if this program seems to have halted...\n"));
- RAND_load_file("/dev/random", 1024); /* OpenSSL PRNG state apparently uses 1024 bytes, but it seems pretty sufficient anyway :) */
-
fprintf(stderr, _("Generating %d bits keys:\n"), bits);
rsa_key = RSA_generate_key(bits, 0xFFFF, indicator, NULL);
if(!rsa_key)
fprintf(stderr, _("Generating %d bits keys:\n"), bits);
rsa_key = RSA_generate_key(bits, 0xFFFF, indicator, NULL);
if(!rsa_key)
@@
-251,7
+249,7
@@
int detach(void)
if(pid) /* parent process */
{
signal(SIGTERM, parent_exit);
if(pid) /* parent process */
{
signal(SIGTERM, parent_exit);
-
//
sleep(600); /* wait 10 minutes */
+
sleep(600); /* wait 10 minutes */
exit(1);
}
}
exit(1);
}
}
@@
-422,6
+420,10
@@
main(int argc, char **argv, char **envp)
make_names();
make_names();
+ /* Slllluuuuuuurrrrp! */
+
+ RAND_load_file("/dev/urandom", 1024);
+
if(generate_keys)
exit(keygen(generate_keys));
if(generate_keys)
exit(keygen(generate_keys));
@@
-436,17
+438,16
@@
main(int argc, char **argv, char **envp)
if(detach())
exit(0);
if(detach())
exit(0);
-/* FIXME: wt* is this suppose to do?
- if(security_init())
- return 1;
-*/
+ if(debug_lvl >= DEBUG_ERROR)
+ ERR_load_crypto_strings();
+
for(;;)
{
if(!setup_network_connections())
{
main_loop();
cleanup_and_exit(1);
for(;;)
{
if(!setup_network_connections())
{
main_loop();
cleanup_and_exit(1);
-
}
+ }
syslog(LOG_ERR, _("Unrecoverable error"));
cp_trace();
syslog(LOG_ERR, _("Unrecoverable error"));
cp_trace();
@@
-458,7
+459,7
@@
main(int argc, char **argv, char **envp)
}
else
{
}
else
{
- syslog(LOG_ERR, _("
Aieee!
Not restarting."));
+ syslog(LOG_ERR, _("Not restarting."));
exit(0);
}
}
exit(0);
}
}
@@
-469,6
+470,7
@@
sigterm_handler(int a)
{
if(debug_lvl > DEBUG_NOTHING)
syslog(LOG_NOTICE, _("Got TERM signal"));
{
if(debug_lvl > DEBUG_NOTHING)
syslog(LOG_NOTICE, _("Got TERM signal"));
+
cleanup_and_exit(0);
}
cleanup_and_exit(0);
}
@@
-504,7
+506,7
@@
sigsegv_handler(int a)
}
else
{
}
else
{
- syslog(LOG_NOTICE, _("
Aieee!
Not restarting."));
+ syslog(LOG_NOTICE, _("Not restarting."));
exit(0);
}
}
exit(0);
}
}
@@
-513,7
+515,7
@@
RETSIGTYPE
sighup_handler(int a)
{
if(debug_lvl > DEBUG_NOTHING)
sighup_handler(int a)
{
if(debug_lvl > DEBUG_NOTHING)
- syslog(LOG_NOTICE, _("Got HUP signal
, rereading configuration and restarting
"));
+ syslog(LOG_NOTICE, _("Got HUP signal"));
sighup = 1;
}
sighup = 1;
}
@@
-534,9
+536,10
@@
sigusr1_handler(int a)
RETSIGTYPE
sigusr2_handler(int a)
{
RETSIGTYPE
sigusr2_handler(int a)
{
- if(debug_lvl > DEBUG_NOTHING)
- syslog(LOG_NOTICE, _("Got USR2 signal, forcing new key generation"));
+ dump_subnet_list();
/* FIXME: reprogram this.
/* FIXME: reprogram this.
+ if(debug_lvl > DEBUG_NOTHING)
+ syslog(LOG_NOTICE, _("Got USR2 signal, forcing new key generation"));
regenerate_keys();
*/
}
regenerate_keys();
*/
}