[svn] GnuPG - r4981 - branches/STABLE-BRANCH-1-4/g10

svn author wk cvs at cvs.gnupg.org
Fri Apr 3 12:41:34 CEST 2009


Author: wk
Date: 2009-04-03 12:41:33 +0200 (Fri, 03 Apr 2009)
New Revision: 4981

Modified:
   branches/STABLE-BRANCH-1-4/g10/ChangeLog
   branches/STABLE-BRANCH-1-4/g10/gpgv.c
   branches/STABLE-BRANCH-1-4/g10/keydb.c
Log:
Better error message for a missing keyring. 
Fixes Debian#494040.


Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog	2009-04-03 10:34:22 UTC (rev 4980)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog	2009-04-03 10:41:33 UTC (rev 4981)
@@ -1,3 +1,8 @@
+2009-04-03  Werner Koch  <wk at 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 at jabberwocky.com>
 
 	* keyring.c (rename_tmp_file): Force a fsync (via iobuf_ioctl) on

Modified: branches/STABLE-BRANCH-1-4/g10/gpgv.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/gpgv.c	2009-04-03 10:34:22 UTC (rev 4980)
+++ branches/STABLE-BRANCH-1-4/g10/gpgv.c	2009-04-03 10:41:33 UTC (rev 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);
     

Modified: branches/STABLE-BRANCH-1-4/g10/keydb.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keydb.c	2009-04-03 10:34:22 UTC (rev 4980)
+++ branches/STABLE-BRANCH-1-4/g10/keydb.c	2009-04-03 10:41:33 UTC (rev 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 */




More information about the Gnupg-commits mailing list