* armor.c (fake_packet): Allow arbitrary dash-escaped lines as per
authorDavid Shaw <dshaw@jabberwocky.com>
Wed, 13 Oct 2004 20:39:54 +0000 (20:39 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Wed, 13 Oct 2004 20:39:54 +0000 (20:39 +0000)
2440bis-10.  This is bug #158.

g10/ChangeLog
g10/armor.c

index d6ba72f..ff667db 100644 (file)
@@ -1,5 +1,8 @@
 2004-10-13  David Shaw  <dshaw@jabberwocky.com>
 
+       * armor.c (fake_packet): Allow arbitrary dash-escaped lines as per
+       2440bis-10.  This is bug #158.
+
        * keyserver.c (keyserver_work): Handle keyserver timeouts.
 
        * pkclist.c (do_edit_ownertrust): Different prompt when we're
index 6d27472..489f73d 100644 (file)
@@ -545,32 +545,31 @@ fake_packet( armor_filter_context_t *afx, IOBUF a,
        p = afx->buffer;
        n = afx->buffer_len;
 
-       if( n > 2 && *p == '-' ) {
+       if( n > 2 && *p == '-' )
+         {
            /* check for dash escaped or armor header */
-           if( p[1] == ' ' && !afx->not_dash_escaped ) {
-               /* issue a warning if it is not regular encoded */
-               if( p[2] != '-' && !( n > 6 && !memcmp(p+2, "From ", 5))) {
-                   log_info(_("invalid dash escaped line: "));
-                   print_string( stderr, p, n, 0 );
-                   putc('\n', stderr);
-               }
+           if( p[1] == ' ' && !afx->not_dash_escaped )
+             {
+               /* It's a dash-escaped line */
                afx->buffer_pos = 2; /* skip */
-           }
-           else if( n >= 15 &&  p[1] == '-' && p[2] == '-' && p[3] == '-' ) {
+             }
+           else if( n >= 15 &&  p[1] == '-' && p[2] == '-' && p[3] == '-' )
+             {
+               /* It's armor header */
                int type = is_armor_header( p, n );
                if( afx->not_dash_escaped && type != BEGIN_SIGNATURE )
-                   ; /* this is okay */
+                 ; /* this is okay */
                else {
-                   if( type != BEGIN_SIGNATURE ) {
-                       log_info(_("unexpected armor: "));
-                       print_string( stderr, p, n, 0 );
-                       putc('\n', stderr);
-                   }
-                   lastline = 1;
-                   rc = -1;
+                 if( type != BEGIN_SIGNATURE ) {
+                   log_info(_("unexpected armor: "));
+                   print_string( stderr, p, n, 0 );
+                   putc('\n', stderr);
+                 }
+                 lastline = 1;
+                 rc = -1;
                }
-           }
-       }
+             }
+         }
     }
 
     if( lastline ) { /* write last (ending) length header */