]> diplodocus.org Git - nmh/commitdiff
Removal of Content-MD5 support
authorKen Hornstein <kenh@pobox.com>
Wed, 24 Apr 2019 14:25:18 +0000 (10:25 -0400)
committerKen Hornstein <kenh@pobox.com>
Wed, 24 Apr 2019 14:25:18 +0000 (10:25 -0400)
The generation and verification of Content-MD5 headers is no longer
done.  FINALLY.

32 files changed:
Makefile.am
docs/pending-release-notes
h/md5.h [deleted file]
h/mhparse.h
h/mime.h
man/mhbuild.man
man/mhlist.man
man/mhn.man
man/mhshow.man
man/mhstore.man
mts/smtp/smtp.c
sbr/base64.c
sbr/base64.h
sbr/md5.c [deleted file]
sbr/netsec.c
test/mhbuild/test-attach
test/mhlist/test-mhlist
test/mhstore/test-mhstore
uip/imaptest.c
uip/mhbuild.c
uip/mhbuildsbr.c
uip/mhcachesbr.c
uip/mhlist.c
uip/mhn.c
uip/mhoutsbr.c
uip/mhparse.c
uip/mhshow.c
uip/mhshowsbr.c
uip/mhstore.c
uip/mhstoresbr.c
uip/popsbr.c
uip/viamail.c

index ed78268..cf106bb 100644 (file)
@@ -339,7 +339,6 @@ noinst_HEADERS = \
     h/fmt_compile.h \
     h/fmt_scan.h \
     h/icalendar.h \
     h/fmt_compile.h \
     h/fmt_scan.h \
     h/icalendar.h \
-    h/md5.h \
     h/mf.h \
     h/mh.h \
     h/mhcachesbr.h \
     h/mf.h \
     h/mh.h \
     h/mhcachesbr.h \
@@ -1093,7 +1092,6 @@ sbr_libmh_a_SOURCES = \
     sbr/m_popen.c \
     sbr/m_rand.c \
     sbr/makedir.c \
     sbr/m_popen.c \
     sbr/m_rand.c \
     sbr/makedir.c \
-    sbr/md5.c \
     sbr/message_id.c \
     sbr/mf.c \
     sbr/mime_type.c \
     sbr/message_id.c \
     sbr/mf.c \
     sbr/mime_type.c \
index e3b213c..5438191 100644 (file)
@@ -17,6 +17,11 @@ OBSOLETE FEATURES
 DEPRECATED FEATURES
 -------------------
 
 DEPRECATED FEATURES
 -------------------
 
+- The generation and verification of Content-MD5 headers is no longer
+  performed.  The -check and -nocheck switches to various nmh programs
+  that would control this functionality still exist, but are non-functional
+  and will be removed in the next release.
+
 ---------
 BUG FIXES
 ---------
 ---------
 BUG FIXES
 ---------
diff --git a/h/md5.h b/h/md5.h
deleted file mode 100644 (file)
index e190604..0000000
--- a/h/md5.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* md5.h -- header file for md5 message digest
- *          taken from RFC-1321/Appendices A.1/A.2
- */
-
-/*
- * RSAREF types and constants
- */
-
-#include "nmh.h"
-#include <inttypes.h>
-
-/* UINT4 defines a four byte word */
-typedef uint32_t UINT4;
-
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
-
-/* MD5 context. */
-typedef struct {
-    UINT4 state[4]; /* state (ABCD) */
-    UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
-    unsigned char buffer[64]; /* input buffer */
-} MD5_CTX;
-
-void MD5Init(MD5_CTX *);
-void MD5Update(MD5_CTX *, unsigned char *, unsigned int);
-void MD5Final(unsigned char [16], MD5_CTX *);
index 96a37b0..4052cc3 100644 (file)
@@ -139,10 +139,6 @@ struct Content {
     int        c_encoding;             /* internal flag for encoding type   */
     int c_reqencoding;         /* Requested encoding (by mhbuild)   */
 
     int        c_encoding;             /* internal flag for encoding type   */
     int c_reqencoding;         /* Requested encoding (by mhbuild)   */
 
-    /* Content-MD5 info */
-    int        c_digested;             /* have we seen this header before?  */
-    unsigned char c_digest[16];        /* decoded MD5 checksum              */
-
     /* pointers to content-specific structures */
     void *c_ctparams;          /* content type specific data        */
     struct exbody *c_ctexbody; /* data for type message/external    */
     /* pointers to content-specific structures */
     void *c_ctparams;          /* content type specific data        */
     struct exbody *c_ctexbody; /* data for type message/external    */
@@ -506,8 +502,6 @@ char *get_param(PM first, const char *name, char replace, int fetchonly);
  */
 char *get_param_value(PM pm, char replace);
 
  */
 char *get_param_value(PM pm, char replace);
 
-extern int checksw;    /* Add Content-MD5 field */
-
 /*
  * mhstore
  * Put it here because it uses the CT typedef.
 /*
  * mhstore
  * Put it here because it uses the CT typedef.
index e389b28..a0022c1 100644 (file)
--- a/h/mime.h
+++ b/h/mime.h
@@ -9,7 +9,6 @@
 #define        ID_FIELD        "Content-ID"
 #define        DESCR_FIELD     "Content-Description"
 #define        DISPO_FIELD     "Content-Disposition"
 #define        ID_FIELD        "Content-ID"
 #define        DESCR_FIELD     "Content-Description"
 #define        DISPO_FIELD     "Content-Disposition"
-#define        MD5_FIELD       "Content-MD5"
 #define        PSEUDOHEADER_PREFIX        "Nmh-"
 #define        ATTACH_FIELD               PSEUDOHEADER_PREFIX "Attach"
 #define        ATTACH_FIELD_ALT           "Attach"
 #define        PSEUDOHEADER_PREFIX        "Nmh-"
 #define        ATTACH_FIELD               PSEUDOHEADER_PREFIX "Attach"
 #define        ATTACH_FIELD_ALT           "Attach"
index 8e87209..46a0507 100644 (file)
@@ -20,7 +20,6 @@ mhbuild \- translate MIME composition drafts for nmh messages
 .RB [ \-contentid " | " \-nocontentid ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-disposition " | " \-nodisposition ]
 .RB [ \-contentid " | " \-nocontentid ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-disposition " | " \-nodisposition ]
-.RB [ \-check " | " \-nocheck ]
 .RB [ \-headerencoding
 .I encoding-algorithm
 .RB " | " \-autoheaderencoding ]
 .RB [ \-headerencoding
 .I encoding-algorithm
 .RB " | " \-autoheaderencoding ]
@@ -728,17 +727,6 @@ This third part will be text/plain
                     /home/foobar/lib/picture.gif
 .fi
 .RE
                     /home/foobar/lib/picture.gif
 .fi
 .RE
-.SS "Integrity Check"
-If
-.B mhbuild
-is given the
-.B \-check
-switch, then it will also associate an integrity check with each
-\*(lqleaf\*(rq content.
-This will add a Content-MD5 header field to the content, along with the md5
-sum of the unencoded contents, per RFC 1864.
-This may be used by the receiver of the message to verify that the contents
-of the message were not changed in transport.
 .SS "Transfer Encodings"
 After
 .B mhbuild
 .SS "Transfer Encodings"
 After
 .B mhbuild
@@ -748,15 +736,6 @@ It will check for 8-bit data, long lines, spaces at the end of lines, and
 clashes with multipart boundaries.
 It will then choose a transfer encoding appropriate for each content type.
 .PP
 clashes with multipart boundaries.
 It will then choose a transfer encoding appropriate for each content type.
 .PP
-If an integrity check is being associated with each content by using
-the
-.B \-check
-switch, then
-.B mhbuild
-will encode each content with
-a transfer encoding, even if the content contains only 7-bit data.
-This is to increase the likelihood that the content is not changed while in
-transport.
 .SS "Invoking mhbuild"
 Typically,
 .B mhbuild
 .SS "Invoking mhbuild"
 Typically,
 .B mhbuild
index da1ce80..e352f04 100644 (file)
@@ -30,7 +30,6 @@ mhlist \- list information about nmh MIME messages
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
-.RB [ \-check " | " \-nocheck ]
 .RB [ \-changecur " | " \-nochangecur ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-disposition " | " \-nodisposition ]
 .RB [ \-changecur " | " \-nochangecur ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-disposition " | " \-nodisposition ]
@@ -200,15 +199,6 @@ but are also implemented in
 and
 .B mhstore
 to make common part numbering possible across all three programs.
 and
 .B mhstore
 to make common part numbering possible across all three programs.
-.SS "Checking the Contents"
-The
-.B \-check
-switch tells
-.B mhlist
-to check each content for an integrity checksum.  If a content has
-such a checksum (specified as a Content-MD5 header field), then
-.B mhlist
-will attempt to verify the integrity of the content.
 .SH FILES
 .fc ^ ~
 .nf
 .SH FILES
 .fc ^ ~
 .nf
index ae12a6a..beb0633 100644 (file)
@@ -35,7 +35,6 @@ mhn \- display/list/store/cache nmh MIME messages
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
-.RB [ \-check " | " \-nocheck ]
 .PP
 .HP 5
 .B mhn
 .PP
 .HP 5
 .B mhn
index 4cbbd19..c7fc143 100644 (file)
@@ -36,7 +36,6 @@ mhshow \- display nmh MIME messages
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
-.RB [ \-check " | " \-nocheck ]
 .ad
 .SH DESCRIPTION
 The
 .ad
 .SH DESCRIPTION
 The
@@ -248,15 +247,6 @@ non-empty, then
 .B mhshow
 will remove each of the messages shown from each sequence named by
 the profile entry.
 .B mhshow
 will remove each of the messages shown from each sequence named by
 the profile entry.
-.SS "Checking the Contents"
-The
-.B \-check
-switch tells
-.B mhshow
-to check each content for an integrity checksum.  If a content has such
-a checksum (specified as a Content-MD5 header field), then
-.B mhshow
-will attempt to verify the integrity of the content.
 .SS "Showing the Contents"
 The headers of each message are displayed with the
 .I mhlproc
 .SS "Showing the Contents"
 The headers of each message are displayed with the
 .I mhlproc
index cb10d62..8347a62 100644 (file)
@@ -33,7 +33,6 @@ mhstore \- store contents of nmh MIME messages into files
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
 .IR policy ]
 .RB [ \-wcache
 .IR policy ]
-.RB [ \-check " | " \-nocheck ]
 .RB [ \-verbose " | " \-noverbose ]
 .ad
 .SH DESCRIPTION
 .RB [ \-verbose " | " \-noverbose ]
 .ad
 .SH DESCRIPTION
@@ -175,16 +174,6 @@ The
 switch will cancel any previous
 .B \-prefer
 switches.
 switch will cancel any previous
 .B \-prefer
 switches.
-.SS "Checking the Contents"
-The
-.B \-check
-switch tells
-.B mhstore
-to check each content for an integrity checksum.
-If a content has such a checksum (specified as a Content-MD5 header
-field), then
-.B mhstore
-will attempt to verify the integrity of the content.
 .SS "Storing the Contents"
 .B mhstore
 will store the contents of the named messages in
 .SS "Storing the Contents"
 .B mhstore
 will store the contents of the named messages in
index 8270b34..ea7f719 100644 (file)
@@ -1048,7 +1048,7 @@ sm_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
            *outdata = NULL;
            *outdatalen = 0;
        } else {
            *outdata = NULL;
            *outdatalen = 0;
        } else {
-           rc = decodeBase64(line + 4, outdata, &len, 0, NULL);
+           rc = decodeBase64(line + 4, outdata, &len, 0);
            if (rc != OK) {
                netsec_err(errstr, "Unable to decode base64 response");
                return NOTOK;
            if (rc != OK) {
                netsec_err(errstr, "Unable to decode base64 response");
                return NOTOK;
index ef3aa32..8fb5357 100644 (file)
@@ -8,7 +8,6 @@
 #include "h/mh.h"
 #include "error.h"
 #include "h/mime.h"
 #include "h/mh.h"
 #include "error.h"
 #include "h/mime.h"
-#include "h/md5.h"
 #include <inttypes.h>
 
 static const char nib2b64[0x40+1] =
 #include <inttypes.h>
 
 static const char nib2b64[0x40+1] =
@@ -245,21 +244,16 @@ static const unsigned char b642nib[0x80] = {
  * len          - number of decoded bytes
  * skip-crs     - non-zero for text content, and for which CR's should be
  *                skipped
  * len          - number of decoded bytes
  * skip-crs     - non-zero for text content, and for which CR's should be
  *                skipped
- * digest       - for an MD5 digest, it can be null
  */
 int
 decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len,
  */
 int
 decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len,
-             int skip_crs, unsigned char *digest)
+             int skip_crs)
 {
     const char *cp = encoded;
     int bitno, skip;
     uint32_t bits;
     /* Size the decoded string very conservatively. */
     charstring_t decoded_c = charstring_create (strlen (encoded));
 {
     const char *cp = encoded;
     int bitno, skip;
     uint32_t bits;
     /* Size the decoded string very conservatively. */
     charstring_t decoded_c = charstring_create (strlen (encoded));
-    MD5_CTX mdContext;
-
-    if (digest)
-        MD5Init (&mdContext);
 
     bitno = 18;
     bits = 0L;
 
     bitno = 18;
     bits = 0L;
@@ -292,22 +286,16 @@ test_end:
                     if (! skip_crs  ||  b != '\r') {
                         charstring_push_back (decoded_c, b);
                     }
                     if (! skip_crs  ||  b != '\r') {
                         charstring_push_back (decoded_c, b);
                     }
-                    if (digest)
-                        MD5Update (&mdContext, (unsigned char *) &b, 1);
                     if (skip < 2) {
                         b = (bits >> 8) & 0xff;
                         if (! skip_crs  ||  b != '\r') {
                             charstring_push_back (decoded_c, b);
                         }
                     if (skip < 2) {
                         b = (bits >> 8) & 0xff;
                         if (! skip_crs  ||  b != '\r') {
                             charstring_push_back (decoded_c, b);
                         }
-                        if (digest)
-                            MD5Update (&mdContext, (unsigned char *) &b, 1);
                         if (skip < 1) {
                             b = bits & 0xff;
                             if (! skip_crs  ||  b != '\r') {
                                 charstring_push_back (decoded_c, b);
                             }
                         if (skip < 1) {
                             b = bits & 0xff;
                             if (! skip_crs  ||  b != '\r') {
                                 charstring_push_back (decoded_c, b);
                             }
-                            if (digest)
-                                MD5Update (&mdContext, (unsigned char *) &b, 1);
                         }
                     }
 
                         }
                     }
 
@@ -339,10 +327,6 @@ test_end:
     *len = charstring_bytes (decoded_c);
     charstring_free (decoded_c);
 
     *len = charstring_bytes (decoded_c);
     charstring_free (decoded_c);
 
-    if (digest) {
-        MD5Final (digest, &mdContext);
-    }
-
     return OK;
 }
 
     return OK;
 }
 
index c5981d0..aea3bdd 100644 (file)
@@ -8,7 +8,7 @@
 int writeBase64aux(FILE *, FILE *, int);
 int writeBase64(const unsigned char *, size_t, unsigned char *);
 int writeBase64raw(const unsigned char *, size_t, unsigned char *);
 int writeBase64aux(FILE *, FILE *, int);
 int writeBase64(const unsigned char *, size_t, unsigned char *);
 int writeBase64raw(const unsigned char *, size_t, unsigned char *);
-int decodeBase64(const char *, unsigned char **, size_t *, int, unsigned char *);
+int decodeBase64(const char *, unsigned char **, size_t *, int);
 void hexify(const unsigned char *, size_t, char **);
 
 /* Includes trailing NUL. */
 void hexify(const unsigned char *, size_t, char **);
 
 /* Includes trailing NUL. */
diff --git a/sbr/md5.c b/sbr/md5.c
deleted file mode 100644 (file)
index 8dbc0b7..0000000
--- a/sbr/md5.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* md5.c -- md5 message digest algorithm
- *          taken from RFC-1321/Appendix A.3
- */
-
-/*
- * MD5C.C -- RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD5 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"
- * without express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#include "h/md5.h"
-
-/* Constants for MD5Transform routine. */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform(UINT4 [4], unsigned char [64]);
-static void Encode(unsigned char *, UINT4 *, unsigned int);
-static void Decode(UINT4 *, unsigned char *, unsigned int);
-
-static unsigned char PADDING[64] = {
-    0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions. */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits. */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation. */
-#define FF(a, b, c, d, x, s, ac) \
-    { \
-        (a) += F((b), (c), (d)) + (x) + (UINT4)(ac); \
-        (a) = ROTATE_LEFT((a), (s)); \
-        (a) += (b); \
-    }
-#define GG(a, b, c, d, x, s, ac) \
-    { \
-        (a) += G((b), (c), (d)) + (x) + (UINT4)(ac); \
-        (a) = ROTATE_LEFT((a), (s)); \
-        (a) += (b); \
-    }
-#define HH(a, b, c, d, x, s, ac) \
-    { \
-        (a) += H((b), (c), (d)) + (x) + (UINT4)(ac); \
-        (a) = ROTATE_LEFT((a), (s)); \
-        (a) += (b); \
-    }
-#define II(a, b, c, d, x, s, ac) \
-    { \
-        (a) += I((b), (c), (d)) + (x) + (UINT4)(ac); \
-        (a) = ROTATE_LEFT((a), (s)); \
-        (a) += (b); \
-    }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context. */
-void
-MD5Init(MD5_CTX *context)
-{
-    context->count[0] = context->count[1] = 0;
-    /* Load magic initialization constants. */
-    context->state[0] = 0x67452301;
-    context->state[1] = 0xefcdab89;
-    context->state[2] = 0x98badcfe;
-    context->state[3] = 0x10325476;
-}
-
-/* MD5 block update operation.  Continues an MD5 message-digest
- * operation, processing another message block, and updating the
- * context. */
-void
-MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
-{
-    unsigned int i, index, partLen;
-
-    /* Compute number of bytes mod 64 */
-    index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
-    /* Update number of bits */
-    if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3))
-        context->count[1]++;
-    context->count[1] += ((UINT4)inputLen >> 29);
-
-    partLen = 64 - index;
-
-    /* Transform as many times as possible. */
-    if (inputLen >= partLen) {
-        memcpy(&context->buffer[index], input, partLen);
-        MD5Transform(context->state, context->buffer);
-
-        for (i = partLen; i + 63 < inputLen; i += 64)
-            MD5Transform(context->state, &input[i]);
-
-        index = 0;
-    } else
-         i = 0;
-
-    /* Buffer remaining input */
-    memcpy(&context->buffer[index], &input[i], inputLen - i);
-}
-
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- * the message digest and zeroizing the context. */
-void
-MD5Final(unsigned char digest[16], MD5_CTX *context)
-{
-    unsigned char bits[8];
-    unsigned int index;
-    unsigned int padLen;
-
-    /* Save number of bits */
-    Encode(bits, context->count, 8);
-
-    /* Pad out to 56 mod 64. */
-    index = (unsigned int)((context->count[0] >> 3) & 0x3f);
-    padLen = (index < 56) ? (56 - index) : (120 - index);
-    MD5Update(context, PADDING, padLen);
-
-    /* Append length (before padding) */
-    MD5Update(context, bits, 8);
-    /* Store state in digest */
-    Encode(digest, context->state, 16);
-
-    /* Zeroize sensitive information. */
-    memset(context, 0, sizeof(*context));
-}
-
-/* MD5 basic transformation.  Transforms state based on block. */
-static void
-MD5Transform(UINT4 state[4], unsigned char block[64])
-{
-    UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
-    Decode(x, block, 64);
-
-    /* Round 1 */
-    FF(a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-    FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-    FF(c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-    FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-    FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-    FF(d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-    FF(c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-    FF(b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-    FF(a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-    FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-    FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-    FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-    FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-    FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-    FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-    FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
-    /* Round 2 */
-    GG(a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-    GG(d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-    GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-    GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-    GG(a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-    GG(d, a, b, c, x[10], S22,  0x2441453); /* 22 */
-    GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-    GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-    GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-    GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-    GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-    GG(b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-    GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-    GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-    GG(c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-    GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
-    /* Round 3 */
-    HH(a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-    HH(d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-    HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-    HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-    HH(a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-    HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-    HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-    HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-    HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-    HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-    HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-    HH(b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
-    HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-    HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-    HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-    HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
-    /* Round 4 */
-    II(a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-    II(d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-    II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-    II(b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-    II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-    II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-    II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-    II(b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-    II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-    II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-    II(c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-    II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-    II(a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-    II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-    II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-    II(b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
-    state[0] += a;
-    state[1] += b;
-    state[2] += c;
-    state[3] += d;
-
-    /* Zeroize sensitive information. */
-    memset(x, 0, sizeof(x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char).  Assumes len is a
- * multiple of 4. */
-static void
-Encode(unsigned char *output, UINT4 *input, unsigned int len)
-{
-    unsigned int i, j;
-
-    for (i = 0, j = 0; j < len; i++, j += 4) {
-        output[j] = (unsigned char)(input[i] & 0xff);
-        output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
-        output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
-        output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
-    }
-}
-
-/* Decodes input (unsigned char) into output (UINT4).  Assumes len is a
- * multiple of 4. */
-static void
-Decode(UINT4 *output, unsigned char *input, unsigned int len)
-{
-    unsigned int i, j;
-
-    for (i = 0, j = 0; j < len; i++, j += 4)
-        output[i] = ((UINT4)input[j]) |
-            (((UINT4)input[j+1]) << 8) |
-            (((UINT4)input[j+2]) << 16) |
-            (((UINT4)input[j+3]) << 24);
-}
index 83d7563..5efc412 100644 (file)
@@ -323,7 +323,7 @@ netsec_b64_snoop_decoder(netsec_context *nsc, const char *string, size_t len,
        len -= offset;
     }
 
        len -= offset;
     }
 
-    if (decodeBase64(string, &decoded, &decodedlen, 1, NULL) == OK) {
+    if (decodeBase64(string, &decoded, &decodedlen, 1) == OK) {
        /*
         * Some mechanisms produce large binary tokens, which aren't really
         * readable.  So let's do a simple heuristic.  If the token is greater
        /*
         * Some mechanisms produce large binary tokens, which aren't really
         * readable.  So let's do a simple heuristic.  If the token is greater
index c97ec39..cebf6e9 100755 (executable)
@@ -148,36 +148,6 @@ MIME-Version: 1.0
 Content-Type: text/plain
 EOF
 
 Content-Type: text/plain
 EOF
 
-#
-# Check an md5'd attachment
-#
-
-cat > "$draft" <<EOF
-To: Mr Test <mrtest@example.com>
-cc:
-Fcc: +outbox
-Subject: Test of digested part
-
-#text/plain; name="textplain" [ - ] ${srcdir}/test/mhbuild/textplain
-
-EOF
-
-mhbuild -check "$draft"
-
-cat > "$expected" <<EOF
-To: Mr Test <mrtest@example.com>
-cc:
-Fcc: +outbox
-Subject: Test of digested part
-MIME-Version: 1.0
-Content-Type: text/plain; name="textplain"; charset="us-ascii"
-Content-Description:  - 
-Content-MD5: x3hNJn10cGowZv+ILUkycw==
-Content-Transfer-Encoding: quoted-printable
-
-This is a text/plain part.
-EOF
-
 check "$draft" "$expected"
 
 #
 check "$draft" "$expected"
 
 #
index 42d2f43..ad459b7 100755 (executable)
@@ -169,28 +169,6 @@ run_test 'mhlist last -part 4 -noheader -norealsize -realsize' \
      1     multipart/related          180
      4     text/plain                  36'
 
      1     multipart/related          180
      4     text/plain                  36'
 
-start_test '-check'
-run_test 'mhlist last -part 2 -noheader -check' \
-'  11       multipart/mixed            936
-     1     multipart/related          180
-     2     text/plain                  36'
-
-start_test '-check with bad MD5 checksum'
-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            936
-     1     multipart/related          180
-     2     text/plain                  36
-mhlist: content integrity suspect (digest mismatch) -- continuing
-    (content text/plain in message 11, part 2)'
-
-start_test '-nocheck, the default'
-run_test 'mhlist last -part 2 -noheader -check -nocheck' \
-'  11       multipart/mixed            936
-     1     multipart/related          180
-     2     text/plain                  36'
-
 #
 # Set the cur sequence to 1 to test default behavior of changecur after
 # this test.
 #
 # Set the cur sequence to 1 to test default behavior of changecur after
 # this test.
index e886618..b53b01f 100755 (executable)
@@ -214,43 +214,11 @@ run_test 'mhstore last -part 1.1 -auto' \
   'storing message 11 part 1.1 as file test1.txt'
 check "$expected" test1.txt
 
   'storing message 11 part 1.1 as file test1.txt'
 check "$expected" test1.txt
 
-# check -check
-start_test '-check'
+# check -outfile - with -file
+start_test '-outfile - with -file'
 cat >"$expected" <<'EOF'
 This is the second text/plain part.
 EOF
 cat >"$expected" <<'EOF'
 This is the second text/plain part.
 EOF
-run_test 'mhstore last -part 2 -check' \
-         'storing message 11 part 2 as file 11.2.txt'
-check "$expected" 11.2.txt 'keep first'
-
-# check with -check on base64 encoded part
-start_test 'with -check on base64 encoded part'
-cat >"$expected2" <<'EOF'
-This is the fourth text/plain part.
-This test has multiple lines.
-EOF
-run_test 'mhstore last -part 4 -check' \
-         'storing message 11 part 4 as file 11.4.txt'
-check "$expected2" 11.4.txt
-
-# check -check with bad MD5 checksum
-start_test '-check with bad MD5 checksum'
-sed 's/\(Content-MD5: \)kq+Hnc/\1BADBAD/' "$msgfile" >"$MH_TEST_DIR/$$.tmp"
-mv -f "$MH_TEST_DIR/$$.tmp" "$msgfile"
-run_test 'mhstore last -part 2 -check' \
-'storing message 11 part 2 as file 11.2.txt
-mhstore: content integrity suspect (digest mismatch) -- continuing
-    (content text/plain in message 11, part 2)'
-check "$expected" 11.2.txt 'keep first'
-
-# check -nocheck, the default
-start_test '-nocheck, the default'
-run_test 'mhstore last -part 2 -check -nocheck' \
-         'storing message 11 part 2 as file 11.2.txt'
-check "$expected" 11.2.txt 'keep first'
-
-# check -outfile - with -file
-start_test '-outfile - with -file'
 run_prog mhstore -noverbose -file `mhpath 11` -part 2 -outfile - >"$actual" 2>&1
 check "$expected" "$actual"
 
 run_prog mhstore -noverbose -file `mhpath 11` -part 2 -outfile - >"$actual" 2>&1
 check "$expected" "$actual"
 
index 9009159..8a73f08 100644 (file)
@@ -649,7 +649,7 @@ imap_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
            *outdata = NULL;
            *outdatalen = 0;
        } else {
            *outdata = NULL;
            *outdatalen = 0;
        } else {
-           rc = decodeBase64(line + 2, outdata, &len, 0, NULL);
+           rc = decodeBase64(line + 2, outdata, &len, 0);
            *outdatalen = len;
            if (rc != OK) {
                netsec_err(errstr, "Unable to decode base64 response");
            *outdatalen = len;
            if (rc != OK) {
                netsec_err(errstr, "Unable to decode base64 response");
index 1ef8421..59ca2ec 100644 (file)
@@ -17,7 +17,6 @@
 #include "sbr/print_help.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "sbr/print_help.h"
 #include "sbr/error.h"
 #include <fcntl.h>
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
@@ -33,8 +32,8 @@
 #define MHBUILD_SWITCHES \
     X("auto", 0, AUTOSW) \
     X("noauto", 0, NAUTOSW) \
 #define MHBUILD_SWITCHES \
     X("auto", 0, AUTOSW) \
     X("noauto", 0, NAUTOSW) \
-    X("check", 0, CHECKSW) \
-    X("nocheck", 0, NCHECKSW) \
+    X("check", -5, CHECKSW) \
+    X("nocheck", -7, NCHECKSW) \
     X("directives", 0, DIRECTIVES) \
     X("nodirectives", 0, NDIRECTIVES) \
     X("headers", 0, HEADSW) \
     X("directives", 0, DIRECTIVES) \
     X("nodirectives", 0, NDIRECTIVES) \
     X("headers", 0, HEADSW) \
@@ -181,10 +180,8 @@ main (int argc, char **argv)
                continue;
 
            case CHECKSW:
                continue;
 
            case CHECKSW:
-               checksw++;
-               continue;
            case NCHECKSW:
            case NCHECKSW:
-               checksw = 0;
+               /* Currently a NOP */
                continue;
 
            case HEADSW:
                continue;
 
            case HEADSW:
index c7b969c..cee0ee5 100644 (file)
@@ -35,7 +35,6 @@
 #include "sbr/path.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "sbr/path.h"
 #include "sbr/error.h"
 #include <fcntl.h>
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
@@ -95,7 +94,6 @@ static void set_id (CT, int);
 static int compose_content (CT, int);
 static int scan_content (CT, size_t);
 static int build_headers (CT, int);
 static int compose_content (CT, int);
 static int scan_content (CT, size_t);
 static int build_headers (CT, int);
-static char *calculate_digest (CT, int);
 static int extract_headers (CT, char *, FILE **);
 
 
 static int extract_headers (CT, char *, FILE **);
 
 
@@ -1607,7 +1605,7 @@ scan_content (CT ct, size_t maxunencoded)
     if (ct->c_reqencoding != CE_UNKNOWN)
        ct->c_encoding = ct->c_reqencoding;
     else {
     if (ct->c_reqencoding != CE_UNKNOWN)
        ct->c_encoding = ct->c_reqencoding;
     else {
-       int wants_q_p = (containsnul || linelen || linespace || checksw);
+       int wants_q_p = (containsnul || linelen || linespace);
 
        switch (ct->c_type) {
        case CT_TEXT:
 
        switch (ct->c_type) {
        case CT_TEXT:
@@ -1782,15 +1780,6 @@ skip_headers:
     if (ct->c_ctexbody)
        return OK;
 
     if (ct->c_ctexbody)
        return OK;
 
-    /*
-     * output the Content-MD5
-     */
-    if (checksw) {
-       np = mh_xstrdup(MD5_FIELD);
-        vp = calculate_digest (ct, ct->c_encoding == CE_QUOTED);
-       add_header (ct, np, vp);
-    }
-
     /*
      * output the Content-Transfer-Encoding
      * If using EAI and message body is 7-bit, force 8-bit C-T-E.
     /*
      * output the Content-Transfer-Encoding
      * If using EAI and message body is 7-bit, force 8-bit C-T-E.
@@ -1879,101 +1868,6 @@ skip_headers:
 }
 
 
 }
 
 
-static char nib2b64[0x40+1] =
-       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-static char *
-calculate_digest (CT ct, int asciiP)
-{
-    int        cc;
-    char *vp, *op;
-    unsigned char *dp;
-    unsigned char digest[16];
-    unsigned char outbuf[25];
-    MD5_CTX mdContext;
-    CE ce = &ct->c_cefile;
-    char *infilename = ce->ce_file ? ce->ce_file : ct->c_file;
-    FILE *in;
-
-    /* open content */
-    if ((in = fopen (infilename, "r")) == NULL)
-       adios (infilename, "unable to open for reading");
-
-    /* Initialize md5 context */
-    MD5Init (&mdContext);
-
-    /* calculate md5 message digest */
-    if (asciiP) {
-       char *bufp = NULL;
-       size_t buflen;
-       ssize_t gotlen;
-       while ((gotlen = getline(&bufp, &buflen, in)) != -1) {
-           char c, *cp;
-
-           cp = bufp + gotlen - 1;
-           if ((c = *cp) == '\n')
-               gotlen--;
-
-           MD5Update (&mdContext, (unsigned char *) bufp,
-                      (unsigned int) gotlen);
-
-           if (c == '\n')
-               MD5Update (&mdContext, (unsigned char *) "\r\n", 2);
-       }
-    } else {
-       char buffer[BUFSIZ];
-       while ((cc = fread (buffer, sizeof(*buffer), sizeof(buffer), in)) > 0)
-           MD5Update (&mdContext, (unsigned char *) buffer, (unsigned int) cc);
-    }
-
-    /* md5 finalization.  Write digest and zero md5 context */
-    MD5Final (digest, &mdContext);
-
-    /* close content */
-    fclose (in);
-
-    /* print debugging info */
-    if (debugsw) {
-       unsigned char *ep;
-
-       fprintf (stderr, "MD5 digest=");
-       for (ep = (dp = digest) + sizeof digest;
-                dp < ep; dp++)
-           fprintf (stderr, "%02x", *dp & 0xff);
-       fprintf (stderr, "\n");
-    }
-
-    /* encode the digest using base64 */
-    for (dp = digest, op = (char *) outbuf,
-                               cc = sizeof digest;
-               cc > 0; cc -= 3, op += 4) {
-       unsigned long bits;
-       char *bp;
-
-       bits = (*dp++ & 0xff) << 16;
-       if (cc > 1) {
-           bits |= (*dp++ & 0xff) << 8;
-           if (cc > 2)
-               bits |= *dp++ & 0xff;
-       }
-
-       for (bp = op + 4; bp > op; bits >>= 6)
-           *--bp = nib2b64[bits & 0x3f];
-       if (cc < 3) {
-           *(op + 3) = '=';
-           if (cc < 2)
-               *(op + 2) = '=';
-       }
-    }
-
-    /* null terminate string */
-    outbuf[24] = '\0';
-
-    /* now make copy and return string */
-    vp = concat (" ", outbuf, "\n", NULL);
-    return vp;
-}
-
 /*
  * Set things up for the content structure for file "filename" that
  * we want to attach
 /*
  * Set things up for the content structure for file "filename" that
  * we want to attach
index 942c3f0..498efe2 100644 (file)
@@ -12,7 +12,6 @@
 #include "sbr/trimcpy.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "sbr/trimcpy.h"
 #include "sbr/error.h"
 #include <fcntl.h>
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
index b3bba8b..c5b2fe8 100644 (file)
@@ -26,7 +26,6 @@
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
@@ -39,8 +38,8 @@
 #include "mhfree.h"
 
 #define MHLIST_SWITCHES \
 #include "mhfree.h"
 
 #define MHLIST_SWITCHES \
-    X("check", 0, CHECKSW) \
-    X("nocheck", 0, NCHECKSW) \
+    X("check", -5, CHECKSW) \
+    X("nocheck", -7, NCHECKSW) \
     X("headers", 0, HEADSW) \
     X("noheaders", 0, NHEADSW) \
     X("realsize", 0, SIZESW) \
     X("headers", 0, HEADSW) \
     X("noheaders", 0, NHEADSW) \
     X("realsize", 0, SIZESW) \
@@ -148,10 +147,8 @@ do_cache:
                continue;
 
            case CHECKSW:
                continue;
 
            case CHECKSW:
-               checksw++;
-               continue;
            case NCHECKSW:
            case NCHECKSW:
-               checksw = 0;
+               /* Currently a NOP */
                continue;
 
            case HEADSW:
                continue;
 
            case HEADSW:
index 6973a5d..7d2abb3 100644 (file)
--- a/uip/mhn.c
+++ b/uip/mhn.c
@@ -27,7 +27,6 @@
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
@@ -46,8 +45,8 @@
     X("noauto", 0, NAUTOSW) \
     X("cache", 0, CACHESW) \
     X("nocache", 0, NCACHESW) \
     X("noauto", 0, NAUTOSW) \
     X("cache", 0, CACHESW) \
     X("nocache", 0, NCACHESW) \
-    X("check", 0, CHECKSW) \
-    X("nocheck", 0, NCHECKSW) \
+    X("check", -5, CHECKSW) \
+    X("nocheck", -7, NCHECKSW) \
     X("headers", 0, HEADSW) \
     X("noheaders", 0, NHEADSW) \
     X("list", 0, LISTSW) \
     X("headers", 0, HEADSW) \
     X("noheaders", 0, NHEADSW) \
     X("list", 0, LISTSW) \
@@ -200,10 +199,8 @@ do_cache:
                continue;
 
            case CHECKSW:
                continue;
 
            case CHECKSW:
-               checksw++;
-               continue;
            case NCHECKSW:
            case NCHECKSW:
-               checksw = 0;
+               /* Currently a NOP */
                continue;
 
            case HEADSW:
                continue;
 
            case HEADSW:
index a69dade..c69c7b4 100644 (file)
@@ -11,7 +11,6 @@
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/utils.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/utils.h"
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
index c1eec40..74ec577 100644 (file)
@@ -21,7 +21,6 @@
 #include "sbr/arglist.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "sbr/arglist.h"
 #include "sbr/error.h"
 #include <fcntl.h>
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
@@ -39,8 +38,6 @@
 
 extern int debugsw;
 
 
 extern int debugsw;
 
-int checksw = 0;       /* check Content-MD5 field */
-
 /*
  * These are for mhfixmsg to:
  * 1) Instruct parser not to detect invalid Content-Transfer-Encoding
 /*
  * These are for mhfixmsg to:
  * 1) Instruct parser not to detect invalid Content-Transfer-Encoding
@@ -148,7 +145,6 @@ static int InitFTP (CT);
 static int openFTP (CT, char **);
 static int InitMail (CT);
 static int openMail (CT, char **);
 static int openFTP (CT, char **);
 static int InitMail (CT);
 static int openMail (CT, char **);
-static int readDigest (CT, char *);
 static int get_leftover_mp_content (CT, int);
 static int InitURL (CT);
 static int openURL (CT, char **);
 static int get_leftover_mp_content (CT, int);
 static int InitURL (CT);
 static int openURL (CT, char **);
@@ -509,46 +505,6 @@ get_content (FILE *in, char *file, int toplevel)
            if (s2i->si_init && (*s2i->si_init) (ct) == NOTOK)
                goto out;
        }
            if (s2i->si_init && (*s2i->si_init) (ct) == NOTOK)
                goto out;
        }
-       else if (!strcasecmp (hp->name, MD5_FIELD)) {
-       /* Get Content-MD5 field */
-           char *cp, *dp, *ep;
-
-           if (!checksw)
-               goto next_header;
-
-           if (ct->c_digested) {
-               inform("message %s has multiple %s: fields",
-                       ct->c_file, MD5_FIELD);
-               goto next_header;
-           }
-
-           ep = cp = mh_xstrdup(FENDNULL(hp->value)); /* get a copy */
-
-           while (isspace ((unsigned char) *cp))
-               cp++;
-           for (dp = strchr(cp, '\n'); dp; dp = strchr(dp, '\n'))
-               *dp++ = ' ';
-           for (dp = cp + strlen (cp) - 1; dp >= cp; dp--)
-               if (!isspace ((unsigned char) *dp))
-                   break;
-           *++dp = '\0';
-           if (debugsw)
-               fprintf (stderr, "%s: %s\n", MD5_FIELD, cp);
-
-           if (*cp == '('  &&
-                get_comment (ct->c_file, MD5_FIELD, &cp, NULL) == NOTOK) {
-               free (ep);
-               goto out;
-           }
-
-           for (dp = cp; *dp && !isspace ((unsigned char) *dp); dp++)
-               continue;
-           *dp = '\0';
-
-           readDigest (ct, cp);
-           free (ep);
-           ct->c_digested++;
-       }
        else if (!strcasecmp (hp->name, ID_FIELD)) {
        /* Get Content-ID field */
            ct->c_id = add (hp->value, ct->c_id);
        else if (!strcasecmp (hp->name, ID_FIELD)) {
        /* Get Content-ID field */
            ct->c_id = add (hp->value, ct->c_id);
@@ -1768,7 +1724,6 @@ openBase64 (CT ct, char **file)
     CE ce = &ct->c_cefile;
     unsigned char *decoded;
     size_t decoded_len;
     CE ce = &ct->c_cefile;
     unsigned char *decoded;
     size_t decoded_len;
-    unsigned char digest[16];
 
     if (ce->ce_fp) {
        fseek (ce->ce_fp, 0L, SEEK_SET);
 
     if (ce->ce_fp) {
        fseek (ce->ce_fp, 0L, SEEK_SET);
@@ -1852,8 +1807,8 @@ openBase64 (CT ct, char **file)
     /* decodeBase64() requires null-terminated input. */
     *cp = '\0';
 
     /* decodeBase64() requires null-terminated input. */
     *cp = '\0';
 
-    if (decodeBase64 (buffer, &decoded, &decoded_len, ct->c_type == CT_TEXT,
-                      ct->c_digested ? digest : NULL) != OK)
+    if (decodeBase64 (buffer, &decoded, &decoded_len,
+                     ct->c_type == CT_TEXT) != OK)
         goto clean_up;
 
     {
         goto clean_up;
 
     {
@@ -1867,18 +1822,6 @@ openBase64 (CT ct, char **file)
             content_error (ce->ce_file, ct, "error writing to");
             goto clean_up;
         }
             content_error (ce->ce_file, ct, "error writing to");
             goto clean_up;
         }
-
-        if (ct->c_digested) {
-            if (memcmp(digest, ct->c_digest,
-                       sizeof digest)) {
-                content_error (NULL, ct,
-                               "content integrity suspect (digest mismatch) -- continuing");
-            } else {
-                if (debugsw) {
-                    fprintf (stderr, "content integrity confirmed\n");
-                }
-            }
-        }
     }
 
     fseek (ct->c_fp, 0L, SEEK_SET);
     }
 
     fseek (ct->c_fp, 0L, SEEK_SET);
@@ -1944,7 +1887,7 @@ InitQuoted (CT ct)
 static int
 openQuoted (CT ct, char **file)
 {
 static int
 openQuoted (CT ct, char **file)
 {
-    int        cc, digested, len, quoted;
+    int        cc, len, quoted;
     bool own_ct_fp = false;
     char *cp, *ep;
     char *bufp = NULL;
     bool own_ct_fp = false;
     char *cp, *ep;
     char *bufp = NULL;
@@ -1954,7 +1897,6 @@ openQuoted (CT ct, char **file)
     CE ce = &ct->c_cefile;
     /* sbeck -- handle suffixes */
     CI ci;
     CE ce = &ct->c_cefile;
     /* sbeck -- handle suffixes */
     CI ci;
-    MD5_CTX mdContext;
 
     if (ce->ce_fp) {
        fseek (ce->ce_fp, 0L, SEEK_SET);
 
     if (ce->ce_fp) {
        fseek (ce->ce_fp, 0L, SEEK_SET);
@@ -2013,9 +1955,6 @@ openQuoted (CT ct, char **file)
        own_ct_fp = true;
     }
 
        own_ct_fp = true;
     }
 
-    if ((digested = ct->c_digested))
-       MD5Init (&mdContext);
-
     quoted = 0;
 
     fseek (ct->c_fp, ct->c_begin, SEEK_SET);
     quoted = 0;
 
     fseek (ct->c_fp, ct->c_begin, SEEK_SET);
@@ -2048,8 +1987,6 @@ openQuoted (CT ct, char **file)
                    mask <<= 4;
                    mask |= hex2nib[((unsigned char) *cp) & 0x7f];
                    putc (mask, ce->ce_fp);
                    mask <<= 4;
                    mask |= hex2nib[((unsigned char) *cp) & 0x7f];
                    putc (mask, ce->ce_fp);
-                   if (digested)
-                       MD5Update (&mdContext, &mask, 1);
                    if (ferror (ce->ce_fp)) {
                        content_error (ce->ce_file, ct, "error writing to");
                        goto clean_up;
                    if (ferror (ce->ce_fp)) {
                        content_error (ce->ce_file, ct, "error writing to");
                        goto clean_up;
@@ -2087,13 +2024,6 @@ openQuoted (CT ct, char **file)
 
            /* Just show the raw byte. */
            putc (*cp, ce->ce_fp);
 
            /* Just show the raw byte. */
            putc (*cp, ce->ce_fp);
-           if (digested) {
-               if (*cp == '\n') {
-                   MD5Update (&mdContext, (unsigned char *) "\r\n",2);
-               } else {
-                   MD5Update (&mdContext, (unsigned char *) cp, 1);
-               }
-           }
            if (ferror (ce->ce_fp)) {
                content_error (ce->ce_file, ct, "error writing to");
                goto clean_up;
            if (ferror (ce->ce_fp)) {
                content_error (ce->ce_file, ct, "error writing to");
                goto clean_up;
@@ -2113,18 +2043,6 @@ openQuoted (CT ct, char **file)
        goto clean_up;
     }
 
        goto clean_up;
     }
 
-    if (digested) {
-       unsigned char digest[16];
-
-       MD5Final (digest, &mdContext);
-       if (memcmp(digest, ct->c_digest,
-                  sizeof digest))
-           content_error (NULL, ct,
-                          "content integrity suspect (digest mismatch) -- continuing");
-       else if (debugsw)
-            fprintf (stderr, "content integrity confirmed\n");
-    }
-
     fseek (ce->ce_fp, 0L, SEEK_SET);
 
 ready_to_go:
     fseek (ce->ce_fp, 0L, SEEK_SET);
 
 ready_to_go:
@@ -2910,46 +2828,6 @@ openURL (CT ct, char **file)
 }
 
 
 }
 
 
-/*
- * Stores MD5 digest (in cp, from Content-MD5 header) in ct->c_digest.  It
- * has to be base64 decoded.
- */
-static int
-readDigest (CT ct, char *cp)
-{
-    unsigned char *digest;
-
-    size_t len;
-    if (decodeBase64 (cp, &digest, &len, 0, NULL) == OK) {
-        const size_t maxlen = sizeof ct->c_digest;
-
-        if (strlen ((char *) digest) <= maxlen) {
-            memcpy (ct->c_digest, digest, maxlen);
-
-            if (debugsw) {
-                size_t i;
-
-                fprintf (stderr, "MD5 digest=");
-                for (i = 0; i < maxlen; ++i) {
-                    fprintf (stderr, "%02x", ct->c_digest[i] & 0xff);
-                }
-                fprintf (stderr, "\n");
-            }
-
-            return OK;
-        }
-        if (debugsw) {
-            fprintf (stderr, "invalid MD5 digest (got %d octets)\n",
-                     (int) strlen ((char *) digest));
-        }
-
-        return NOTOK;
-    }
-
-    return NOTOK;
-}
-
-
 /* Multipart parts might have content before the first subpart and/or
    after the last subpart that hasn't been stored anywhere else, so do
    that. */
 /* Multipart parts might have content before the first subpart and/or
    after the last subpart that hasn't been stored anywhere else, so do
    that. */
index 66d2366..6009fdc 100644 (file)
@@ -28,7 +28,6 @@
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
@@ -160,10 +159,8 @@ do_cache:
                continue;
 
            case CHECKSW:
                continue;
 
            case CHECKSW:
-               checksw++;
-               continue;
            case NCHECKSW:
            case NCHECKSW:
-               checksw = 0;
+               /* Currently a NOP */
                continue;
 
            case CONCATSW:
                continue;
 
            case CONCATSW:
index 17ef4d2..9cd6733 100644 (file)
@@ -17,7 +17,6 @@
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
index 9cbdc69..6ea99f3 100644 (file)
@@ -27,7 +27,6 @@
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "h/signals.h"
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
@@ -42,8 +41,8 @@
 #define MHSTORE_SWITCHES \
     X("auto", 0, AUTOSW) \
     X("noauto", 0, NAUTOSW) \
 #define MHSTORE_SWITCHES \
     X("auto", 0, AUTOSW) \
     X("noauto", 0, NAUTOSW) \
-    X("check", 0, CHECKSW) \
-    X("nocheck", 0, NCHECKSW) \
+    X("check", -5, CHECKSW) \
+    X("nocheck", -7, NCHECKSW) \
     X("verbose", 0, VERBSW) \
     X("noverbose", 0, NVERBSW) \
     X("file file", 0, FILESW)          /* interface from show */ \
     X("verbose", 0, VERBSW) \
     X("noverbose", 0, NVERBSW) \
     X("file file", 0, FILESW)          /* interface from show */ \
@@ -153,10 +152,8 @@ do_cache:
                continue;
 
            case CHECKSW:
                continue;
 
            case CHECKSW:
-               checksw++;
-               continue;
            case NCHECKSW:
            case NCHECKSW:
-               checksw = 0;
+               /* Currently a NOP */
                continue;
 
            case PARTSW:
                continue;
 
            case PARTSW:
index d9091a8..3f92e49 100644 (file)
@@ -20,7 +20,6 @@
 #include "sbr/path.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "sbr/path.h"
 #include "sbr/error.h"
 #include <fcntl.h>
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/fmt_scan.h"
index 237e80c..d61ce76 100644 (file)
@@ -454,7 +454,7 @@ pop_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
            *outdata = NULL;
            *outdatalen = 0;
        } else {
            *outdata = NULL;
            *outdatalen = 0;
        } else {
-           rc = decodeBase64(line + 2, outdata, &len, 0, NULL);
+           rc = decodeBase64(line + 2, outdata, &len, 0);
            *outdatalen = len;
            if (rc != OK) {
                netsec_err(errstr, "Unable to decode base64 response");
            *outdatalen = len;
            if (rc != OK) {
                netsec_err(errstr, "Unable to decode base64 response");
index 7ec3808..cd08e09 100644 (file)
@@ -18,7 +18,6 @@
 #include "sbr/arglist.h"
 #include "sbr/error.h"
 #include <fcntl.h>
 #include "sbr/arglist.h"
 #include "sbr/error.h"
 #include <fcntl.h>
-#include "h/md5.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mts.h"
 #include "h/tws.h"
 #include "h/mime.h"