Fix x509_check_host return value

The [x509_check_host docs](https://www.openssl.org/docs/man1.1.1/man3/X509_check_host.html)
state:
> The functions return 1 for a successful match, 0 for a failed match
and -1 for an internal error: typically a memory allocation failure or
an ASN.1 decoding error.
All functions can also return -2 if the input is malformed. For example,
X509_check_host() returns -2 if the provided name contains embedded
NULs.

The current implementation will return `true` for 1, -1, and -2,
therefore returning an incorrect value if any of the above error cases
are hit.
This commit is contained in:
Evan Rittenhouse 2024-07-23 17:06:21 -05:00 committed by Rushil Mehra
parent 04abc99fb2
commit 07bfd55a4d
1 changed files with 1 additions and 1 deletions

View File

@ -601,7 +601,7 @@ impl X509Ref {
0,
std::ptr::null_mut(),
))
.map(|n| n != 0)
.map(|n| n == 1)
}
}