projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mention in the manual that multiple Address staments are allowed.
[tinc]
/
src
/
net_setup.c
diff --git
a/src/net_setup.c
b/src/net_setup.c
index
35cd3f7
..
6157993
100644
(file)
--- a/
src/net_setup.c
+++ b/
src/net_setup.c
@@
-38,6
+38,7
@@
#include "protocol.h"
#include "route.h"
#include "rsa.h"
#include "protocol.h"
#include "route.h"
#include "rsa.h"
+#include "script.h"
#include "subnet.h"
#include "utils.h"
#include "xalloc.h"
#include "subnet.h"
#include "utils.h"
#include "xalloc.h"
@@
-410,17
+411,18
@@
char *get_name(void) {
if(*name == '$') {
char *envname = getenv(name + 1);
if(*name == '$') {
char *envname = getenv(name + 1);
+ char hostname[32] = "";
if(!envname) {
if(strcmp(name + 1, "HOST")) {
logger(DEBUG_ALWAYS, LOG_ERR, "Invalid Name: environment variable %s does not exist\n", name + 1);
return false;
}
if(!envname) {
if(strcmp(name + 1, "HOST")) {
logger(DEBUG_ALWAYS, LOG_ERR, "Invalid Name: environment variable %s does not exist\n", name + 1);
return false;
}
- char envname[32];
- if(gethostname(envname, 32)) {
+ if(gethostname(hostname, sizeof hostname) || !*hostname) {
logger(DEBUG_ALWAYS, LOG_ERR, "Could not get hostname: %s\n", strerror(errno));
return false;
}
logger(DEBUG_ALWAYS, LOG_ERR, "Could not get hostname: %s\n", strerror(errno));
return false;
}
- envname[31] = 0;
+ hostname[31] = 0;
+ envname = hostname;
}
free(name);
name = xstrdup(envname);
}
free(name);
name = xstrdup(envname);
@@
-631,6
+633,8
@@
bool setup_myself_reloadable(void) {
keylifetime = 3600;
get_config_int(lookup_config(config_tree, "AutoConnect"), &autoconnect);
keylifetime = 3600;
get_config_int(lookup_config(config_tree, "AutoConnect"), &autoconnect);
+ if(autoconnect < 0)
+ autoconnect = 0;
get_config_bool(lookup_config(config_tree, "DisableBuggyPeers"), &disablebuggypeers);
get_config_bool(lookup_config(config_tree, "DisableBuggyPeers"), &disablebuggypeers);
@@
-743,7
+747,9
@@
static bool setup_myself(void) {
if(!get_config_string(lookup_config(config_tree, "Cipher"), &cipher))
cipher = xstrdup("blowfish");
if(!get_config_string(lookup_config(config_tree, "Cipher"), &cipher))
cipher = xstrdup("blowfish");
- if(!(myself->incipher = cipher_open_by_name(cipher))) {
+ if(!strcasecmp(cipher, "none")) {
+ myself->incipher = NULL;
+ } else if(!(myself->incipher = cipher_open_by_name(cipher))) {
logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized cipher type!");
return false;
}
logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized cipher type!");
return false;
}
@@
-765,7
+771,9
@@
static bool setup_myself(void) {
if(!get_config_string(lookup_config(config_tree, "Digest"), &digest))
digest = xstrdup("sha1");
if(!get_config_string(lookup_config(config_tree, "Digest"), &digest))
digest = xstrdup("sha1");
- if(!(myself->indigest = digest_open_by_name(digest, maclength))) {
+ if(!strcasecmp(digest, "none")) {
+ myself->indigest = NULL;
+ } else if(!(myself->indigest = digest_open_by_name(digest, maclength))) {
logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized digest type!");
return false;
}
logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized digest type!");
return false;
}