From: Xiangfei Ding Date: Fri, 16 Oct 2026 10:56:54 GMT Subject: Re: [PATCH v2 2/2] imap-send: let OpenSSL do the hostname verification Message-ID: 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 wrote: > > 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