From 6f3dc66634e30d86aa6250c4ac22f9b8f7ec1be9 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 4 Aug 2016 16:17:01 +0200 Subject: core: Extend gpgme_subkey_t to carry the keygrip. * src/gpgme.h.in (struct _gpgme_subkey): Add file 'keygrip'. * src/key.c (gpgme_key_unref): Free KEYGRIP. * src/keylist.c (keylist_colon_handler): Parse GRP records. * src/engine-gpg.c (gpg_keylist_build_options): Do not use --with-fingerprint options for gpg versions >= 2.1.15. * tests/run-keylist.c (main): Print subkeys and keygrips. Signed-off-by: Werner Koch --- src/engine-gpg.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/engine-gpg.c') diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 16571a5a..942711f9 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -2283,12 +2283,19 @@ gpg_keylist_build_options (engine_gpg_t gpg, int secret_only, gpg_error_t err; err = add_arg (gpg, "--with-colons"); - if (!err) - err = add_arg (gpg, "--fixed-list-mode"); - if (!err) - err = add_arg (gpg, "--with-fingerprint"); - if (!err) - err = add_arg (gpg, "--with-fingerprint"); + + /* Since gpg 2.1.15 fingerprints are always printed, thus there is + * no more need to explictly reqeust them. */ + if (!have_gpg_version (gpg, "2.1.15")) + { + if (!err) + err = add_arg (gpg, "--fixed-list-mode"); + if (!err) + err = add_arg (gpg, "--with-fingerprint"); + if (!err) + err = add_arg (gpg, "--with-fingerprint"); + } + if (!err && (mode & GPGME_KEYLIST_MODE_WITH_SECRET)) err = add_arg (gpg, "--with-secret"); if (!err -- cgit v1.2.3