projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Moving files, first attempt at gcrypt compatibility, more interface
[tinc]
/
src
/
tincd.c
diff --git
a/src/tincd.c
b/src/tincd.c
index
e53f577
..
0f51837
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.1
3 2002/04/13 10:25:38
zarq Exp $
+ $Id: tincd.c,v 1.1
5 2002/04/28 12:46:26
zarq Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-28,7
+28,6
@@
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
-#include <syslog.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
@@
-38,10
+37,16
@@
# include <sys/ioctl.h>
#endif
# include <sys/ioctl.h>
#endif
+#ifdef USE_OPENSSL
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/evp.h>
+#endif
+
+#ifdef USE_GCRYPT
+#include <gcrypt.h>
+#endif
#include <utils.h>
#include <xalloc.h>
#include <utils.h>
#include <xalloc.h>
@@
-52,6
+57,7
@@
#include "process.h"
#include "protocol.h"
#include "subnet.h"
#include "process.h"
#include "protocol.h"
#include "subnet.h"
+#include "logging.h"
#include "system.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.
/*
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;
}
return 0;
}
+#endif
/*
Set all files and paths according to netname
/*
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
if(!confbase)
asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname);
else
-
syslog(
LOG_INFO, _("Both netname and configuration directory given, using the latter..."));
+
log(0, T
LOG_INFO, _("Both netname and configuration directory given, using the latter..."));
if(!identname)
asprintf(&identname, "tinc.%s", netname);
}
if(!identname)
asprintf(&identname, "tinc.%s", netname);
}
@@
-347,6
+355,7
@@
main(int argc, char **argv, char **envp)
/* Slllluuuuuuurrrrp! */
cp
/* Slllluuuuuuurrrrp! */
cp
+#ifdef USE_OPENSSL
RAND_load_file("/dev/urandom", 1024);
#ifdef HAVE_SSLEAY_ADD_ALL_ALGORITHMS
RAND_load_file("/dev/urandom", 1024);
#ifdef HAVE_SSLEAY_ADD_ALL_ALGORITHMS
@@
-361,6
+370,7
@@
cp
read_server_config();
exit(keygen(generate_keys));
}
read_server_config();
exit(keygen(generate_keys));
}
+#endif
if(kill_tincd)
exit(kill_other(kill_tincd));
if(kill_tincd)
exit(kill_other(kill_tincd));
@@
-379,17
+389,17
@@
cp
cleanup_and_exit(1);
}
cleanup_and_exit(1);
}
-
syslog(LOG_ER
R, _("Unrecoverable error"));
+
log(0, TLOG_ERRO
R, _("Unrecoverable error"));
cp_trace();
if(do_detach)
{
cp_trace();
if(do_detach)
{
-
syslog(
LOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout);
+
log(0, T
LOG_NOTICE, _("Restarting in %d seconds!"), maxtimeout);
sleep(maxtimeout);
}
else
{
sleep(maxtimeout);
}
else
{
-
syslog(LOG_ER
R, _("Not restarting."));
+
log(0, TLOG_ERRO
R, _("Not restarting."));
exit(1);
}
}
exit(1);
}
}