Commit | Line | Data |
---|---|---|
8523533c TK |
1 | /************************************************* |
2 | * Exim - an Internet mail transport agent * | |
3 | *************************************************/ | |
4 | ||
5 | /* Copyright (c) Tom Kistner <tom@duncanthrax.net> 2004 */ | |
6 | /* License: GPL */ | |
7 | ||
8 | #ifdef WITH_CONTENT_SCAN | |
9 | ||
10 | #define MIME_MAX_HEADER_SIZE 8192 | |
11 | #define MIME_MAX_LINE_LENGTH 32768 | |
12 | ||
13 | #define MBC_ATTACHMENT 0 | |
14 | #define MBC_COVERLETTER_ONESHOT 1 | |
15 | #define MBC_COVERLETTER_ALL 2 | |
16 | ||
17 | struct mime_boundary_context | |
18 | { | |
19 | struct mime_boundary_context *parent; | |
20 | unsigned char *boundary; | |
21 | int context; | |
22 | }; | |
23 | ||
24 | typedef struct mime_header { | |
25 | uschar *name; | |
26 | int namelen; | |
27 | void *value; | |
28 | } mime_header; | |
29 | ||
30 | static mime_header mime_header_list[] = { | |
31 | { US"content-type:", 13, &mime_content_type }, | |
32 | { US"content-disposition:", 20, &mime_content_disposition }, | |
33 | { US"content-transfer-encoding:", 26, &mime_content_transfer_encoding }, | |
34 | { US"content-id:", 11, &mime_content_id }, | |
35 | { US"content-description:", 20 , &mime_content_description } | |
36 | }; | |
37 | ||
38 | static int mime_header_list_size = sizeof(mime_header_list)/sizeof(mime_header); | |
39 | ||
40 | ||
41 | ||
42 | typedef struct mime_parameter { | |
43 | uschar *name; | |
44 | int namelen; | |
45 | void *value; | |
46 | } mime_parameter; | |
47 | ||
48 | static mime_parameter mime_parameter_list[] = { | |
49 | { US"name=", 5, &mime_filename }, | |
50 | { US"filename=", 9, &mime_filename }, | |
51 | { US"charset=", 8, &mime_charset }, | |
52 | { US"boundary=", 9, &mime_boundary } | |
53 | }; | |
54 | ||
55 | static int mime_parameter_list_size = sizeof(mime_parameter_list)/sizeof(mime_parameter); | |
56 | ||
57 | ||
58 | /* MIME Anomaly list */ | |
59 | #define MIME_ANOMALY_BROKEN_BASE64 2, "Broken BASE64 encoding detected" | |
60 | #define MIME_ANOMALY_BROKEN_QP 1, "Broken Quoted-Printable encoding detected" | |
61 | ||
62 | ||
63 | /* BASE64 decoder matrix */ | |
64 | static unsigned char mime_b64[256]={ | |
65 | /* 0 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
8e669ac1 | 66 | /* 16 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, |
8523533c TK |
67 | /* 32 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 62, 128, 128, 128, 63, |
68 | /* 48 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 128, 128, 128, 255, 128, 128, | |
69 | /* 64 */ 128, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | |
70 | /* 80 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 128, 128, 128, 128, 128, | |
71 | /* 96 */ 128, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, | |
72 | /* 112 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 128, 128, 128, 128, 128, | |
73 | /* 128 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
74 | /* 144 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
75 | /* 160 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
76 | /* 176 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
77 | /* 192 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
78 | /* 208 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
79 | /* 224 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, | |
8e669ac1 | 80 | /* 240 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 |
8523533c TK |
81 | }; |
82 | ||
83 | #endif |