[svn] GnuPG - r5051 - in trunk: . agent common g10 kbx keyserver sm

svn author wk cvs at cvs.gnupg.org
Wed Jun 24 16:03:10 CEST 2009


Author: wk
Date: 2009-06-24 16:03:09 +0200 (Wed, 24 Jun 2009)
New Revision: 5051

Modified:
   trunk/THANKS
   trunk/agent/ChangeLog
   trunk/agent/genkey.c
   trunk/agent/protect.c
   trunk/common/ChangeLog
   trunk/common/estream.c
   trunk/common/sexputil.c
   trunk/common/xreadline.c
   trunk/g10/ChangeLog
   trunk/g10/call-agent.c
   trunk/g10/card-util.c
   trunk/g10/keyedit.c
   trunk/g10/keyring.c
   trunk/g10/parse-packet.c
   trunk/g10/passphrase.c
   trunk/g10/revoke.c
   trunk/kbx/keybox-search.c
   trunk/keyserver/ChangeLog
   trunk/keyserver/gpgkeys_ldap.c
   trunk/sm/ChangeLog
   trunk/sm/call-dirmngr.c
   trunk/sm/certreqgen.c
   trunk/sm/sign.c
Log:
Fixed a bunch of little bugs as reported by Fabian Keil.
Still one problem left; marked with a gcc #warning.


Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/agent/ChangeLog	2009-06-24 14:03:09 UTC (rev 5051)
@@ -1,3 +1,9 @@
+2009-06-24  Werner Koch  <wk at g10code.com>
+
+	* genkey.c (agent_protect_and_store): Return RC and not 0.
+	* protect.c (do_encryption): Fix ignored error code from malloc.
+	Reported by Fabian Keil.
+	
 2009-06-17  Werner Koch  <wk at g10code.com>
 
 	* call-pinentry.c (agent_get_confirmation): Add arg WITH_CANCEL.

Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/common/ChangeLog	2009-06-24 14:03:09 UTC (rev 5051)
@@ -1,3 +1,13 @@
+2009-06-24  Werner Koch  <wk at g10code.com>
+
+	* estream.c (es_read_line): In the malloc error case, set
+	MAX_LENGTH to 0 only if requested.
+	* xreadline.c (read_line): Ditto.
+	* estream.c (es_write_sanitized_utf8_buffer): Pass on error from
+	es_fputs.
+	* sexputil.c (get_rsa_pk_from_canon_sexp): Check for error after
+	the loop.  Reported by Fabian Keil.
+
 2009-06-03  Werner Koch  <wk at g10code.com>
 
 	* estream.c (es_convert_mode): Rewrite and support the "x" flag.

Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/ChangeLog	2009-06-24 14:03:09 UTC (rev 5051)
@@ -1,3 +1,15 @@
+2009-06-24  Werner Koch  <wk at g10code.com>
+
+	* keyedit.c (menu_select_key): Renmove dead assign to I.
+	(menu_select_uid): Ditto.
+	* keyring.c (keyring_search): Remove dead assign to NAME.
+	* card-util.c (card_edit): Remove useless DID_CHECKPIN.
+	* call-agent.c (unhexify_fpr): Remove dead op on N.
+	* passphrase.c (passphrase_to_dek_ext): Do not deref a NULL PW.
+	* revoke.c (gen_revoke): Remove unused malloc of PK.
+	* parse-packet.c (mpi_read): Init NREAD.
+	Reported by Fabian Keil.
+
 2009-06-17  Werner Koch  <wk at g10code.com>
 
 	* parse-packet.c (parse): Use a casted -1 instead of a 32 bit

Modified: trunk/keyserver/ChangeLog
===================================================================
--- trunk/keyserver/ChangeLog	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/keyserver/ChangeLog	2009-06-24 14:03:09 UTC (rev 5051)
@@ -1,3 +1,8 @@
+2009-06-24  Werner Koch  <wk at g10code.com>
+
+	* gpgkeys_ldap.c (send_key): Do not deep free a NULL modlist.
+	Reported by Fabian Keil.
+
 2009-05-28  David Shaw  <dshaw at jabberwocky.com>
 
 	From 1.4:

Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/sm/ChangeLog	2009-06-24 14:03:09 UTC (rev 5051)
@@ -1,3 +1,10 @@
+2009-06-24  Werner Koch  <wk at g10code.com>
+
+	* call-dirmngr.c (pattern_from_strlist): Remove dead assignment of N.
+	* sign.c (gpgsm_sign): Remove dead assignment.
+	* certreqgen.c (create_request): Assign GPG_ERR_BUG to RC.
+	Reported by Fabian Keil.
+
 2009-05-27  Werner Koch  <wk at g10code.com>
 
 	* encrypt.c (encrypt_dek): Make use of make_canon_sexp.

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/THANKS	2009-06-24 14:03:09 UTC (rev 5051)
@@ -75,6 +75,7 @@
 Enzo Michelangeli	   em at MailAndNews.com
 Ernst Molitor		   ernst.molitor at uni-bonn.de
 Evgeny Legerov
+Fabian Keil                fk at fabiankeil de
 Fabio Coatti		   cova at ferrara.linux.it
 Felix von Leitner	   leitner at amdiv.de
 fish stiqz                 fish at analog.org

Modified: trunk/agent/genkey.c
===================================================================
--- trunk/agent/genkey.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/agent/genkey.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -480,5 +480,5 @@
 
   rc = store_key (s_skey, pi? pi->pin:NULL, 1);
   xfree (pi);
-  return 0;
+  return rc;
 }

Modified: trunk/agent/protect.c
===================================================================
--- trunk/agent/protect.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/agent/protect.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -176,8 +176,11 @@
       iv = xtrymalloc (blklen*2+8);
       if (!iv)
         rc = gpg_error (GPG_ERR_ENOMEM);
-      gcry_create_nonce (iv, blklen*2+8);
-      rc = gcry_cipher_setiv (hd, iv, blklen);
+      else
+        {
+          gcry_create_nonce (iv, blklen*2+8);
+          rc = gcry_cipher_setiv (hd, iv, blklen);
+        }
     }
   if (!rc)
     {

Modified: trunk/common/estream.c
===================================================================
--- trunk/common/estream.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/common/estream.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -450,8 +450,8 @@
 	  
   if (!mem_cookie->flags.grow)
     {
-      /* We are not alloew to grow, thus limit the size to the left
-         space.  FIXME: Does the grow flag an its semtics make sense
+      /* We are not allowed to grow, thus limit the size to the left
+         space.  FIXME: Does the grow flag and its sematics make sense
          at all? */
       if (size > mem_cookie->memory_size - mem_cookie->offset)
         size = mem_cookie->memory_size - mem_cookie->offset;
@@ -463,7 +463,7 @@
       size_t newsize;
       
       newsize = mem_cookie->memory_size + mem_cookie->block_size;
-      
+#warning READ the code and see how it should work      
       newsize = mem_cookie->offset + size;
       if (newsize < mem_cookie->offset)
         {
@@ -2797,7 +2797,9 @@
             {
               int save_errno = errno;
               mem_free (buffer); 
-              *length_of_buffer = *max_length = 0;
+              *length_of_buffer = 0;
+              if (max_length)
+                *max_length = 0;
               ESTREAM_UNLOCK (stream);
               errno = save_errno;
               return -1;
@@ -3203,7 +3205,7 @@
         *bytes_written = strlen (buf);
       ret = es_fputs (buf, stream);
       xfree (buf);
-      return i;
+      return rt == EOF? ret : (int)i;
     }
   else
     return es_write_sanitized (stream, p, length, delimiters, bytes_written);

Modified: trunk/common/sexputil.c
===================================================================
--- trunk/common/sexputil.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/common/sexputil.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -377,6 +377,9 @@
         return err;
     }
 
+  if (err)
+    return err;
+
   if (!rsa_n || !rsa_n_len || !rsa_e || !rsa_e_len)
     return gpg_error (GPG_ERR_BAD_PUBKEY);
 

Modified: trunk/common/xreadline.c
===================================================================
--- trunk/common/xreadline.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/common/xreadline.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -95,7 +95,9 @@
             {
               int save_errno = errno;
               xfree (buffer); 
-              *length_of_buffer = *max_length = 0;
+              *length_of_buffer = 0;
+              if (max_length)
+                *max_length = 0;
               errno = save_errno;
               return -1;
             }

Modified: trunk/g10/call-agent.c
===================================================================
--- trunk/g10/call-agent.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/call-agent.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -132,7 +132,6 @@
     ;
   if (*s || (n != 40))
     return 0; /* no fingerprint (invalid or wrong length). */
-  n /= 2;
   for (s=hexstr, n=0; *s; s += 2, n++)
     fpr[n] = xtoi_2 (s);
   return 1; /* okay */

Modified: trunk/g10/card-util.c
===================================================================
--- trunk/g10/card-util.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/card-util.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -1600,7 +1600,7 @@
   int have_commands = !!commands;
   int redisplay = 1;
   char *answer = NULL;
-  int did_checkpin = 0, allow_admin=0;
+  int allow_admin=0;
   char serialnobuf[50];
 
 
@@ -1812,12 +1812,10 @@
 
         case cmdPASSWD:
           change_pin (0, allow_admin);
-          did_checkpin = 0; /* Need to reset it of course. */
           break;
 
         case cmdUNBLOCK:
           change_pin (1, allow_admin);
-          did_checkpin = 0; /* Need to reset it of course. */
           break;
 
         case cmdQUIT:

Modified: trunk/g10/keyedit.c
===================================================================
--- trunk/g10/keyedit.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/keyedit.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -4458,7 +4458,7 @@
 	}
     }
     else { /* reset all */
-	for( i=0, node = keyblock; node; node = node->next ) {
+	for (node = keyblock; node; node = node->next) {
 	    if( node->pkt->pkttype == PKT_USER_ID )
 		node->flag &= ~NODFLG_SELUID;
 	}
@@ -4543,7 +4543,7 @@
 	}
     }
     else { /* reset all */
-	for( i=0, node = keyblock; node; node = node->next ) {
+	for ( node = keyblock; node; node = node->next ) {
 	    if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY
 		|| node->pkt->pkttype == PKT_SECRET_SUBKEY )
 		node->flag &= ~NODFLG_SELKEY;

Modified: trunk/g10/keyring.c
===================================================================
--- trunk/g10/keyring.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/keyring.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -997,7 +997,7 @@
           hd->word_match.name = xstrdup (name);
           hd->word_match.pattern = prepare_word_match (name);
         }
-      name = hd->word_match.pattern;
+      /*  name = hd->word_match.pattern; */
     }
 
   init_packet(&pkt);

Modified: trunk/g10/parse-packet.c
===================================================================
--- trunk/g10/parse-packet.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/parse-packet.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -112,7 +112,7 @@
 
   int c, c1, c2, i;
   unsigned int nbits, nbytes;
-  size_t nread;
+  size_t nread = 0;
   gcry_mpi_t a = NULL;
   byte *buf = NULL;
   byte *p;

Modified: trunk/g10/passphrase.c
===================================================================
--- trunk/g10/passphrase.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/passphrase.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -600,7 +600,7 @@
      get_last_passphrase(). */
   dek = xmalloc_secure_clear ( sizeof *dek );
   dek->algo = cipher_algo;
-  if ( !*pw && (mode == 2 || mode == 4))
+  if ( (!pw || !*pw) && (mode == 2 || mode == 4))
     dek->keylen = 0;
   else
     hash_passphrase (dek, pw, s2k);

Modified: trunk/g10/revoke.c
===================================================================
--- trunk/g10/revoke.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/g10/revoke.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -489,8 +489,6 @@
     keyid_from_sk( sk, sk_keyid );
     print_seckey_info (sk);
 
-    pk = xmalloc_clear( sizeof *pk );
-
     /* FIXME: We should get the public key direct from the secret one */
 
     pub_keyblock=get_pubkeyblock(sk_keyid);

Modified: trunk/kbx/keybox-search.c
===================================================================
--- trunk/kbx/keybox-search.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/kbx/keybox-search.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -739,6 +739,8 @@
         }
     }
 
+  (void)need_words;  /* Not yet implemented.  */
+
   if (!hd->fp)
     {
       hd->fp = fopen (hd->kb->fname, "rb");

Modified: trunk/keyserver/gpgkeys_ldap.c
===================================================================
--- trunk/keyserver/gpgkeys_ldap.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/keyserver/gpgkeys_ldap.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -771,14 +771,16 @@
   ret=KEYSERVER_OK;
 
  fail:
-  /* Unwind and free the whole modlist structure */
-  for(ml=modlist;*ml;ml++)
+  if (modlist)
     {
-      free_mod_values(*ml);
-      free(*ml);
+      /* Unwind and free the whole modlist structure */
+      for(ml=modlist;*ml;ml++)
+        {
+          free_mod_values(*ml);
+          free(*ml);
+        }
+      free(modlist);
     }
-
-  free(modlist);
   free(addlist);
   free(dn);
   free(key);

Modified: trunk/sm/call-dirmngr.c
===================================================================
--- trunk/sm/call-dirmngr.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/sm/call-dirmngr.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -747,7 +747,7 @@
   if (!pattern)
     return NULL;
 
-  for (n=0, sl=names; sl; sl = sl->next)
+  for (sl=names; sl; sl = sl->next)
     {
       for (s=sl->d; *s; s++)
         {

Modified: trunk/sm/certreqgen.c
===================================================================
--- trunk/sm/certreqgen.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/sm/certreqgen.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -769,7 +769,7 @@
           if (!n)
             {
               log_error ("libksba did not return a proper S-Exp\n");
-              err = gpg_error (GPG_ERR_BUG);
+              rc = gpg_error (GPG_ERR_BUG);
               goto leave;
             }
           rc = gcry_sexp_sscan (&s_pkey, NULL, (const char*)public, n);

Modified: trunk/sm/sign.c
===================================================================
--- trunk/sm/sign.c	2009-06-24 14:01:20 UTC (rev 5050)
+++ trunk/sm/sign.c	2009-06-24 14:03:09 UTC (rev 5051)
@@ -403,7 +403,7 @@
     log_info ("user requested hash algorithm %d\n", opt.forced_digest_algo);
   for (i=0, cl=signerlist; cl; cl = cl->next, i++)
     {
-      const char *oid = ksba_cert_get_digest_algo (cl->cert);
+      const char *oid;
 
       if (opt.forced_digest_algo)
         {




More information about the Gnupg-commits mailing list