X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finvitation.c;h=f2f4d76c148195dd7e6165bc387acea20d4cc1a6;hb=e32d4f3db3f1ed3eebe2e11d57512b60a6c02fa6;hp=2163d6fe6de72e427f160c76882c2283884195ea;hpb=ef27852d0f5a5e31b21f256b3fb3074dd634b19d;p=tinc diff --git a/src/invitation.c b/src/invitation.c index 2163d6fe..f2f4d76c 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -448,7 +448,7 @@ int cmd_invite(int argc, char *argv[]) { char hash[64]; char *fingerprint = ecdsa_get_base64_public_key(key); sha512(fingerprint, strlen(fingerprint), hash); - b64encode_urlsafe(hash, hash, 18); + b64encode_tinc_urlsafe(hash, hash, 18); ecdsa_free(key); @@ -462,11 +462,11 @@ int cmd_invite(int argc, char *argv[]) { memcpy(buf, cookie, 18); memcpy(buf + 18, fingerprint, sizeof(buf) - 18); sha512(buf, sizeof(buf), cookiehash); - b64encode_urlsafe(cookiehash, cookiehash, 18); + b64encode_tinc_urlsafe(cookiehash, cookiehash, 18); free(fingerprint); - b64encode_urlsafe(cookie, cookie, 18); + b64encode_tinc_urlsafe(cookie, cookie, 18); // Create a file containing the details of the invitation. snprintf(filename, sizeof(filename), "%s" SLASH "invitations" SLASH "%s", confbase, cookiehash); @@ -709,7 +709,7 @@ make_names: // Generate a random netname, ask for a better one later. ask_netname = true; - snprintf(temp_netname, sizeof(temp_netname), "join_%x", rand()); + snprintf(temp_netname, sizeof(temp_netname), "join_%x", prng(UINT32_MAX)); netname = temp_netname; goto make_names; } @@ -1230,7 +1230,7 @@ int cmd_join(int argc, char *argv[]) { port = "655"; } - if(!b64decode(slash, hash, 24) || !b64decode(slash + 24, cookie, 24)) { + if(!b64decode_tinc(slash, hash, 24) || !b64decode_tinc(slash + 24, cookie, 24)) { goto invalid; }