Patch by upstream attached. SVN rev. 4981.
# 2009-04-03 Werner Koch <w...@g10code.com> # # * gpgv.c (main): Pass readonly flag to keydb_add_resource. # * keydb.c (keydb_add_resource): Add arg READONLY. # Index: g10/gpgv.c =================================================================== --- g10/gpgv.c (Revision 4980) +++ g10/gpgv.c (Revision 4981) @@ -178,9 +178,9 @@ 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); Index: g10/keydb.c =================================================================== --- g10/keydb.c (Revision 4980) +++ g10/keydb.c (Revision 4981) @@ -196,6 +196,7 @@ * 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 @@ 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 @@ else filename = xstrdup (resname); - if (!force) + if (!force && !readonly) force = secret? !any_secret : !any_public; /* see whether we can determine the filetype */