diff options
author | Petr Gotthard <petr.gotthard@centrum.cz> | 2020-12-26 21:32:14 +0100 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-02-05 10:24:04 +1000 |
commit | 7dc67708c8ae6ec06c7fec34781225ed60b5e68d (patch) | |
tree | c48ecd0e6c3a24a5837a09a7e7497c458052d4c6 /apps/storeutl.c | |
parent | 88444854affe31ce08a5daaf4b6afc86e6972c63 (diff) |
apps/openssl: add -propquery command line option
Fixes #13656. Right now all openssl commands use a NULL propq. This
patch adds a possibility to specify a custom propq.
The implementation follows the example of set_nameopt/get_nameopt.
Various tools had to be modified to call app_get0_propq after it has
been populated. Otherwise the -propquery has no effect.
The tests then verify the -propquery affects the tool behaviour by
requesting a non-existing property.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13707)
Diffstat (limited to 'apps/storeutl.c')
-rw-r--r-- | apps/storeutl.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/storeutl.c b/apps/storeutl.c index 0ec65ab047..9333c478f2 100644 --- a/apps/storeutl.c +++ b/apps/storeutl.c @@ -19,7 +19,7 @@ static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata, int expected, int criterion, OSSL_STORE_SEARCH *search, int text, int noout, int recursive, int indent, BIO *out, - const char *prog, OSSL_LIB_CTX *libctx, const char *propq); + const char *prog, OSSL_LIB_CTX *libctx); typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE, OPT_OUT, OPT_PASSIN, @@ -85,7 +85,6 @@ int storeutl_main(int argc, char *argv[]) OSSL_STORE_SEARCH *search = NULL; const EVP_MD *digest = NULL; OSSL_LIB_CTX *libctx = app_get0_libctx(); - const char *propq = app_get0_propq(); while ((o = opt_next()) != OPT_EOF) { switch (o) { @@ -315,7 +314,7 @@ int storeutl_main(int argc, char *argv[]) ret = process(argv[0], get_ui_method(), &pw_cb_data, expected, criterion, search, - text, noout, recursive, 0, out, prog, libctx, propq); + text, noout, recursive, 0, out, prog, libctx); end: OPENSSL_free(fingerprint); @@ -346,12 +345,12 @@ static int indent_printf(int indent, BIO *bio, const char *format, ...) static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata, int expected, int criterion, OSSL_STORE_SEARCH *search, int text, int noout, int recursive, int indent, BIO *out, - const char *prog, OSSL_LIB_CTX *libctx, const char *propq) + const char *prog, OSSL_LIB_CTX *libctx) { OSSL_STORE_CTX *store_ctx = NULL; int ret = 1, items = 0; - if ((store_ctx = OSSL_STORE_open_ex(uri, libctx, propq, uimeth, uidata, + if ((store_ctx = OSSL_STORE_open_ex(uri, libctx, app_get0_propq(), uimeth, uidata, NULL, NULL)) == NULL) { BIO_printf(bio_err, "Couldn't open file or uri %s\n", uri); @@ -436,7 +435,7 @@ static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata, ret += process(suburi, uimeth, uidata, expected, criterion, search, text, noout, recursive, indent + 2, out, prog, - libctx, propq); + libctx); } break; case OSSL_STORE_INFO_PARAMS: |