1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-23 10:29:58 +01:00

* getkey.c (get_seckey_byname2): If no explicit default key is set, don't

pick a disabled default.  Noted by David Crick.
This commit is contained in:
David Shaw 2005-03-17 23:52:38 +00:00
parent 24a34eea61
commit 5f7720e693
2 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,8 @@
2005-03-17 David Shaw <dshaw@jabberwocky.com> 2005-03-17 David Shaw <dshaw@jabberwocky.com>
* getkey.c (get_seckey_byname2): If no explicit default key is
set, don't pick a disabled default. Noted by David Crick.
* Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not * Makefile.am: Calculate GNUPG_LIBEXECDIR directly. Do not
redefine $libexecdir. redefine $libexecdir.

View File

@ -1,6 +1,6 @@
/* getkey.c - Get a key from the database /* getkey.c - Get a key from the database
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
* 2004, 2005 Free Software Foundation, Inc. * 2005 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -1059,14 +1059,20 @@ get_seckey_byname2( GETKEY_CTX *retctx,
KBNODE *retblock ) KBNODE *retblock )
{ {
STRLIST namelist = NULL; STRLIST namelist = NULL;
int rc; int rc,include_unusable=1;
/* If we have no name, try to use the default secret key. If we
have no default, we'll use the first usable one. */
if( !name && opt.def_secret_key && *opt.def_secret_key ) if( !name && opt.def_secret_key && *opt.def_secret_key )
add_to_strlist( &namelist, opt.def_secret_key ); add_to_strlist( &namelist, opt.def_secret_key );
else if(name) else if(name)
add_to_strlist( &namelist, name ); add_to_strlist( &namelist, name );
else
include_unusable=0;
rc = key_byname( retctx, namelist, NULL, sk, 1, 1, retblock, NULL ); rc = key_byname( retctx, namelist, NULL, sk, 1, include_unusable,
retblock, NULL );
free_strlist( namelist ); free_strlist( namelist );