X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_auth.c;fp=src%2Fprotocol_auth.c;h=263a131729f29ae7b27d03bfbe21f08f9d7e83cd;hp=7a3e6dd0e3bf1510a52e11e77aba8b4df869fc62;hb=c6a15e27d934e90a1f3a26438dddb395bdc9de19;hpb=1695d8828ed6fb997dbd96e21c105ab5641b90c5 diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 7a3e6dd0..263a1317 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -44,6 +44,7 @@ #include "random.h" #include "compression.h" #include "proxy.h" +#include "address_cache.h" #include "ed25519/sha512.h" #include "keys.h" @@ -139,6 +140,22 @@ static bool finalize_invitation(connection_t *c, const char *data, uint16_t len) logger(DEBUG_CONNECTIONS, LOG_INFO, "Key successfully received from %s (%s)", c->name, c->hostname); + if(!c->node) { + c->node = lookup_node(c->name); + } + + if(!c->node) { + c->node = new_node(c->name); + c->node->connection = c; + node_add(c->node); + } + + if(!c->node->address_cache) { + c->node->address_cache = open_address_cache(c->node); + } + + add_recent_address(c->node->address_cache, &c->address); + // Call invitation-accepted script environment_t env; char *address, *port; @@ -936,8 +953,7 @@ bool ack_h(connection_t *c, const char *request) { n = lookup_node(c->name); if(!n) { - n = new_node(); - n->name = xstrdup(c->name); + n = new_node(c->name); node_add(n); } else { if(n->connection) {