Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sectransp_connect_step1: bail out if SSLSetPeerDomainName fails #8798

wants to merge 1 commit into from


Copy link

@piru piru commented May 5, 2022

Before the code would only warn about SSLSetPeerDomainName() errors.

Caller requested host verification and if we can't do it we must fail to connect.

Before the code would just warn about SSLSetPeerDomainName() errors.
@jay jay added the TLS label May 5, 2022
Copy link

@jay jay commented May 5, 2022

Was the intention to continue even if SSLSetPeerDomainName fails? There is a "WARNING" there which makes me think so. @nickzman

Copy link

@nickzman nickzman commented May 5, 2022

I'm not sure if this is even necessary. If you look at the function's internal implementation, you'll see that it fails only under two circumstances: the context is not set, and the session is already active. Neither of which will ever be hit unless the code in this function gets scrambled, so I will be very surprised if this function fails for anyone anywhere.

@piru , what are you trying to accomplish?

Copy link

@piru piru commented May 5, 2022

@nickzman Defensive programming. The API call has an error code. If the error code is set, the operation can be assumed to have failed. Continuing when this operation has failed will (likely) result in security check bypass (hostname will not be validated).

Now, if the function can practically never fail, what's the harm in checking the result code and bailing out if error occurred?


What is this code trying to accomplish by continuing even if error occurred?

bagder approved these changes May 6, 2022
Copy link

@nickzman nickzman commented May 6, 2022

Okay. Although it's not likely to fail, I'm okay with this change. Thanks!

Copy link

@bagder bagder commented May 6, 2022


@piru piru deleted the bail_on_SSLSetPeerDomainName_error branch May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants