1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
|
#!/bin/sh
#
# Test bogus and strange headers
. "$MH_TEST_COMMON"
expected=$MH_TEST_DIR/$$.expected
# Write message with bogus header field (missing blank line, really).
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Sun, 18 Dec 2005 00:52:39 +0100
From: foo@example.edu
To: bar@example.edu
Subject: test
This is a multi-part message in MIME format.
I am a stupid spammer.
!
runandcheck "scan $msgnum" <<!
??Format error (message $msgnum) in component 5
$msgnum 2005-12-18 00:52 foo@example.edu test
!
runandcheck "show $msgnum" <<!
show: message format error in component #5
mhl: format error in message 11
part text/plain 23
I am a stupid spammer.
!
# check m_getfld() handling of empty header field
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
printf 'Date: Sat, 12 Jan 2013 09:07:01 -0600\nReceived:' >"$msgfile"
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-12 09:07
!
# check m_getfld() handling of excessively long header field name
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Tue, 15 Jan 2013 21:13:12 -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 2
$msgnum 2013-01-15 21:13
!
# check m_getfld() handling of header field name with whitespace
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:33:46 -0600
A header field name with whitespace: foo
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-17 19:33 Will this be printed?
!
# check m_getfld() handling of header field name without a colon
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:34:46 -0600
A_header_field_name_without_a_colon_..._or_is_this_the_first_line_of_the_body_question-mark
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-17 19:34 Will this be printed?
!
# check m_getfld() handling of empty field name
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:35:46 -0600
: foo
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-17 19:35 Will this be printed?
!
# check m_getfld() handling of dashed body separator (as in drafts)
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:36:46 -0600
----------
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
$msgnum 2013-01-17 19:36
!
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:37:46 -0600
-
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
$msgnum 2013-01-17 19:37
!
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:39:46 -0600
-----foo
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-17 19:39 Will this be printed?
!
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:40:46 -0600
-foo
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-17 19:40 Will this be printed?
!
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:41:46 -0600
--- --- ---
Subject: Will this be printed?
Test
!
runandcheck "scan l" <<!
??Format error (message $msgnum) in component 2
$msgnum 2013-01-17 19:41 Will this be printed?
!
# valid headers that might be treated as body separators but should not
msgfile="`mhpath b`"
msgnum="${msgfile##*/}"
cat >"$msgfile" <<!
Date: Thu, 17 Jan 2013 19:42:46 -0600
-: strange but valid header name
-------: also a valid header name
-dash: nothing special if it start with a dash
-------dash: or with many dashes
-..|.-|...|....: could even be morse code ;-)
sort</etc/passwd|lp&&date: ... o ar command lins *eek*
Subject: This will be printed!
Test
!
runandcheck "scan l" <<!
$msgnum 2013-01-17 19:42 This will be printed!
!
|