diff options
author | Ingo Klöcker <[email protected]> | 2022-11-15 09:03:11 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-11-15 09:03:23 +0000 |
commit | 5903fa454a47d788432192a7860b90b57efd6a10 (patch) | |
tree | d68d87871e439121c35547e18687d005c4a2eeda | |
parent | doc: Update documentation for gpgme.pc and pkg-config. (diff) | |
download | gpgme-5903fa454a47d788432192a7860b90b57efd6a10.tar.gz gpgme-5903fa454a47d788432192a7860b90b57efd6a10.zip |
core: Allow nullptr for key on card-edit
* src/edit.c (interact_start, edit_start): Return error if key is null
on edit-key.
--
In case of card-edit, key is typically null.
-rw-r--r-- | src/edit.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -122,12 +122,13 @@ interact_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, gpgme_error_t err; void *hook; op_data_t opd; + int card_edit = (flags & GPGME_INTERACT_CARD)? 1: 0; err = _gpgme_op_reset (ctx, synchronous); if (err) return err; - if (!key || !fnc || !out) + if ((card_edit == 0 && !key) || !fnc || !out) return gpg_error (GPG_ERR_INV_VALUE); err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, sizeof (*opd), NULL); @@ -146,7 +147,7 @@ interact_start (gpgme_ctx_t ctx, int synchronous, gpgme_key_t key, _gpgme_engine_set_status_handler (ctx->engine, edit_status_handler, ctx); return _gpgme_engine_op_edit (ctx->engine, - (flags & GPGME_INTERACT_CARD)? 1: 0, + card_edit, key, out, ctx); } @@ -206,7 +207,7 @@ edit_start (gpgme_ctx_t ctx, int synchronous, int type, gpgme_key_t key, if (err) return err; - if (!key || !fnc || !out) + if ((type == 0 && !key) || !fnc || !out) return gpg_error (GPG_ERR_INV_VALUE); err = _gpgme_op_data_lookup (ctx, OPDATA_EDIT, &hook, sizeof (*opd), NULL); |