X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fprotocol_auth.c;h=4d6c991111295060402185fcacdbd1d5f401d6c6;hb=56621be326497d56db0c4c372ae3cc497018cfcf;hp=19859b7580f9829a58c1cbf246c4e86819edbdd1;hpb=cfc9fee931c70554353ce6c4acc3407baac08745;p=tinc diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 19859b75..4d6c9911 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -296,6 +296,7 @@ static bool receive_invitation_sptps(void *handle, uint8_t type, const void *dat if(!fgets(buf, sizeof(buf), f)) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not read invitation file %s\n", cookie); + fclose(f); return false; } @@ -336,6 +337,12 @@ static bool receive_invitation_sptps(void *handle, uint8_t type, const void *dat sptps_send_record(&c->sptps, 0, buf, result); } + if(!feof(f)) { + logger(DEBUG_ALWAYS, LOG_ERR, "Could not read invitation file %s\n", cookie); + fclose(f); + return false; + } + sptps_send_record(&c->sptps, 1, buf, 0); fclose(f); unlink(usedname);