Re: [PATCH v2 2/2] imap-send: let OpenSSL do the hostname verification
- From
- Xiangfei Ding <xfding@google.com>
- Date
- Oct 16, 2026, 10:56 UTC
- Message-ID
- <CABtdbskPaYgVnV+5P7-0G8KVYK1FBekwe2ygoYkZcvCR3RXj8Q@mail.gmail.com>
- In-Reply-To
- <20261012220039.136932-1-aniketgupta3001@gmail.com>
Hello Beat and Aniket,
> I don't think this can be reached. With SSL_VERIFY_PEER, SSL_connect() > already fails, so a hostname mismatch would only print "certificate > verify failed". It does not name the host like the old code did. Could > we print the verify result when SSL_connect() fails?
I suppose that we will have to install a callback at SSL_set_verify, from which we could leave the bad hostname in a "mailbox" so that in case SSL_connect() fails we could pick it up and print it out.
Would you mind me posting a patch on top of yours?
Best, Xiang
On Tue, Oct 13, 2026 at 12:00 AM Aniket Gupta <aniketgupta3001@gmail.com> wrote:
Show 14 quoted lines
>
> Hello Beat,
>
> > + long res = SSL_get_verify_result(sock->ssl);
> > + if (res != X509_V_OK)
> > + return error("unable to verify peer certificate: %s",
>
> I don't think this can be reached. With SSL_VERIFY_PEER, SSL_connect()
> already fails, so a hostname mismatch would only print "certificate
> verify failed". It does not name the host like the old code did. Could
> we print the verify result when SSL_connect() fails?
>
> Thanks,
> Aniket