git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@426 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/03/21 04:28:10... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Sat Mar 20 19:37:11 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/message.c: Removed the duplicated code from bounce checks |
|
4 |
+ |
|
1 | 5 |
Sat Mar 20 17:49:43 GMT 2004 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav: More flexable approach to scanning bounce messages within |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.45 2004/03/20 19:26:48 nigelhorne |
|
21 |
+ * Second attempt to handle all bounces |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.44 2004/03/20 17:39:23 nigelhorne |
21 | 24 |
* First attempt to handle all bounces |
22 | 25 |
* |
... | ... |
@@ -129,7 +132,7 @@ |
129 | 129 |
* uuencodebegin() no longer static |
130 | 130 |
* |
131 | 131 |
*/ |
132 |
-static char const rcsid[] = "$Id: message.c,v 1.44 2004/03/20 17:39:23 nigelhorne Exp $"; |
|
132 |
+static char const rcsid[] = "$Id: message.c,v 1.45 2004/03/20 19:26:48 nigelhorne Exp $"; |
|
133 | 133 |
|
134 | 134 |
#if HAVE_CONFIG_H |
135 | 135 |
#include "clamav-config.h" |
... | ... |
@@ -213,37 +216,6 @@ static struct mime_map { |
213 | 213 |
{ NULL, TEXT } |
214 | 214 |
}; |
215 | 215 |
|
216 |
-/* |
|
217 |
- * TODO: This is a duplicate of the table from scanners.c. We should have |
|
218 |
- * just one table |
|
219 |
- */ |
|
220 |
-struct cli_magic_s { |
|
221 |
- int offset; |
|
222 |
- const char *magic; |
|
223 |
- size_t length; |
|
224 |
- const char *descr; |
|
225 |
- cli_file_t type; |
|
226 |
-}; |
|
227 |
- |
|
228 |
-static const struct cli_magic_s cli_magic[] = { |
|
229 |
- {0, "Rar!", 4, "RAR", CL_RARFILE}, |
|
230 |
- {0, "PK\003\004", 4, "ZIP", CL_ZIPFILE}, |
|
231 |
- {0, "BZh", 3, "BZip", CL_BZFILE}, |
|
232 |
- {0, "From ", 5, "MBox", CL_MAILFILE}, |
|
233 |
- {0, "Received: ", 10, "Raw mail", CL_MAILFILE}, |
|
234 |
- {0, "Return-Path: ", 13, "Maildir", CL_MAILFILE}, |
|
235 |
- {0, "Return-path: ", 13, "Maildir", CL_MAILFILE}, |
|
236 |
- {0, "Delivered-To: ", 14, "Mail", CL_MAILFILE}, |
|
237 |
- {0, "X-UIDL: ", 8, "Mail", CL_MAILFILE}, |
|
238 |
- {0, "For: ", 5, "Eserv mail", CL_MAILFILE}, |
|
239 |
- {0, "From: ", 6, "Exim mail", CL_MAILFILE}, |
|
240 |
- {0, "X-Symantec-", 11, "Symantec", CL_MAILFILE}, |
|
241 |
- {0, "Hi. This is the qmail-send", 26, "Qmail bounce", CL_MAILFILE}, |
|
242 |
- {0, "\320\317\021\340\241\261\032\341", |
|
243 |
- 8, "OLE2 container", CL_OLE2FILE}, |
|
244 |
- {-1, NULL, 0, NULL, CL_UNKNOWN_TYPE} |
|
245 |
-}; |
|
246 |
- |
|
247 | 216 |
message * |
248 | 217 |
messageCreate(void) |
249 | 218 |
{ |
... | ... |
@@ -1191,16 +1163,9 @@ bounceBegin(const message *m) |
1191 | 1191 |
{ |
1192 | 1192 |
const text *t_line; |
1193 | 1193 |
|
1194 |
- for(t_line = messageGetBody(m); t_line; t_line = t_line->t_next) { |
|
1195 |
- const struct cli_magic_s *c; |
|
1196 |
- |
|
1197 |
- for(c = cli_magic; c->magic; c++) |
|
1198 |
- if((c->type == CL_MAILFILE) && |
|
1199 |
- (strncmp(c->magic, t_line->t_text, strlen(c->magic)) == 0)) { |
|
1200 |
- cli_dbgmsg("Found bounce message of type %s\n", c->descr); |
|
1201 |
- return t_line; |
|
1202 |
- } |
|
1203 |
- } |
|
1194 |
+ for(t_line = messageGetBody(m); t_line; t_line = t_line->t_next) |
|
1195 |
+ if(cli_filetype(t_line->t_text, strlen(t_line->t_text)) == CL_MAILFILE) |
|
1196 |
+ return t_line; |
|
1204 | 1197 |
|
1205 | 1198 |
return NULL; |
1206 | 1199 |
} |