Use correct cert and key file when there is a hostname-specific cert

This commit is contained in:
Jamie Cameron
2022-10-17 11:26:20 -07:00
parent 81376eb3fc
commit 8919aafc19

View File

@@ -4698,6 +4698,15 @@ Net::SSLeay::set_fd($ssl_con, fileno($sock));
if (!Net::SSLeay::accept($ssl_con)) {
return undef;
}
# Check for a per-hostname SSL context and use that instead
my $h = Net::SSLeay::get_servername($ssl_con);
if ($h) {
my $c = $ssl_contexts{$h} ||
$h =~ /^[^\.]+\.(.*)$/ && $ssl_contexts{"*.$1"};
if ($c) {
$ssl_ctx = $c;
}
}
return ($ssl_con, $ssl_ctx->{'certfile'}, $ssl_ctx->{'keyfile'});
}
@@ -5642,6 +5651,7 @@ elsif ($ws->{'cmd'}) {
my $pid = fork();
if (!$pid) {
# Run command in a forked process
# XXX todo here
exit(1);
}
$ptyfh->close_slave();