aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-11-15 09:03:11 +0000
committerIngo Klöcker <[email protected]>2022-11-15 09:03:23 +0000
commit5903fa454a47d788432192a7860b90b57efd6a10 (patch)
treed68d87871e439121c35547e18687d005c4a2eeda
parentdoc: Update documentation for gpgme.pc and pkg-config. (diff)
downloadgpgme-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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/edit.c b/src/edit.c
index dd1fe669..b0eef0ca 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -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);