Fixed handling of incoming application data after sending a close_notify (data shall be discarded silently, not trigger an error). Also fixed a couple of bugs in the command-line test tool.

This commit is contained in:
Thomas Pornin 2017-06-15 16:57:37 +02:00
parent 2f7a003698
commit 968da0f646
9 changed files with 493 additions and 456 deletions

View file

@ -128,12 +128,14 @@ read_trust_anchors(anchor_list *dst, const char *fname)
if (certificate_to_trust_anchor_inner(&ta, &xcs[u]) < 0) {
VEC_CLEAREXT(tas, free_ta_contents);
free_certificates(xcs, num);
return 0;
}
VEC_ADD(tas, ta);
}
VEC_ADDMANY(*dst, &VEC_ELT(tas, 0), num);
VEC_CLEAR(tas);
free_certificates(xcs, num);
return num;
}

View file

@ -671,7 +671,14 @@ run_ssl_engine(br_ssl_engine_context *cc, unsigned long fd, unsigned flags)
buf = br_ssl_engine_recvrec_buf(cc, &len);
rlen = recv(fd, buf, len, 0);
if (rlen <= 0) {
if (rlen == 0) {
if (verbose) {
fprintf(stderr, "socket closed...\n");
}
retcode = -1;
goto engine_exit;
}
if (rlen < 0) {
#ifdef _WIN32
int err;
@ -688,7 +695,7 @@ run_ssl_engine(br_ssl_engine_context *cc, unsigned long fd, unsigned flags)
}
#endif
if (verbose) {
fprintf(stderr, "socket closed...\n");
fprintf(stderr, "socket broke...\n");
}
retcode = -1;
goto engine_exit;