1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

* keydb.h, getkey.c (key_byname): Flag to enable or disable including

disabled keys.  Keys specified via keyid (i.e. 0x...) are always included.

* getkey.c (get_pubkey_byname, get_seckey_byname2, get_seckey_bynames),
keyedit.c (keyedit_menu, menu_addrevoker): Include disabled keys in these
functions.

* pkclist.c (build_pk_list): Do not include disabled keys for -r or the
key prompt.  Do include disabled keys for the default key and
--encrypt-to.

* trustdb.h, trustdb.c (is_disabled): New skipfnc for skipping disabled
keys.

* gpgv.c (is_disabled): Stub.

* keygen.c (keygen_add_key_expire): Properly handle updating a key
expiration to a no-expiration value.

* keyedit.c (enable_disable_key): Comment.

* import.c (import_one): When in interactive mode and --verbose, don't
repeat some key information twice.
This commit is contained in:
David Shaw 2002-12-26 22:22:50 +00:00
parent 7282f79c2e
commit f3f1015f6a
10 changed files with 110 additions and 16 deletions

View file

@ -743,7 +743,8 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc)
static int
key_byname( GETKEY_CTX *retctx, STRLIST namelist,
PKT_public_key *pk, PKT_secret_key *sk, int secmode,
PKT_public_key *pk, PKT_secret_key *sk,
int secmode, int include_disabled,
KBNODE *ret_kb, KEYDB_HANDLE *ret_kdbhd )
{
int rc = 0;
@ -776,6 +777,13 @@ key_byname( GETKEY_CTX *retctx, STRLIST namelist,
m_free (ctx);
return G10ERR_INV_USER_ID;
}
if(!include_disabled
&& ctx->items[n].mode!=KEYDB_SEARCH_MODE_SHORT_KID
&& ctx->items[n].mode!=KEYDB_SEARCH_MODE_LONG_KID
&& ctx->items[n].mode!=KEYDB_SEARCH_MODE_FPR16
&& ctx->items[n].mode!=KEYDB_SEARCH_MODE_FPR20
&& ctx->items[n].mode!=KEYDB_SEARCH_MODE_FPR)
ctx->items[n].skipfnc=is_disabled;
}
ctx->kr_handle = keydb_new (secmode);
@ -826,13 +834,14 @@ key_byname( GETKEY_CTX *retctx, STRLIST namelist,
int
get_pubkey_byname (PKT_public_key *pk,
const char *name, KBNODE *ret_keyblock,
KEYDB_HANDLE *ret_kdbhd )
KEYDB_HANDLE *ret_kdbhd, int include_disabled )
{
int rc;
STRLIST namelist = NULL;
add_to_strlist( &namelist, name );
rc = key_byname( NULL, namelist, pk, NULL, 0, ret_keyblock, ret_kdbhd);
rc = key_byname( NULL, namelist, pk, NULL, 0,
include_disabled, ret_keyblock, ret_kdbhd);
free_strlist( namelist );
return rc;
}
@ -841,7 +850,7 @@ int
get_pubkey_bynames( GETKEY_CTX *retctx, PKT_public_key *pk,
STRLIST names, KBNODE *ret_keyblock )
{
return key_byname( retctx, names, pk, NULL, 0, ret_keyblock, NULL);
return key_byname( retctx, names, pk, NULL, 0, 1, ret_keyblock, NULL);
}
int
@ -998,7 +1007,7 @@ get_seckey_byname2( GETKEY_CTX *retctx,
if( !name && opt.def_secret_key && *opt.def_secret_key ) {
add_to_strlist( &namelist, opt.def_secret_key );
rc = key_byname( retctx, namelist, NULL, sk, 1, retblock, NULL );
rc = key_byname( retctx, namelist, NULL, sk, 1, 1, retblock, NULL );
}
else if( !name ) { /* use the first one as default key */
struct getkey_ctx_s ctx;
@ -1019,7 +1028,7 @@ get_seckey_byname2( GETKEY_CTX *retctx,
}
else {
add_to_strlist( &namelist, name );
rc = key_byname( retctx, namelist, NULL, sk, 1, retblock, NULL );
rc = key_byname( retctx, namelist, NULL, sk, 1, 1, retblock, NULL );
}
free_strlist( namelist );
@ -1041,7 +1050,7 @@ int
get_seckey_bynames( GETKEY_CTX *retctx, PKT_secret_key *sk,
STRLIST names, KBNODE *ret_keyblock )
{
return key_byname( retctx, names, NULL, sk, 1, ret_keyblock, NULL );
return key_byname( retctx, names, NULL, sk, 1, 1, ret_keyblock, NULL );
}