From 60880adafa93e1a1e8e9fecf03c14d56bbd55345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Mon, 13 Dec 2021 16:52:23 +0100 Subject: core: Allow specifiying a key origin when importing keys * src/context.h (struct gpgme_context): New field key_origin. * src/engine-backend.h (struct engine_ops): Add arg key_origin to field 'import'. * src/engine-gpg.c (gpg_import): Add arg key_origin and pass option --key-origin with argument value to gpg. Adjust all callers. * src/engine-gpgsm.c (gpgsm_import): Add dummy arg key_origin. * src/gpgme.c (gpgme_release): Free 'key_origin'. (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "key-origin". * tests/run-import.c (main): Add option --key-origin. * tests/gpg/t-import.c (main): Set and verify key origin. -- This makes the --key-origin option available in the GPGME API for key imports. GnuPG-bug-id: 5733 --- src/import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/import.c') diff --git a/src/import.c b/src/import.c index 2834aec2..5dc74907 100644 --- a/src/import.c +++ b/src/import.c @@ -282,7 +282,7 @@ _gpgme_op_import_start (gpgme_ctx_t ctx, int synchronous, gpgme_data_t keydata) _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx); - return _gpgme_engine_op_import (ctx->engine, keydata, NULL); + return _gpgme_engine_op_import (ctx->engine, keydata, NULL, ctx->key_origin); } @@ -365,7 +365,7 @@ _gpgme_op_import_keys_start (gpgme_ctx_t ctx, int synchronous, _gpgme_engine_set_status_handler (ctx->engine, import_status_handler, ctx); - return _gpgme_engine_op_import (ctx->engine, NULL, keys); + return _gpgme_engine_op_import (ctx->engine, NULL, keys, ctx->key_origin); } -- cgit v1.2.3