[svn] GnuPG - r4035 - in trunk: . g10 scripts

svn author wk cvs at cvs.gnupg.org
Mon Mar 6 13:28:48 CET 2006


Author: wk
Date: 2006-03-06 13:28:46 +0100 (Mon, 06 Mar 2006)
New Revision: 4035

Modified:
   trunk/configure.ac
   trunk/g10/ChangeLog
   trunk/g10/mainproc.c
   trunk/scripts/ChangeLog
   trunk/scripts/w32installer.nsi
Log:
Fixed problem with PGP2 style signatures and mutilple plaintext data


Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2006-03-05 15:13:18 UTC (rev 4034)
+++ trunk/configure.ac	2006-03-06 12:28:46 UTC (rev 4035)
@@ -26,7 +26,7 @@
 
 # Remember to change the version number immediately *after* a release
 # and remove the "-cvs" or "rc" suffix immediately *before* a release.
-AC_INIT(gnupg, 1.4.3rc1, bug-gnupg at gnu.org)
+AC_INIT(gnupg, 1.4.3-cvs, bug-gnupg at gnu.org)
 # Set development_version to yes if the minor number is odd or you
 # feel that the default check for a development version is not
 # sufficient.

Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog	2006-03-05 15:13:18 UTC (rev 4034)
+++ trunk/g10/ChangeLog	2006-03-06 12:28:46 UTC (rev 4035)
@@ -1,3 +1,8 @@
+2006-03-06  Werner Koch  <wk at g10code.com>
+
+	* mainproc.c (check_sig_and_print): Check for multiple plaintexts
+	before a signature.  Reported by Tavis Ormandy.
+
 2006-03-05  Werner Koch  <wk at g10code.com>
 
 	* plaintext.c (handle_plaintext): Replace assert by explict error

Modified: trunk/g10/mainproc.c
===================================================================
--- trunk/g10/mainproc.c	2006-03-05 15:13:18 UTC (rev 4034)
+++ trunk/g10/mainproc.c	2006-03-06 12:28:46 UTC (rev 4035)
@@ -680,7 +680,8 @@
             for( data++, datalen--; datalen; datalen--, data++ )
 	      md_enable( c->mfx.md, *data );
             any = 1;
-            break;  /* no pass signature packets are expected */
+            break;  /* Stop here as one-pass signature packets are not
+                       expected.  */
 	  }
 	else if(n->pkt->pkttype==PKT_SIGNATURE)
 	  {
@@ -1164,7 +1165,7 @@
 
     /* If we have not encountered any signature we print an error
        messages, send a NODATA status back and return an error code.
-       Using log_error is required becuase verify_files does not check
+       Using log_error is required because verify_files does not check
        error codes for each file but we want to terminate the process
        with an error. */ 
     if (!rc && !c->any_sig_seen)
@@ -1444,39 +1445,62 @@
      */
     {
         KBNODE n;
-        int n_sig=0;
+        int n_sig = 0;
+        int n_plaintext = 0;
+        int sig_seen, onepass_seen;
 
-        for (n=c->list; n; n=n->next ) {
+        for (n=c->list; n; n=n->next ) 
+          {
             if ( n->pkt->pkttype == PKT_SIGNATURE ) 
-                n_sig++;
-        }
-        if (n_sig > 1) { /* more than one signature - check sequence */
-            int tmp, onepass;
-
-            for (tmp=onepass=0,n=c->list; n; n=n->next ) {
-                if (n->pkt->pkttype == PKT_ONEPASS_SIG) 
-                    onepass++;
-                else if (n->pkt->pkttype == PKT_GPG_CONTROL
-                         && n->pkt->pkt.gpg_control->control
-                            == CTRLPKT_CLEARSIGN_START ) {
-                    onepass++; /* handle the same way as a onepass */
-                }
-                else if ( (tmp && n->pkt->pkttype != PKT_SIGNATURE) ) {
-                    log_error(_("can't handle these multiple signatures\n"));
-                    return 0;
-                }
-                else if ( n->pkt->pkttype == PKT_SIGNATURE ) 
-                    tmp = 1;
-                else if (!tmp && !onepass 
-                         && n->pkt->pkttype == PKT_GPG_CONTROL
-                         && n->pkt->pkt.gpg_control->control
-                            == CTRLPKT_PLAINTEXT_MARK ) {
-                    /* plaintext before signatures but no one-pass packets*/
-                    log_error(_("can't handle these multiple signatures\n"));
-                    return 0;
-                }
-            }
-        }
+              n_sig++;
+            else if (n->pkt->pkttype == PKT_GPG_CONTROL
+                  && (n->pkt->pkt.gpg_control->control
+                      == CTRLPKT_PLAINTEXT_MARK) )
+              n_plaintext++;
+          }
+        
+        for (sig_seen=onepass_seen=0,n=c->list; n; n=n->next ) 
+          {
+            if (n->pkt->pkttype == PKT_ONEPASS_SIG) 
+              {
+                onepass_seen++;
+              }
+            else if (n->pkt->pkttype == PKT_GPG_CONTROL
+                     && (n->pkt->pkt.gpg_control->control
+                         == CTRLPKT_CLEARSIGN_START) ) 
+              {
+                onepass_seen++; /* Handle the same way as a onepass. */
+              }
+            else if ( (sig_seen && n->pkt->pkttype != PKT_SIGNATURE) ) 
+              {
+                log_error(_("can't handle these multiple signatures\n"));
+                return 0;
+              }
+            else if ( n->pkt->pkttype == PKT_SIGNATURE ) 
+              {
+                sig_seen = 1;
+              }
+            else if (n_sig > 1 && !sig_seen && !onepass_seen 
+                     && n->pkt->pkttype == PKT_GPG_CONTROL
+                     && (n->pkt->pkt.gpg_control->control
+                            == CTRLPKT_PLAINTEXT_MARK) )
+              {
+                /* Plaintext before signatures but no onepass
+                   signature packets. */
+                log_error(_("can't handle these multiple signatures\n"));
+                return 0;
+              }
+            else if (n_plaintext > 1 && !sig_seen && !onepass_seen 
+                     && n->pkt->pkttype == PKT_GPG_CONTROL
+                     && (n->pkt->pkt.gpg_control->control
+                            == CTRLPKT_PLAINTEXT_MARK) )
+              {
+                /* More than one plaintext before a signature but no
+                   onepass packets.  */
+                log_error(_("can't handle this ambiguous signed data\n"));
+                return 0;
+              }
+          }
     }
 
     astr = pubkey_algo_to_string( sig->pubkey_algo );

Modified: trunk/scripts/ChangeLog
===================================================================
--- trunk/scripts/ChangeLog	2006-03-05 15:13:18 UTC (rev 4034)
+++ trunk/scripts/ChangeLog	2006-03-06 12:28:46 UTC (rev 4035)
@@ -1,5 +1,7 @@
 2006-02-14  Werner Koch  <wk at gnupg.org>
 
+	* w32installer.nsi: Don't use System.dll.
+
 	* autogen.sh (DIE): Add lost exit for --build-w32.
 
 2005-10-02  Marcus Brinkmann  <marcus at g10code.de>

Modified: trunk/scripts/w32installer.nsi
===================================================================
--- trunk/scripts/w32installer.nsi	2006-03-05 15:13:18 UTC (rev 4034)
+++ trunk/scripts/w32installer.nsi	2006-03-06 12:28:46 UTC (rev 4035)
@@ -132,7 +132,7 @@
 ReserveFile "opt.ini" 
 ReserveFile "COPYING.txt"
 ReserveFile "README-W32.txt"
-ReserveFile "${NSISDIR}/Plugins/System.dll"
+#ReserveFile "${NSISDIR}/Plugins/System.dll"
 ReserveFile "${NSISDIR}/Plugins/UserInfo.dll"
 
 
@@ -444,11 +444,14 @@
 ; ---------
 
 Function .onInit
-  System::Call 'kernel32::CreateMutexA(i 0, i 0, t "GnuPGInst") i .r1 ?e'
-  Pop $R0
-  StrCmp $R0 0 +3
-    MessageBox MB_OK "An instance of the installer is already running."
-    Abort
+  # We can't use System.dll anymore becuase it has bee removed from
+  # Debian due to an inability to build using FS.  We should use the
+  # use our own DLL as we do with gpg4win.
+  #System::Call 'kernel32::CreateMutexA(i 0, i 0, t "GnuPGInst") i .r1 ?e'
+  #Pop $R0
+  #StrCmp $R0 0 +3
+  # MessageBox MB_OK "An instance of the installer is already running."
+  # Abort
 
   ;;!define MUI_LANGDLL_ALWAYSSHOW
   !insertmacro MUI_LANGDLL_DISPLAY




More information about the Gnupg-commits mailing list