diff options
author | Andre Heinecke <[email protected]> | 2018-07-09 09:36:28 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2018-07-09 09:36:28 +0000 |
commit | 40471ec12f7b4ba37922813a02ebb2aaaa963b51 (patch) | |
tree | 39b97d3c10a8cadde27d6e04cdf540b61e506925 /src | |
parent | tests: Add --with-secret to run-keylist.c (diff) | |
download | gpgme-40471ec12f7b4ba37922813a02ebb2aaaa963b51.tar.gz gpgme-40471ec12f7b4ba37922813a02ebb2aaaa963b51.zip |
json: Add with-secret without secret only
* src/gpgme-json.c (op_keylist, hlp_keylist): Add "with-secret"
as a flag to do a public keylist with secret information.
Diffstat (limited to 'src')
-rw-r--r-- | src/gpgme-json.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gpgme-json.c b/src/gpgme-json.c index 8d534c67..1604d2f1 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -2117,7 +2117,8 @@ static const char hlp_keylist[] = "protocol: Either \"openpgp\" (default) or \"cms\".\n" "\n" "Optional boolean flags (default is false):\n" - "secret: List secret keys.\n" + "secret: List only secret keys.\n" + "with-secret: Add KEYLIST_MODE_WITH_SECRET.\n" "extern: Add KEYLIST_MODE_EXTERN.\n" "local: Add KEYLIST_MODE_LOCAL. (default mode).\n" "sigs: Add KEYLIST_MODE_SIGS.\n" @@ -2242,6 +2243,7 @@ op_keylist (cjson_t request, cjson_t result) gpgme_protocol_t protocol; char **patterns = NULL; int abool; + int secret_only = 0; gpgme_keylist_mode_t mode = 0; gpgme_key_t key = NULL; cjson_t keyarray = xjson_CreateArray (); @@ -2254,8 +2256,14 @@ op_keylist (cjson_t request, cjson_t result) if ((err = get_boolean_flag (request, "secret", 0, &abool))) goto leave; if (abool) + { + mode |= GPGME_KEYLIST_MODE_WITH_SECRET; + secret_only = 1; + } + if ((err = get_boolean_flag (request, "with-secret", 0, &abool))) + goto leave; + if (abool) mode |= GPGME_KEYLIST_MODE_WITH_SECRET; - if ((err = get_boolean_flag (request, "extern", 0, &abool))) goto leave; if (abool) @@ -2309,8 +2317,7 @@ op_keylist (cjson_t request, cjson_t result) gpgme_set_keylist_mode (ctx, mode); err = gpgme_op_keylist_ext_start (ctx, (const char **) patterns, - (mode & GPGME_KEYLIST_MODE_WITH_SECRET), - 0); + secret_only, 0); if (err) { gpg_error_object (result, err, "Error listing keys: %s", |