<<< Date Index >>>     <<< Thread Index >>>

Re: check-traditional-pgp oddity



Hi Alain,

Alain Bench wrote:
>     I had exactly the same symptoms and findings some monthes ago on
> another list: All messages from one user had a space on the separator
> line. He was using:
>
> | User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) 
> Gecko/20030312
> | X-Enigmail-Version: 0.73.1.0
> | X-Enigmail-Supports: pgp-inline, pgp-mime
> | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>

It's probably not caused by the user agent at all.  More likely it's some
brain-dead MTA, an equally brain-dead sysadmin adding the (hopelessly
brain-dead) lawyers' disclaimers, or, as you said, some other evil footer
adding software.

>     Same results: Gpg 1.2.1 by hand or in Mutt 1.4 verifies some
> messages OK some others not (mostly not), Gpg shows always full message,
> Mutt always eats first paragraph. I contacted him but got no
> cooperation, delayed then forgot to flea :-(.

The fellow on the GnuPG-Users list said he probably couldn't do anything
about it, that it was likely the sysadmins munging the message.  He said he
just wouldn't likely clear sign any messages to the list since they weren't
likle to verify for anyone after the MTA altered the text inside the OpenPGP
armor block.

As far as filing it as a mutt bug, that's a hard call.  I suppose mutt could
be more graceful here and not chomp up the first paragraph, but it is an out
of spec message.  There's only so many broken cases you can check for. :)

However, I was curious about this and I wanted to see if I could even code
up a regex match for "any line containing with any amount of spaces ot tabs
followed by a newline."  I'll attach the diff of pgp.c that I came up with
to do this.  It works on the messages I tested it with, but IANACC (I am NOT
a C Coder).

-- 
Todd              OpenPGP -> KeyID: 0xD654075A | URL: www.pobox.com/~tmz/pgp
============================================================================
There are three ways to get something done: do it yourself, hire someone,
or forbid your kids to do it.
    -- Monta Crane

--- pgp.c~      Tue Feb 25 16:28:54 2003
+++ pgp.c       Wed Sep 17 14:54:07 2003
@@ -156,6 +156,7 @@
 {
   char buf[HUGE_STRING];
   short complete, armor_header;
+  regex_t reblank;
   
   FGETCONV *fc;
   
@@ -163,6 +164,8 @@
   
   fc = fgetconv_open (fpin, charset, Charset, M_ICONV_HOOK_FROM);
   
+  regcomp (&reblank, "^[       ]*\n", REG_NOSUB|REG_EXTENDED);
+  
   for (complete = 1, armor_header = 1;
        fgetconvs (buf, sizeof (buf), fc) != NULL;
        complete = strchr (buf, '\n') != NULL)
@@ -179,7 +182,7 @@
     
     if (armor_header)
     {
-      if (buf[0] == '\n') 
+      if (regexec (&reblank, buf, 0, 0, 0) == 0)
        armor_header = 0;
       continue;
     }
@@ -193,6 +196,8 @@
       state_puts (buf, s);
   }
   
+  regfree (&reblank);
+  
   fgetconv_close (&fc);
 }
 

Attachment: pgp6PuaLqqi6T.pgp
Description: PGP signature