1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Better error message for a missing keyring.

Fixes Debian#494040.
This commit is contained in:
Werner Koch 2009-04-03 10:41:33 +00:00
parent a929f4c78e
commit 9b6deeddaf
3 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2009-04-03 Werner Koch <wk@g10code.com>
* gpgv.c (main): Pass readonly flag to keydb_add_resource.
* keydb.c (keydb_add_resource): Add arg READONLY.
2009-03-20 David Shaw <dshaw@jabberwocky.com>
* keyring.c (rename_tmp_file): Force a fsync (via iobuf_ioctl) on

View File

@ -178,9 +178,9 @@ main( int argc, char **argv )
set_packet_list_mode(1);
if( !nrings ) /* no keyring given: use default one */
keydb_add_resource ("trustedkeys" EXTSEP_S "gpg", 0, 0);
keydb_add_resource ("trustedkeys" EXTSEP_S "gpg", 8, 0);
for(sl = nrings; sl; sl = sl->next )
keydb_add_resource (sl->d, 0, 0 );
keydb_add_resource (sl->d, 8, 0 );
FREE_STRLIST(nrings);

View File

@ -196,6 +196,7 @@ maybe_create_keyring (char *filename, int force)
* Flag 1 == force
* Flag 2 == mark resource as primary
* Flag 4 == This is a default resources
* Flag 8 == Readonly
*/
int
keydb_add_resource (const char *url, int flags, int secret)
@ -204,10 +205,14 @@ keydb_add_resource (const char *url, int flags, int secret)
const char *resname = url;
char *filename = NULL;
int force=(flags&1);
int readonly=!!(flags&8);
int rc = 0;
KeydbResourceType rt = KEYDB_RESOURCE_TYPE_NONE;
void *token;
if (readonly)
force = 0;
/* Do we have an URL?
* gnupg-ring:filename := this is a plain keyring
* filename := See what is is, but create as plain keyring.
@ -235,7 +240,7 @@ keydb_add_resource (const char *url, int flags, int secret)
else
filename = xstrdup (resname);
if (!force)
if (!force && !readonly)
force = secret? !any_secret : !any_public;
/* see whether we can determine the filetype */