[svn] GnuPG - r4097 - trunk/g10

svn author dshaw cvs at cvs.gnupg.org
Sun Apr 9 05:34:11 CEST 2006


Author: dshaw
Date: 2006-04-09 05:34:09 +0200 (Sun, 09 Apr 2006)
New Revision: 4097

Modified:
   trunk/g10/ChangeLog
   trunk/g10/armor.c
   trunk/g10/getkey.c
   trunk/g10/gpg.c
   trunk/g10/keyedit.c
Log:
* getkey.c (parse_auto_key_locate): Fix dupe-removal code.

* keyedit.c (menu_backsign): Allow backsigning even if the secret
subkey doesn't have a binding signature.

* armor.c (radix64_read): Don't report EOF when reading only a pad (=)
character.  The EOF actually starts after the pad.

* gpg.c (main): Make --export, --send-keys, --recv-keys,
--refresh-keys, and --fetch-keys follow their arguments from left to
right.  Suggested by Peter Palfrader.


Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2006-04-08 01:23:23 UTC (rev 4096)
+++ trunk/g10/ChangeLog	2006-04-09 03:34:09 UTC (rev 4097)
@@ -1,3 +1,17 @@
+2006-04-08  David Shaw  <dshaw at jabberwocky.com>
+
+	* getkey.c (parse_auto_key_locate): Fix dupe-removal code.
+
+	* keyedit.c (menu_backsign): Allow backsigning even if the secret
+	subkey doesn't have a binding signature.
+
+	* armor.c (radix64_read): Don't report EOF when reading only a pad
+	(=) character.  The EOF actually starts after the pad.
+
+	* gpg.c (main): Make --export, --send-keys, --recv-keys,
+	--refresh-keys, and --fetch-keys follow their arguments from left
+	to right.  Suggested by Peter Palfrader.
+
 2006-04-08  Werner Koch  <wk at g10code.com>
 
 	* mainproc.c (list_node): Print ring trust value only if not empty
@@ -7,7 +21,7 @@
 
 	* getkey.c (user_id_not_found_utf8): New.
 	(get_primary_uid, get_user_id): Use it.  Fixes Debian bug #205028
-	inthe right way.
+	in the right way.
 
 2006-04-03  Werner Koch  <wk at g10code.com>
 

Modified: trunk/g10/armor.c
===================================================================
--- trunk/g10/armor.c	2006-04-08 01:23:23 UTC (rev 4096)
+++ trunk/g10/armor.c	2006-04-09 03:34:09 UTC (rev 4097)
@@ -676,7 +676,7 @@
     int checkcrc=0;
     int rc = 0;
     size_t n = 0;
-    int  idx, i;
+    int  idx, i, onlypad=0;
     u32 crc;
 
     crc = afx->crc;
@@ -720,6 +720,8 @@
 		    goto again;
 		}
 	    }
+	    else if(n==0)
+	      onlypad=1;
 
 	    if( idx == 1 )
 		buf[n++] = val;
@@ -848,7 +850,7 @@
 	}
     }
 
-    if( !n )
+    if( !n && !onlypad )
 	rc = -1;
 
     *retn = n;

Modified: trunk/g10/getkey.c
===================================================================
--- trunk/g10/getkey.c	2006-04-08 01:23:23 UTC (rev 4096)
+++ trunk/g10/getkey.c	2006-04-09 03:34:09 UTC (rev 4097)
@@ -2947,7 +2947,7 @@
 
   while((tok=optsep(&options)))
     {
-      struct akl *akl,*last;
+      struct akl *akl,*check,*last=NULL;
       int dupe=0;
 
       if(tok[0]=='\0')
@@ -2976,13 +2976,13 @@
 	}
 
       /* We must maintain the order the user gave us */
-      for(last=opt.auto_key_locate;last && last->next;last=last->next)
+      for(check=opt.auto_key_locate;check;last=check,check=check->next)
 	{
 	  /* Check for duplicates */
-	  if(last && last->type==akl->type
+	  if(check->type==akl->type
 	     && (akl->type!=AKL_SPEC
 		 || (akl->type==AKL_SPEC
-		     && strcmp(last->spec->uri,akl->spec->uri)==0)))
+		     && strcmp(check->spec->uri,akl->spec->uri)==0)))
 	    {
 	      dupe=1;
 	      free_akl(akl);

Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c	2006-04-08 01:23:23 UTC (rev 4096)
+++ trunk/g10/gpg.c	2006-04-09 03:34:09 UTC (rev 4097)
@@ -3399,12 +3399,17 @@
 	import_keys( argc? argv:NULL, argc, NULL, opt.import_options );
 	break;
 
+	/* TODO: There are a number of command that use this same
+	   "make strlist, call function, report error, free strlist"
+	   pattern.  Join them together here and avoid all that
+	   duplicated code. */
+
       case aExport:
       case aSendKeys:
       case aRecvKeys:
 	sl = NULL;
 	for( ; argc; argc--, argv++ )
-	    add_to_strlist2( &sl, *argv, utf8_strings );
+	    append_to_strlist2( &sl, *argv, utf8_strings );
 	if( cmd == aSendKeys )
 	    rc=keyserver_export( sl );
 	else if( cmd == aRecvKeys )
@@ -3436,7 +3441,7 @@
       case aRefreshKeys:
 	sl = NULL;
 	for( ; argc; argc--, argv++ )
-	    add_to_strlist2( &sl, *argv, utf8_strings );
+	    append_to_strlist2( &sl, *argv, utf8_strings );
 	rc=keyserver_refresh(sl);
 	if(rc)
 	  log_error(_("keyserver refresh failed: %s\n"),g10_errstr(rc));
@@ -3446,7 +3451,7 @@
       case aFetchKeys:
 	sl = NULL;
 	for( ; argc; argc--, argv++ )
-	    add_to_strlist2( &sl, *argv, utf8_strings );
+	    append_to_strlist2( &sl, *argv, utf8_strings );
 	rc=keyserver_fetch(sl);
 	if(rc)
 	  log_error("key fetch failed: %s\n",g10_errstr(rc));

Modified: trunk/g10/keyedit.c
===================================================================
--- trunk/g10/keyedit.c	2006-04-08 01:23:23 UTC (rev 4096)
+++ trunk/g10/keyedit.c	2006-04-09 03:34:09 UTC (rev 4097)
@@ -3711,9 +3711,6 @@
 	    break;
 	  }
 
-      if(!sig_sk)
-	continue;
-
       /* Now we can get to work.  We have a main key and secret part,
 	 a signing subkey with signature and secret part with
 	 signature. */
@@ -3744,13 +3741,16 @@
 	      xfree(sig_pk->pkt);
 	      sig_pk->pkt=newpkt;
 
-	      /* Put the new sig into place on the seckey */
-	      newpkt=xmalloc_clear(sizeof(*newpkt));
-	      newpkt->pkttype=PKT_SIGNATURE;
-	      newpkt->pkt.signature=copy_signature(NULL,newsig);
-	      free_packet(sig_sk->pkt);
-	      xfree(sig_sk->pkt);
-	      sig_sk->pkt=newpkt;
+	      if(sig_sk)
+		{
+		  /* Put the new sig into place on the seckey */
+		  newpkt=xmalloc_clear(sizeof(*newpkt));
+		  newpkt->pkttype=PKT_SIGNATURE;
+		  newpkt->pkt.signature=copy_signature(NULL,newsig);
+		  free_packet(sig_sk->pkt);
+		  xfree(sig_sk->pkt);
+		  sig_sk->pkt=newpkt;
+		}
 
 	      modified=1;
 	    }




More information about the Gnupg-commits mailing list