Fix openssl storeutl to allow serial + issuer

storeutl wants to enforce the use of issuer and serial together,
however the current code prevents to use them together and returns an
error if only one of them is specified.

Signed-off-by: Simo Sorce <simo@redhat.com>

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19856)
This commit is contained in:
Simo Sorce 2022-12-07 18:50:51 -05:00 committed by Tomas Mraz
parent dc45d4c6fa
commit abdf35158e
1 changed files with 2 additions and 4 deletions

View File

@ -165,8 +165,7 @@ int storeutl_main(int argc, char *argv[])
break; break;
case OPT_CRITERION_ISSUER: case OPT_CRITERION_ISSUER:
if (criterion != 0 if (criterion != 0
|| (criterion == OSSL_STORE_SEARCH_BY_ISSUER_SERIAL && criterion != OSSL_STORE_SEARCH_BY_ISSUER_SERIAL) {
&& issuer != NULL)) {
BIO_printf(bio_err, "%s: criterion already given.\n", BIO_printf(bio_err, "%s: criterion already given.\n",
prog); prog);
goto end; goto end;
@ -183,8 +182,7 @@ int storeutl_main(int argc, char *argv[])
break; break;
case OPT_CRITERION_SERIAL: case OPT_CRITERION_SERIAL:
if (criterion != 0 if (criterion != 0
|| (criterion == OSSL_STORE_SEARCH_BY_ISSUER_SERIAL && criterion != OSSL_STORE_SEARCH_BY_ISSUER_SERIAL) {
&& serial != NULL)) {
BIO_printf(bio_err, "%s: criterion already given.\n", BIO_printf(bio_err, "%s: criterion already given.\n",
prog); prog);
goto end; goto end;