Use xstrdup() instead of xasprintf() to copy static strings.
[oweals/tinc.git] / src / net_setup.c
index f7302db762eec0867b39ccc1c0fb03ed68d7539f..0718a8c5725acd0576b32110e7600f28e57e0ea4 100644 (file)
@@ -218,8 +218,8 @@ bool setup_myself(void) {
        myself->connection = new_connection();
        init_configuration(&myself->connection->config_tree);
 
-       xasprintf(&myself->hostname, "MYSELF");
-       xasprintf(&myself->connection->hostname, "MYSELF");
+       myself->hostname = xstrdup("MYSELF");
+       myself->connection->hostname = xstrdup("MYSELF");
 
        myself->connection->options = 0;
        myself->connection->protocol_version = PROT_CURRENT;
@@ -247,7 +247,7 @@ bool setup_myself(void) {
                return false;
 
        if(!get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport))
-               xasprintf(&myport, "655");
+               myport = xstrdup("655");
 
        /* Read in all the subnets specified in the host configuration file */
 
@@ -352,14 +352,14 @@ bool setup_myself(void) {
                        }
                }
        } else
-               myself->incipher = EVP_aes_256_cbc();
+               myself->incipher = EVP_bf_cbc();
 
        if(myself->incipher)
                myself->inkeylength = myself->incipher->key_len + myself->incipher->iv_len;
        else
                myself->inkeylength = 1;
 
-       myself->connection->outcipher = EVP_aes_256_ofb();
+       myself->connection->outcipher = EVP_bf_ofb();
 
        if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
                keylifetime = 3600;
@@ -380,9 +380,9 @@ bool setup_myself(void) {
                        }
                }
        } else
-               myself->indigest = EVP_sha256();
+               myself->indigest = EVP_sha1();
 
-       myself->connection->outdigest = EVP_sha256();
+       myself->connection->outdigest = EVP_sha1();
 
        if(get_config_int(lookup_config(myself->connection->config_tree, "MACLength"), &myself->inmaclength)) {
                if(myself->indigest) {
@@ -541,10 +541,17 @@ void close_network_connections(void) {
        for(node = connection_tree->head; node; node = next) {
                next = node->next;
                c = node->data;
-               c->outgoing = false;
+               c->outgoing = NULL;
                terminate_connection(c, false);
        }
 
+       for(list_node_t *node = outgoing_list->head; node; node = node->next) {
+               outgoing_t *outgoing = node->data;
+
+               if(outgoing->event)
+                       event_del(outgoing->event);
+       }
+
        list_delete_list(outgoing_list);
 
        if(myself && myself->connection) {