X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finvitation.c;h=a6996cc692aee9857fc8866b3ce30a7a7c5919c2;hb=ef5e8b6920d1dd3097f36bd0c50170100acf2f28;hp=110e3953be34be066c0add8ce0785db69d838f09;hpb=2e318f379992a730f592b4c5261d26d8e1a38cfd;p=tinc diff --git a/src/invitation.c b/src/invitation.c index 110e3953..a6996cc6 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -1,6 +1,6 @@ /* invitation.c -- Create and accept invitations - Copyright (C) 2013 Guus Sliepen + Copyright (C) 2013-2014 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -197,8 +197,10 @@ done: else xasprintf(&hostport, "%s:%s", hostname, port); } else { - hostport = hostname; - hostname = NULL; + if(strchr(hostname, ':')) + xasprintf(&hostport, "[%s]", hostname); + else + hostport = xstrdup(hostname); } free(hostname); @@ -248,7 +250,7 @@ int cmd_invite(int argc, char *argv[]) { } free(filename); - // If a daemon is running, ensure no other nodes now about this name + // If a daemon is running, ensure no other nodes know about this name bool found = false; if(connect_tincd(false)) { sendline(fd, "%d %d", CONTROL, REQ_DUMP_NODES); @@ -319,7 +321,7 @@ int cmd_invite(int argc, char *argv[]) { free(filename); ecdsa_t *key; - xasprintf(&filename, "%s" SLASH "invitations" SLASH "ecdsa_key.priv", confbase); + xasprintf(&filename, "%s" SLASH "invitations" SLASH "ed25519_key.priv", confbase); // Remove the key if there are no outstanding invitations. if(!count) @@ -720,7 +722,7 @@ make_names: if(!b64key) return false; - xasprintf(&filename, "%s" SLASH "ecdsa_key.priv", confbase); + xasprintf(&filename, "%s" SLASH "ed25519_key.priv", confbase); f = fopenmask(filename, "w", 0600); if(!ecdsa_write_pem_private_key(key, f)) { @@ -732,7 +734,7 @@ make_names: fclose(f); - fprintf(fh, "ECDSAPublicKey = %s\n", b64key); + fprintf(fh, "Ed25519PublicKey = %s\n", b64key); sptps_send_record(&sptps, 1, b64key, strlen(b64key)); free(b64key); @@ -904,7 +906,7 @@ int cmd_join(int argc, char *argv[]) { if(!port || !*port) port = "655"; - if(!b64decode(slash, hash, 18) || !b64decode(slash + 24, cookie, 18)) + if(!b64decode(slash, hash, 24) || !b64decode(slash + 24, cookie, 24)) goto invalid; // Generate a throw-away key for the invitation.