Debian Codegraph @

src/tests/t.rfc2047_broken

raw
1 #! /bin/sh
2
3 . ${srcdir:=.}/t.frame
4
5 # Test #1: checks if improperly folded encoded words are decoded
6 # without crash.
7 # test case supplied by Clint Adams, Debian.
8
9 # Test #2: checks if improperly terminated encoded words causes
10 # improper processing of the mime parts.
11 # Test case 2 supplied by Evgeny Kotsuba.
12
13 # NOTE #####
14 # Test case 2 is currently disabled because we don't want to
15 # provide the same output for broken encoded words as for conformant
16 # ones, so we can tell broken mailers from intact.
17
18 ##### Test #1 - improper folding #####
19 cat > "$TMPDIR/input.1" <<_EOF
20 Subject: [Broken] =?ISO-8859-1?Q?Re=3A_=5BBroken=5D_=3D=3FISO-8859-1=3FQ=3F=3D5B?=
21 =?ISO-8859-1?Q?Broken=3D5DBlah=3D20Foo=3DE4=3D20Bar=3D20Blah
22 _?= =?ISO-8859-1?Q?Foo=3D3D28=3D5F=3F=3D_Bar=5F=5F=3F=3D_t=E4Blah?=
23 =?ISO-8859-1?Q?Foo=E4t=29?=
24
25 Hello.
26 _EOF
27
28 $BOGOLEXER -p -C < "$TMPDIR"/input.1 > "$TMPDIR/output.1"
29
30 exit $?
31
32 ##### Test #2a - improperly terminated encoded word #####
33
34 cat > "$TMPDIR/input.2a" <<_EOF
35 Return-Path: <[email protected]>
36 Content-Type: multipart/mixed; boundary="--ek-1129"
37
38 ----ek-1129
39 Content-Type: application/x-zip-compressed; name="filename.txt"
40 Content-Disposition: attachment; filename="=?Windows-1251?B?Z29v?=
41 =?Windows-1251?B?5fTu"
42 Content-Transfer-Encoding: base64
43
44 UEsDBBQAAgAIADyWpzC0Mjdx9ksFAADEBQBJAAAAZ29vLTAwMWQwMDAwLTAxLYegrKXnoK2o
45 7yCvriCv4K7iruKor+Mg4qWrpeSuraAgR09PLTAwMSCu4iAyMDA0LTA1LTA3LmRvY+xZC1gT
46
47 ----ek-1129--
48
49 _EOF
50
51 $BOGOLEXER -p -C < "$TMPDIR"/input.2a > "$TMPDIR/output.2a"
52
53 ##### Test #2b - properly terminated encoded word #####
54
55 cat > "$TMPDIR/input.2b" <<_EOF
56 Return-Path: <[email protected]>
57 Content-Type: multipart/mixed; boundary="--ek-1129"
58
59 ----ek-1129
60 Content-Type: application/x-zip-compressed; name="filename.txt"
61 Content-Disposition: attachment; filename="=?Windows-1251?B?Z29v?=
62 =?Windows-1251?B?5fTu?="
63 Content-Transfer-Encoding: base64
64
65 UEsDBBQAAgAIADyWpzC0Mjdx9ksFAADEBQBJAAAAZ29vLTAwMWQwMDAwLTAxLYegrKXnoK2o
66 7yCvriCv4K7iruKor+Mg4qWrpeSuraAgR09PLTAwMSCu4iAyMDA0LTA1LTA3LmRvY+xZC1gT
67
68 ----ek-1129--
69
70 _EOF
71
72 $BOGOLEXER -p -C < "$TMPDIR"/input.2b > "$TMPDIR/output.2b"
73
74 diff "$TMPDIR/output.2a" "$TMPDIR/output.2b"