From: Paul Fox Date: Wed, 4 Mar 2015 18:10:38 +0000 (-0500) Subject: mhparse.c: verify all MIME-Version: headers encountered X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/d92ca17b1bbd3b17be48f48432ddc9a7ed1faf27?hp=aad5d20016b28bb8c28592c1ebe4213aafaa43c3 mhparse.c: verify all MIME-Version: headers encountered in addition to verifying, silently ignore duplicate version headers. --- diff --git a/uip/mhparse.c b/uip/mhparse.c index dd4c5e9a..7c8f07dc 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -41,6 +41,7 @@ int suppress_bogus_mp_content_warning; int bogus_mp_content; int suppress_extraneous_trailing_semicolon_warning; int extraneous_trailing_semicolon; +int suppress_multiple_mime_version_warning = 1; /* list of preferred type/subtype pairs, for -prefer */ char *preferred_types[NPREFS], @@ -365,16 +366,12 @@ get_content (FILE *in, char *file, int toplevel) if (!strcasecmp (hp->name, VRSN_FIELD)) { int ucmp; char c, *cp, *dp; + char *vrsn; - if (ct->c_vrsn) { - advise (NULL, "message %s has multiple %s: fields", - ct->c_file, VRSN_FIELD); - goto next_header; - } - ct->c_vrsn = add (hp->value, NULL); + vrsn = add (hp->value, NULL); /* Now, cleanup this field */ - cp = ct->c_vrsn; + cp = vrsn; while (isspace ((unsigned char) *cp)) cp++; @@ -401,6 +398,14 @@ get_content (FILE *in, char *file, int toplevel) admonish (NULL, "message %s has unknown value for %s: field (%s)", ct->c_file, VRSN_FIELD, cp); } + if (!ct->c_vrsn) { + ct->c_vrsn = vrsn; + } else { + if (! suppress_multiple_mime_version_warning) + advise (NULL, "message %s has multiple %s: fields", + ct->c_file, VRSN_FIELD); + free(vrsn); + } } else if (!strcasecmp (hp->name, TYPE_FIELD)) { /* Get Content-Type field */