X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finvitation.c;h=dff8d5fe6306ab5d1052e03a57423145a91b7f84;hb=8d32b283b016e205b051b0bacb49a1e86fd5e1bc;hp=7fb96dacf00cb414e417f05964945c47e44a71ab;hpb=f0e7e6b03e34e69cac5b01a2d943ad3b9b59d36c;p=tinc diff --git a/src/invitation.c b/src/invitation.c index 7fb96dac..dff8d5fe 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -613,6 +613,7 @@ make_names: FILE *fh = fopen(filename, "w"); if(!fh) { fprintf(stderr, "Could not create file %s: %s\n", filename, strerror(errno)); + fclose(f); return false; } @@ -786,7 +787,7 @@ ask_netname: } -static bool invitation_send(void *handle, uint8_t type, const char *data, size_t len) { +static bool invitation_send(void *handle, uint8_t type, const void *data, size_t len) { while(len) { int result = send(sock, data, len, 0); if(result == -1 && errno == EINTR) @@ -799,7 +800,7 @@ static bool invitation_send(void *handle, uint8_t type, const char *data, size_t return true; } -static bool invitation_receive(void *handle, uint8_t type, const char *msg, uint16_t len) { +static bool invitation_receive(void *handle, uint8_t type, const void *msg, uint16_t len) { switch(type) { case SPTPS_HANDSHAKE: return sptps_send_record(&sptps, 0, cookie, sizeof cookie); @@ -906,7 +907,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.