mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
* g10.c. options.h : New option --show-keyring
* getkey.c (get_ctx_handle): New. * keylist.c (list_one): Implement option here. By David Champion.
This commit is contained in:
parent
b8f83e2be8
commit
ca1bc23ef2
@ -1,3 +1,9 @@
|
||||
2001-12-21 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* 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 <dshaw@jabberwocky.com>
|
||||
|
||||
* keyserver.c (keyserver_spawn): Use mkdtemp() to make temp
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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 ) );
|
||||
|
@ -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;
|
||||
|
@ -137,6 +137,7 @@ struct {
|
||||
int no_auto_check_trustdb;
|
||||
int preserve_permissions;
|
||||
int no_homedir_creation;
|
||||
int show_keyring;
|
||||
} opt;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user