Fixed 1.0 miss-merges
This commit is contained in:
parent
103543aa2c
commit
ffa1dc73dc
5 changed files with 6 additions and 65 deletions
60
src/conf.c
60
src/conf.c
|
@ -333,66 +333,6 @@ bool read_server_config() {
|
|||
return x;
|
||||
}
|
||||
|
||||
FILE *ask_and_open(const char *filename, const char *what) {
|
||||
FILE *r;
|
||||
char *directory;
|
||||
char line[PATH_MAX];
|
||||
const char *fn;
|
||||
|
||||
/* Check stdin and stdout */
|
||||
if(!isatty(0) || !isatty(1)) {
|
||||
/* Argh, they are running us from a script or something. Write
|
||||
the files to the current directory and let them burn in hell
|
||||
for ever. */
|
||||
fn = filename;
|
||||
} else {
|
||||
/* Ask for a file and/or directory name. */
|
||||
fprintf(stdout, "Please enter a file to save %s to [%s]: ",
|
||||
what, filename);
|
||||
fflush(stdout);
|
||||
|
||||
fn = readline(stdin, line, sizeof line);
|
||||
|
||||
if(!fn) {
|
||||
fprintf(stderr, "Error while reading stdin: %s\n",
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!strlen(fn))
|
||||
/* User just pressed enter. */
|
||||
fn = filename;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MINGW
|
||||
if(fn[0] != '\\' && fn[0] != '/' && !strchr(fn, ':')) {
|
||||
#else
|
||||
if(fn[0] != '/') {
|
||||
#endif
|
||||
/* The directory is a relative path or a filename. */
|
||||
char *p;
|
||||
|
||||
directory = get_current_dir_name();
|
||||
xasprintf(&p, "%s/%s", directory, fn);
|
||||
free(directory);
|
||||
fn = p;
|
||||
}
|
||||
|
||||
umask(0077); /* Disallow everything for group and other */
|
||||
|
||||
/* Open it first to keep the inode busy */
|
||||
|
||||
r = fopen(fn, "r+") ?: fopen(fn, "w+");
|
||||
|
||||
if(!r) {
|
||||
fprintf(stderr, "Error opening file `%s': %s\n",
|
||||
fn, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
bool disable_old_keys(FILE *f) {
|
||||
char buf[100];
|
||||
long pos;
|
||||
|
|
|
@ -368,6 +368,8 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
|
|||
/* Make sure we have a valid key */
|
||||
|
||||
if(!n->status.validkey) {
|
||||
time_t now = time(NULL);
|
||||
|
||||
ifdebug(TRAFFIC) logger(LOG_INFO,
|
||||
"No valid key known yet for %s (%s), forwarding via TCP",
|
||||
n->name, n->hostname);
|
||||
|
|
|
@ -162,7 +162,7 @@ static void load_all_subnets(void) {
|
|||
struct dirent *ent;
|
||||
char *dname;
|
||||
char *fname;
|
||||
avl_tree_t *config_tree;
|
||||
splay_tree_t *config_tree;
|
||||
config_t *cfg;
|
||||
subnet_t *s;
|
||||
node_t *n;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
static bool mykeyused = false;
|
||||
|
||||
void send_key_changed() {
|
||||
avl_node_t *node;
|
||||
splay_node_t *node;
|
||||
connection_t *c;
|
||||
|
||||
send_request(broadcast, "%d %x %s", KEY_CHANGED, rand(), myself->name);
|
||||
|
@ -257,7 +257,6 @@ bool ans_key_h(connection_t *c, char *request) {
|
|||
digest_set_key(&from->outdigest, key, keylen);
|
||||
|
||||
from->status.validkey = true;
|
||||
from->status.waitingforkey = false;
|
||||
from->sent_seqno = 0;
|
||||
|
||||
if(*address && *port) {
|
||||
|
|
|
@ -117,7 +117,7 @@ bool add_subnet_h(connection_t *c, char *request) {
|
|||
if(strictsubnets) {
|
||||
logger(LOG_WARNING, "Ignoring unauthorized %s from %s (%s): %s",
|
||||
"ADD_SUBNET", c->name, c->hostname, subnetstr);
|
||||
forward_request(c);
|
||||
forward_request(c, request);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ bool del_subnet_h(connection_t *c, char *request) {
|
|||
ifdebug(PROTOCOL) logger(LOG_WARNING, "Got %s from %s (%s) for %s which does not appear in his subnet tree",
|
||||
"DEL_SUBNET", c->name, c->hostname, name);
|
||||
if(strictsubnets)
|
||||
forward_request(c);
|
||||
forward_request(c, request);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue