aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--g10/ChangeLog6
-rw-r--r--g10/g10.c3
-rw-r--r--g10/getkey.c6
-rw-r--r--g10/keydb.h1
-rw-r--r--g10/keylist.c17
-rw-r--r--g10/mainproc.c4
-rw-r--r--g10/options.h1
7 files changed, 35 insertions, 3 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 1d3e69579..14ab65c44 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,9 @@
+2001-12-21 Werner Koch <[email protected]>
+
+ * g10.c. options.h : New option --show-keyring
+ * getkey.c (get_ctx_handle): New.
+ * keylist.c (list_one): Implement option here. By David Champion.
+
2001-12-20 David Shaw <[email protected]>
* keyserver.c (keyserver_spawn): Use mkdtemp() to make temp
diff --git a/g10/g10.c b/g10/g10.c
index d1a277cc8..9b949b3d5 100644
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -129,6 +129,7 @@ enum cmd_and_opt_values { aNull = 0,
oNoDefCheckLevel,
oKeyring,
oSecretKeyring,
+ oShowKeyring,
oDefaultKey,
oDefRecipient,
oDefRecipientSelf,
@@ -346,6 +347,7 @@ static ARGPARSE_OPTS opts[] = {
{ oAnswerNo, "no", 0, N_("assume no on most questions")},
{ oKeyring, "keyring" ,2, N_("add this keyring to the list of keyrings")},
{ oSecretKeyring, "secret-keyring" ,2, N_("add this secret keyring to the list")},
+ { oShowKeyring, "show-keyring", 0, N_("show which keyring a listed key is on")},
{ oDefaultKey, "default-key" ,2, N_("|NAME|use NAME as default secret key")},
{ oKeyServer, "keyserver",2, N_("|HOST|use this keyserver to lookup keys")},
{ oKeyServerOptions, "keyserver-options",2,"@"},
@@ -931,6 +933,7 @@ main( int argc, char **argv )
case oAnswerYes: opt.answer_yes = 1; break;
case oAnswerNo: opt.answer_no = 1; break;
case oKeyring: append_to_strlist( &nrings, pargs.r.ret_str); break;
+ case oShowKeyring: opt.show_keyring = 1; break;
case oDebug: opt.debug |= pargs.r.ret_ulong; break;
case oDebugAll: opt.debug = ~0; break;
case oStatusFD:
diff --git a/g10/getkey.c b/g10/getkey.c
index d8695ee78..c757324a5 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -2194,4 +2194,8 @@ get_user_id( u32 *keyid, size_t *rn )
return p;
}
-
+const char*
+get_ctx_handle(GETKEY_CTX ctx)
+{
+ return ctx->kr_handle;
+}
diff --git a/g10/keydb.h b/g10/keydb.h
index bd3974541..0b5960975 100644
--- a/g10/keydb.h
+++ b/g10/keydb.h
@@ -209,6 +209,7 @@ char*get_user_id_string( u32 *keyid );
char*get_user_id_string_native( u32 *keyid );
char*get_long_user_id_string( u32 *keyid );
char*get_user_id( u32 *keyid, size_t *rn );
+const char*get_ctx_handle(GETKEY_CTX ctx);
/*-- keyid.c --*/
int pubkey_letter( int algo );
diff --git a/g10/keylist.c b/g10/keylist.c
index fa705bfa3..49f33ed4f 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -173,6 +173,9 @@ list_one( STRLIST names, int secret )
int rc = 0;
KBNODE keyblock = NULL;
GETKEY_CTX ctx;
+ char *resname;
+ char *keyring_str = N_("Keyring");
+ int i;
/* fixme: using the bynames function has the disadvantage that we
* don't know wether one of the names given was not found. OTOH,
@@ -191,6 +194,13 @@ list_one( STRLIST names, int secret )
return;
}
do {
+ if (opt.show_keyring) {
+ resname = keydb_get_resource_name (get_ctx_handle(ctx));
+ printf("%s: %s\n", keyring_str, resname);
+ for(i = strlen(resname) + strlen(keyring_str) + 2; i; i-- )
+ putchar('-');
+ putchar('\n');
+ }
list_keyblock( keyblock, 1 );
release_kbnode( keyblock );
} while( !get_seckey_next( ctx, NULL, &keyblock ) );
@@ -204,6 +214,13 @@ list_one( STRLIST names, int secret )
return;
}
do {
+ if (opt.show_keyring) {
+ resname = keydb_get_resource_name (get_ctx_handle(ctx));
+ printf("%s: %s\n", keyring_str, resname);
+ for(i = strlen(resname) + strlen(keyring_str) + 2; i; i-- )
+ putchar('-');
+ putchar('\n');
+ }
list_keyblock( keyblock, 0 );
release_kbnode( keyblock );
} while( !get_pubkey_next( ctx, NULL, &keyblock ) );
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 05437d422..35b8ddeb6 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -217,11 +217,11 @@ add_signature( CTX c, PACKET *pkt )
if( pkt->pkttype == PKT_SIGNATURE && !c->list ) {
/* This is the first signature for the following datafile.
- * G10 does not write such packets; instead it always uses
+ * GPG does not write such packets; instead it always uses
* onepass-sig packets. The drawback of PGP's method
* of prepending the signature to the data is
* that it is not possible to make a signature from data read
- * from stdin. (G10 is able to read PGP stuff anyway.) */
+ * from stdin. (GPG is able to read PGP stuff anyway.) */
node = new_kbnode( pkt );
c->list = node;
return 1;
diff --git a/g10/options.h b/g10/options.h
index 6b54a8708..4f22f2f33 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -137,6 +137,7 @@ struct {
int no_auto_check_trustdb;
int preserve_permissions;
int no_homedir_creation;
+ int show_keyring;
} opt;