From: Sven-Haegar Koch Date: Fri, 26 Mar 2010 16:18:04 +0000 (+0100) Subject: Fixed 1.0 miss-merges X-Git-Tag: import-tinc-1.1~557 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=ffa1dc73dcd62a856325641972a13d398aa8121c;p=meshlink Fixed 1.0 miss-merges --- diff --git a/src/conf.c b/src/conf.c index 42866b83..c734a0bb 100644 --- a/src/conf.c +++ b/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; diff --git a/src/net_packet.c b/src/net_packet.c index fc09957d..46d4e1a0 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -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); diff --git a/src/net_setup.c b/src/net_setup.c index 9a0c78bd..597c3cb7 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -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; diff --git a/src/protocol_key.c b/src/protocol_key.c index 069cfd5f..3baa580d 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -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) { diff --git a/src/protocol_subnet.c b/src/protocol_subnet.c index 65ab6e13..d509c2ba 100644 --- a/src/protocol_subnet.c +++ b/src/protocol_subnet.c @@ -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; }