[svn] GnuPG - r4545 - branches/STABLE-BRANCH-1-4/g10
svn author dshaw
cvs at cvs.gnupg.org
Wed Jul 18 19:09:20 CEST 2007
Author: dshaw
Date: 2007-07-18 19:08:47 +0200 (Wed, 18 Jul 2007)
New Revision: 4545
Modified:
branches/STABLE-BRANCH-1-4/g10/ChangeLog
branches/STABLE-BRANCH-1-4/g10/armor.c
Log:
* armor.c (is_armor_tag): New. Detect if an armor header matches
2440bis-21. (parse_header_line): Call it here, as bis-21 requires
warning the user (but continuing to process the message) when seeing
an unknown header.
Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2007-07-17 18:11:24 UTC (rev 4544)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2007-07-18 17:08:47 UTC (rev 4545)
@@ -1,3 +1,11 @@
+2007-07-18 David Shaw <dshaw at jabberwocky.com>
+
+ * armor.c (is_armor_tag): New. Detect if an armor header matches
+ 2440bis-21.
+ (parse_header_line): Call it here, as bis-21 requires warning the
+ user (but continuing to process the message) when seeing an
+ unknown header.
+
2007-07-09 Werner Koch <wk at g10code.com>
* gpg.c: Better print an extra warning if Camellia has been
Modified: branches/STABLE-BRANCH-1-4/g10/armor.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/armor.c 2007-07-17 18:11:24 UTC (rev 4544)
+++ branches/STABLE-BRANCH-1-4/g10/armor.c 2007-07-18 17:08:47 UTC (rev 4545)
@@ -1,6 +1,6 @@
/* armor.c - Armor flter
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- * 2006 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ * 2007 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -314,7 +314,19 @@
return found;
}
+/* Returns true if this is a valid armor tag as per RFC-2440bis-21. */
+static int
+is_armor_tag(const char *line)
+{
+ if(strncmp(line,"Version",7)==0
+ || strncmp(line,"Comment",7)==0
+ || strncmp(line,"MessageID",9)==0
+ || strncmp(line,"Hash",4)==0
+ || strncmp(line,"Charset",7)==0)
+ return 1;
+ return 0;
+}
/****************
* Check whether this is a armor line.
@@ -424,6 +436,18 @@
putc('\n', stderr);
}
+ /* Section 6.2: OpenPGP should consider improperly formatted Armor
+ Headers to be corruption of the ASCII Armor. Unknown keys
+ should be reported to the user, but OpenPGP should continue to
+ process the message. */
+
+ if(!is_armor_tag(line))
+ {
+ log_info(_("unknown armor header: "));
+ print_string( stderr, line, len, 0 );
+ putc('\n', stderr);
+ }
+
if( afx->in_cleartext ) {
if( (hashes=parse_hash_header( line )) )
afx->hashes |= hashes;
More information about the Gnupg-commits
mailing list