]> git.meshlink.io Git - meshlink/commitdiff
Fixed 1.0 miss-merges
authorSven-Haegar Koch <haegar@sdinet.de>
Fri, 26 Mar 2010 16:18:04 +0000 (17:18 +0100)
committerSven-Haegar Koch <haegar@sdinet.de>
Wed, 31 Mar 2010 03:01:39 +0000 (05:01 +0200)
src/conf.c
src/net_packet.c
src/net_setup.c
src/protocol_key.c
src/protocol_subnet.c

index 42866b83cb21ddb1b17550ce55dee6193e984a86..c734a0bbff68f6b4fc023c35ef061d53e6b677a5 100644 (file)
@@ -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;
index fc09957d0ec386c7eb6668586ef74b4f9c5e2ec5..46d4e1a0df5314f22d767f038d9e39cb02e3f126 100644 (file)
@@ -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);
index 9a0c78bdcf8c3ab6e201c7e381828a2c38447e54..597c3cb754575ab16f5b69d82164eb0377bc210b 100644 (file)
@@ -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;
index 069cfd5f8ff8dd26abb1b3fd1bbcc93faa9fdfff..3baa580da8cb54d0fc73f08d212f6a80e52c5172 100644 (file)
@@ -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) {
index 65ab6e13948cc922f3d8230da495d0f74741f5a0..d509c2ba47b4747049c0563908c66264a5147ad9 100644 (file)
@@ -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;
        }