3 # Test bogus and strange headers
8 expected=$MH_TEST_DIR/$$.expected
10 # Write message with bogus header field (missing blank line, really).
13 msgnum="${msgfile##*/}"
15 Date: Sun, 18 Dec 2005 00:52:39 +0100
19 This is a multi-part message in MIME format.
21 I am a stupid spammer.
24 runandcheck "scan $msgnum" <<!
25 ??Format error (message $msgnum) in component 5
26 $msgnum 2005-12-18 00:52 foo@example.edu test
29 runandcheck "show $msgnum" <<!
30 show: message format error in component #5
31 mhl: format error in message 11
33 I am a stupid spammer.
38 # check m_getfld() handling of empty header field
41 msgnum="${msgfile##*/}"
42 printf 'Date: Sat, 12 Jan 2013 09:07:01 -0600\nReceived:' >"$msgfile"
44 runandcheck "scan l" <<!
45 ??Format error (message $msgnum) in component 2
46 $msgnum 2013-01-12 09:07
51 # check m_getfld() handling of excessively long header field name
54 msgnum="${msgfile##*/}"
56 Date: Tue, 15 Jan 2013 21:13:12 -0600
57 ThisHeaderFieldNameIsWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayTooLong: OK
60 runandcheck "scan l" <<!
61 ??Format error (message $msgnum) in component 2
62 $msgnum 2013-01-15 21:13
67 # check m_getfld() handling of header field name with whitespace
70 msgnum="${msgfile##*/}"
72 Date: Thu, 17 Jan 2013 19:33:46 -0600
73 A header field name with whitespace: foo
74 Subject: Will this be printed?
80 runandcheck "scan l" <<!
81 ??Format error (message $msgnum) in component 2
82 $msgnum 2013-01-17 19:33 Will this be printed?
87 # check m_getfld() handling of header field name without a colon
90 msgnum="${msgfile##*/}"
92 Date: Thu, 17 Jan 2013 19:34:46 -0600
93 A_header_field_name_without_a_colon_..._or_is_this_the_first_line_of_the_body_question-mark
94 Subject: Will this be printed?
100 runandcheck "scan l" <<!
101 ??Format error (message $msgnum) in component 2
102 $msgnum 2013-01-17 19:34 Will this be printed?
107 # check m_getfld() handling of empty field name
110 msgnum="${msgfile##*/}"
112 Date: Thu, 17 Jan 2013 19:35:46 -0600
114 Subject: Will this be printed?
120 runandcheck "scan l" <<!
121 ??Format error (message $msgnum) in component 2
122 $msgnum 2013-01-17 19:35 Will this be printed?
128 # check m_getfld() handling of dashed body separator (as in drafts)
131 msgnum="${msgfile##*/}"
133 Date: Thu, 17 Jan 2013 19:36:46 -0600
135 Subject: Will this be printed?
141 runandcheck "scan l" <<!
142 $msgnum 2013-01-17 19:36
147 msgnum="${msgfile##*/}"
149 Date: Thu, 17 Jan 2013 19:37:46 -0600
151 Subject: Will this be printed?
157 runandcheck "scan l" <<!
158 $msgnum 2013-01-17 19:37
163 msgnum="${msgfile##*/}"
165 Date: Thu, 17 Jan 2013 19:39:46 -0600
167 Subject: Will this be printed?
173 runandcheck "scan l" <<!
174 ??Format error (message $msgnum) in component 2
175 $msgnum 2013-01-17 19:39 Will this be printed?
180 msgnum="${msgfile##*/}"
182 Date: Thu, 17 Jan 2013 19:40:46 -0600
184 Subject: Will this be printed?
190 runandcheck "scan l" <<!
191 ??Format error (message $msgnum) in component 2
192 $msgnum 2013-01-17 19:40 Will this be printed?
197 msgnum="${msgfile##*/}"
199 Date: Thu, 17 Jan 2013 19:41:46 -0600
201 Subject: Will this be printed?
207 runandcheck "scan l" <<!
208 ??Format error (message $msgnum) in component 2
209 $msgnum 2013-01-17 19:41 Will this be printed?
213 # valid headers that might be treated as body separators but should not
216 msgnum="${msgfile##*/}"
218 Date: Thu, 17 Jan 2013 19:42:46 -0600
219 -: strange but valid header name
220 -------: also a valid header name
221 -dash: nothing special if it start with a dash
222 -------dash: or with many dashes
223 -..|.-|...|....: could even be morse code ;-)
224 sort</etc/passwd|lp&&date: ... o ar command lins *eek*
225 Subject: This will be printed!
231 runandcheck "scan l" <<!
232 $msgnum 2013-01-17 19:42 This will be printed!