X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finvitation.c;h=e71a4889a3f177a14826db0aaf5dfd4082f2b79d;hb=28b7a53b6;hp=f2f4d76c148195dd7e6165bc387acea20d4cc1a6;hpb=0912276c6467aa3ee6f570b31245367319da572a;p=tinc diff --git a/src/invitation.c b/src/invitation.c index f2f4d76c..e71a4889 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -1,6 +1,6 @@ /* invitation.c -- Create and accept invitations - Copyright (C) 2013-2017 Guus Sliepen + Copyright (C) 2013-2022 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 @@ -97,7 +97,7 @@ static void scan_for_hostname(const char *filename, char **hostname, char **port fclose(f); } -char *get_my_hostname() { +static char *get_my_hostname(void) { char *hostname = NULL; char *port = NULL; char *hostport = NULL; @@ -545,14 +545,12 @@ int cmd_invite(int argc, char *argv[]) { } static int sock; -static char cookie[18]; +static char cookie[18], hash[18]; static sptps_t sptps; static char *data; static size_t datalen; static bool success = false; -static char cookie[18], hash[18]; - static char *get_line(const char **data) { if(!data || !*data) { return NULL; @@ -1087,7 +1085,7 @@ ask_netname: static bool invitation_send(void *handle, uint8_t type, const void *vdata, size_t len) { (void)handle; (void)type; - const uint8_t *data = vdata; + const char *data = vdata; while(len) { ssize_t result = send(sock, data, len, 0); @@ -1227,7 +1225,8 @@ int cmd_join(int argc, char *argv[]) { } if(!port || !*port) { - port = "655"; + static char default_port[] = "655"; + port = default_port; } if(!b64decode_tinc(slash, hash, 24) || !b64decode_tinc(slash + 24, cookie, 24)) {