core: Support keylist mode for op_keylist_from_data.

* src/engine-backend.h (keylist_data): Add MODE argument.
* src/engine-gpg.c (gpg_keylist_data): Add MODE argument.
* src/engine.c (_gpgme_engine_op_keylist_data): Likewise.
* src/engine.h (_gpgme_engine_op_keylist_data): Declaration.
* src/keylist.c (gpgme_op_keylist_from_data_start): Call
_gpgme_engine_op_keylist_data with ctx->keylist_mode.

--

GnuPG-bug-id: 5438
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-03-16 16:19:50 +09:00
parent 55861ba9cc
commit b2a2158384
5 changed files with 11 additions and 5 deletions

View File

@ -106,7 +106,8 @@ struct engine_ops
int secret_only, int reserved,
gpgme_keylist_mode_t mode,
int engine_flags);
gpgme_error_t (*keylist_data) (void *engine, gpgme_data_t data);
gpgme_error_t (*keylist_data) (void *engine, gpgme_keylist_mode_t mode,
gpgme_data_t data);
gpgme_error_t (*keysign) (void *engine,
gpgme_key_t key, const char *userid,
unsigned long expires, unsigned int flags,

View File

@ -3179,7 +3179,7 @@ gpg_keylist_ext (void *engine, const char *pattern[], int secret_only,
static gpgme_error_t
gpg_keylist_data (void *engine, gpgme_data_t data)
gpg_keylist_data (void *engine, gpgme_keylist_mode_t mode, gpgme_data_t data)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
@ -3198,6 +3198,9 @@ gpg_keylist_data (void *engine, gpgme_data_t data)
err = add_arg (gpg, "--dry-run");
if (!err)
err = add_arg (gpg, "--import");
if (!err && (mode & GPGME_KEYLIST_MODE_SIGS)
&& have_gpg_version (gpg, "2.0.10"))
err = add_arg (gpg, "--with-sig-check");
if (!err)
err = add_arg (gpg, "--");
if (!err)

View File

@ -897,7 +897,8 @@ _gpgme_engine_op_keylist_ext (engine_t engine, const char *pattern[],
gpgme_error_t
_gpgme_engine_op_keylist_data (engine_t engine, gpgme_data_t data)
_gpgme_engine_op_keylist_data (engine_t engine, gpgme_keylist_mode_t mode,
gpgme_data_t data)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
@ -905,7 +906,7 @@ _gpgme_engine_op_keylist_data (engine_t engine, gpgme_data_t data)
if (!engine->ops->keylist_data)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
return (*engine->ops->keylist_data) (engine->engine, data);
return (*engine->ops->keylist_data) (engine->engine, mode, data);
}

View File

@ -157,6 +157,7 @@ gpgme_error_t _gpgme_engine_op_keylist_ext (engine_t engine,
gpgme_keylist_mode_t mode,
int engine_flags);
gpgme_error_t _gpgme_engine_op_keylist_data (engine_t engine,
gpgme_keylist_mode_t mode,
gpgme_data_t data);
gpgme_error_t _gpgme_engine_op_sign (engine_t engine, gpgme_data_t in,
gpgme_data_t out, gpgme_sig_mode_t mode,

View File

@ -1216,7 +1216,7 @@ gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, gpgme_data_t data,
if (err)
return TRACE_ERR (err);
err = _gpgme_engine_op_keylist_data (ctx->engine, data);
err = _gpgme_engine_op_keylist_data (ctx->engine, ctx->keylist_mode, data);
return TRACE_ERR (err);
}