From 2b907b9a1126fe5b47204b2f778f8689af593476 Mon Sep 17 00:00:00 2001 From: David Levine Date: Thu, 8 Mar 2012 21:09:59 -0600 Subject: [PATCH] Fixed mhlist -verbose to work with all content types [Bug #35219]. --- docs/pending-release-notes | 2 ++ test/mhlist/test-mhlist | 36 +++++++++++++++++++++++++++--------- uip/mhlistsbr.c | 40 ++++++++++++++++++++++------------------ 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/docs/pending-release-notes b/docs/pending-release-notes index 111cb2f..70377cd 100644 --- a/docs/pending-release-notes +++ b/docs/pending-release-notes @@ -41,3 +41,5 @@ Things to add to the release notes for the next full release: or the local mailbox. - burst(1) now supports any valid message delimiter according to RFC 934. - A problem with the MD5 digest calculator on 64-bit systems has been fixed. +- Fixed mhbuild -check to properly insert Content-MD5 header. +- Fixed mhlist -verbose to work with all content types [Bug #35219]. diff --git a/test/mhlist/test-mhlist b/test/mhlist/test-mhlist index 91748b1..c1bac06 100755 --- a/test/mhlist/test-mhlist +++ b/test/mhlist/test-mhlist @@ -102,7 +102,7 @@ Content-Transfer-Encoding: quoted-printable This is the second text/plain part. ------- =_aaaaaaaaaa0 -Content-Type: text/plain; charset="iso-8859-1" +Content-Type: text/plain; charset="iso-8859-1"; name="test3" Content-Disposition: attachment; filename="test3" This is the third text/plain part. @@ -119,19 +119,19 @@ EOF # check -part run_test 'mhlist last -part 3 -noheader' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 3 text/plain 35' # check -part of a subpart run_test 'mhlist last -part 1.1 -noheader' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 1.1 text/plain 49' # check -type run_test 'mhlist last -type text/plain -noheader' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 1.1 text/plain 49 2 text/plain 36 @@ -140,19 +140,19 @@ run_test 'mhlist last -type text/plain -noheader' \ # check -norealsize run_test 'mhlist last -part 4 -noheader -norealsize' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 4 text/plain 49' # check -realsize, the default run_test 'mhlist last -part 4 -noheader -norealsize -realsize' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 4 text/plain 36' # check -check run_test 'mhlist last -part 2 -noheader -check' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 2 text/plain 36' @@ -160,7 +160,7 @@ run_test 'mhlist last -part 2 -noheader -check' \ sed 's/\(Content-MD5: \)kq+Hnc/\1BADBAD/' $msgfile > $MH_TEST_DIR/$$.tmp mv -f $MH_TEST_DIR/$$.tmp $msgfile run_test 'mhlist last -part 2 -noheader -check' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 2 text/plain 36 mhlist: content integrity suspect (digest mismatch) -- continuing @@ -168,8 +168,26 @@ mhlist: content integrity suspect (digest mismatch) -- continuing # check -nocheck, the default run_test 'mhlist last -part 2 -noheader -check -nocheck' \ -' 11 multipart/mixed 922 +' 11 multipart/mixed 936 1 multipart/related 180 2 text/plain 36' +# check -verbose +run_test 'mhlist 11 -verbose -noheader' \ +' 11 multipart/mixed 936 + boundary="----- =_aaaaaaaaaa0" + 1 multipart/related 180 + type="multipart/alternative" + boundary="subpart__1.1" + 1.1 text/plain 49 + charset="iso-8859-1" + 2 text/plain 36 + charset="iso-8859-1" + 3 text/plain 35 + charset="iso-8859-1" + name="test3" + 4 text/plain 36 + charset="iso-8859-1"' + + exit $failed diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index 1aac74a..a4e831a 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -206,18 +206,26 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug) printf ("\n"); - /* - * If verbose, print any RFC-822 comments in the - * Content-Type line. - */ - if (verbose && ci->ci_comment) { - char *dp; + if (verbose) { + char **ap, **ep; + CI ci = &ct->c_ctinfo; - dp = trimcpy (cp = add (ci->ci_comment, NULL)); - free (cp); - snprintf (buffer, sizeof(buffer), "(%s)", dp); - free (dp); - printf (LSTFMT2d2, buffer); + for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) + printf ("\t %s=\"%s\"\n", *ap, *ep); + + /* + * If verbose, print any RFC-822 comments in the + * Content-Type line. + */ + if (ci->ci_comment) { + char *dp; + + dp = trimcpy (cp = add (ci->ci_comment, NULL)); + free (cp); + snprintf (buffer, sizeof(buffer), "(%s)", dp); + free (dp); + printf (LSTFMT2d2, buffer); + } } if (debug) @@ -394,19 +402,15 @@ list_external (CT ct, int toplevel, int realsize, int verbose, int debug) /* * list content information for type "application" + * This no longer needs to be a separate function. It used to + * produce some output with verbose enabled, but that has been + * moved to list_content (). */ static int list_application (CT ct, int toplevel, int realsize, int verbose, int debug) { list_content (ct, toplevel, realsize, verbose, debug); - if (verbose) { - char **ap, **ep; - CI ci = &ct->c_ctinfo; - - for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) - printf ("\t %s=\"%s\"\n", *ap, *ep); - } return OK; } -- 1.7.10.4