making more explicit the case of missing SNI

Missing SNI (i.e. servname == NULL) is already handled correctly.
puny_decode refuses to work on NULL servname, c->domain is still the
empty string and everything flows as expected towards the error at the
end.  However, it's better to bail out early and make more explicit
how the case of missing SNI is handled.
This commit is contained in:
Omar Polo 2021-09-24 07:40:24 +00:00
parent 2b38d395cd
commit 79288c8b60
1 changed files with 5 additions and 1 deletions

View File

@ -464,7 +464,11 @@ handle_handshake(int fd, short ev, void *d)
abort();
}
servname = tls_conn_servername(c->ctx);
if ((servname = tls_conn_servername(c->ctx)) == NULL) {
log_debug(c, "handshake: missing SNI");
goto err;
}
if (!puny_decode(servname, c->domain, sizeof(c->domain), &parse_err)) {
log_info(c, "puny_decode: %s", parse_err);
goto err;