apps/lib/apps.c: fix the wrong check in check_cert_attributes

Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25811)
This commit is contained in:
Peiwei Hu 2024-10-27 17:02:32 +08:00 committed by Tomas Mraz
parent e131868678
commit 1a93be1eab

View File

@ -2216,7 +2216,7 @@ int check_cert_attributes(BIO *bio, X509 *x, const char *checkhost,
if (print)
BIO_printf(bio, "Hostname %s does%s match certificate\n",
checkhost, valid_host == 1 ? "" : " NOT");
ret = ret && valid_host;
ret = ret && valid_host > 0;
}
if (checkemail != NULL) {
@ -2224,7 +2224,7 @@ int check_cert_attributes(BIO *bio, X509 *x, const char *checkhost,
if (print)
BIO_printf(bio, "Email %s does%s match certificate\n",
checkemail, valid_mail ? "" : " NOT");
ret = ret && valid_mail;
ret = ret && valid_mail > 0;
}
if (checkip != NULL) {
@ -2232,7 +2232,7 @@ int check_cert_attributes(BIO *bio, X509 *x, const char *checkhost,
if (print)
BIO_printf(bio, "IP %s does%s match certificate\n",
checkip, valid_ip ? "" : " NOT");
ret = ret && valid_ip;
ret = ret && valid_ip > 0;
}
return ret;