projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reduce duplication in request handler tables
[tinc]
/
src
/
protocol_auth.c
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
19859b7
..
4d6c991
100644
(file)
--- 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);
if(!fgets(buf, sizeof(buf), f)) {
logger(DEBUG_ALWAYS, LOG_ERR, "Could not read invitation file %s\n", cookie);
+ fclose(f);
return false;
}
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);
}
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);
sptps_send_record(&c->sptps, 1, buf, 0);
fclose(f);
unlink(usedname);