projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Added balanced tree management stuff as well. (It is not finished yet.)
[tinc]
/
src
/
tincd.c
diff --git
a/src/tincd.c
b/src/tincd.c
index
a99b81b
..
9c337f8
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.2
3 2000/10/30 10:19:06 guus
Exp $
+ $Id: tincd.c,v 1.10.4.2
8 2000/11/15 01:06:13 zarq
Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-31,15
+31,33
@@
#include <syslog.h>
#include <unistd.h>
#include <signal.h>
#include <syslog.h>
#include <unistd.h>
#include <signal.h>
-#include <openssl/rand.h>
-#include <openssl/rsa.h>
-#include <openssl/err.h>
#include <string.h>
#include <string.h>
+#include <termios.h>
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
+#ifdef HAVE_OPENSSL_RAND_H
+# include <openssl/rand.h>
+#else
+# include <rand.h>
+#endif
+
+#ifdef HAVE_OPENSSL_RSA_H
+# include <openssl/rsa.h>
+#else
+# include <rsa.h>
+#endif
+
+#ifdef HAVE_OPENSSL_ERR_H
+# include <openssl/err.h>
+#else
+# include <err.h>
+#endif
+
+
+
#include <pidfile.h>
#include <utils.h>
#include <xalloc.h>
#include <pidfile.h>
#include <utils.h>
#include <xalloc.h>
@@
-74,6
+92,8
@@
char *identname; /* program name for syslog */
char *pidfilename; /* pid file location */
static pid_t ppid; /* pid of non-detached part */
char **g_argv; /* a copy of the cmdline arguments */
char *pidfilename; /* pid file location */
static pid_t ppid; /* pid of non-detached part */
char **g_argv; /* a copy of the cmdline arguments */
+char **environment; /* A pointer to the environment on
+ startup */
void cleanup_and_exit(int);
int detach(void);
void cleanup_and_exit(int);
int detach(void);
@@
-85,6
+105,7
@@
int write_pidfile(void);
static struct option const long_options[] =
{
static struct option const long_options[] =
{
+ { "config", required_argument, NULL, 'c' },
{ "kill", no_argument, NULL, 'k' },
{ "net", required_argument, NULL, 'n' },
{ "help", no_argument, &show_help, 1 },
{ "kill", no_argument, NULL, 'k' },
{ "net", required_argument, NULL, 'n' },
{ "help", no_argument, &show_help, 1 },
@@
-225,7
+246,8
@@
int keygen(int bits)
void memory_full(int size)
{
void memory_full(int size)
{
- syslog(LOG_ERR, _("Memory exhausted (last is %s:%d) (couldn't allocate %d bytes), exiting."), cp_file, cp_line, size);
+ syslog(LOG_ERR, _("Memory exhausted (couldn't allocate %d bytes), exiting."), size);
+ cp_trace();
exit(1);
}
exit(1);
}
@@
-366,6
+388,8
@@
void make_names(void)
asprintf(&pidfilename, "/var/run/tinc.%s.pid", netname);
if(!confbase)
asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname);
asprintf(&pidfilename, "/var/run/tinc.%s.pid", netname);
if(!confbase)
asprintf(&confbase, "%s/tinc/%s", CONFDIR, netname);
+ else
+ fprintf(stderr, _("Both netname and configuration directory given, using the latter...\n"));
if(!identname)
asprintf(&identname, "tinc.%s", netname);
}
if(!identname)
asprintf(&identname, "tinc.%s", netname);
}
@@
-393,6
+417,7
@@
main(int argc, char **argv, char **envp)
unknown = _("unknown");
unknown = _("unknown");
+ environment = envp;
parse_options(argc, argv, envp);
if(show_version)
parse_options(argc, argv, envp);
if(show_version)