git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1382 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2005/03/07 20:26:18... | ... |
@@ -1,3 +1,11 @@ |
1 |
+Mon Mar 7 11:24:43 GMT 2005 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Added fast track visa system which reduces memory |
|
4 |
+ requirements for scanning some messages and |
|
5 |
+ also offers some improvement in scan times. |
|
6 |
+ Currently only implemented for uuencoded |
|
7 |
+ emails |
|
8 |
+ |
|
1 | 9 |
Mon Mar 7 01:28:44 CET 2005 (tk) |
2 | 10 |
--------------------------------- |
3 | 11 |
* libclamav, clamd: add reference counter to cl_node and improve database |
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
* along with this program; if not, write to the Free Software |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 |
*/ |
18 |
-static char const rcsid[] = "$Id: mbox.c,v 1.224 2005/03/06 21:13:16 nigelhorne Exp $"; |
|
18 |
+static char const rcsid[] = "$Id: mbox.c,v 1.225 2005/03/07 11:23:12 nigelhorne Exp $"; |
|
19 | 19 |
|
20 | 20 |
#if HAVE_CONFIG_H |
21 | 21 |
#include "clamav-config.h" |
... | ... |
@@ -798,8 +798,41 @@ cli_parse_mbox(const char *dir, int desc, unsigned int options) |
798 | 798 |
cli_dbgmsg("Finished processing message\n"); |
799 | 799 |
} else |
800 | 800 |
lastLineWasEmpty = (bool)(buffer[0] == '\0'); |
801 |
- if(messageAddStr(m, buffer) < 0) |
|
802 |
- break; |
|
801 |
+ |
|
802 |
+ if((strncasecmp(buffer, "begin ", 6) == 0) && |
|
803 |
+ isdigit(buffer[6]) && |
|
804 |
+ isdigit(buffer[7]) && |
|
805 |
+ isdigit(buffer[8]) && |
|
806 |
+ buffer[9] == ' ') { |
|
807 |
+ /* |
|
808 |
+ * Fast track visa to uudecode. |
|
809 |
+ * TODO: binhex, yenc |
|
810 |
+ */ |
|
811 |
+ fileblob *fb = fileblobCreate(); |
|
812 |
+ char *filename = cli_strtok(buffer, 2, " "); |
|
813 |
+ |
|
814 |
+ fileblobSetFilename(fb, dir, filename); |
|
815 |
+ cli_dbgmsg("Fast track uuencode %s\n", filename); |
|
816 |
+ free(filename); |
|
817 |
+ |
|
818 |
+ while(fgets(buffer, sizeof(buffer) - 1, fd) != NULL) { |
|
819 |
+ unsigned char data[1024]; |
|
820 |
+ const unsigned char *uptr; |
|
821 |
+ |
|
822 |
+ cli_chomp(buffer); |
|
823 |
+ if(strcasecmp(buffer, "end") == 0) |
|
824 |
+ break; |
|
825 |
+ |
|
826 |
+ uptr = decodeLine(m, UUENCODE, buffer, data, sizeof(data)); |
|
827 |
+ if(uptr == NULL) |
|
828 |
+ break; |
|
829 |
+ fileblobAddData(fb, data, (size_t)(uptr - data)); |
|
830 |
+ } |
|
831 |
+ |
|
832 |
+ fileblobDestroy(fb); |
|
833 |
+ } else |
|
834 |
+ if(messageAddStr(m, buffer) < 0) |
|
835 |
+ break; |
|
803 | 836 |
} while(fgets(buffer, sizeof(buffer) - 1, fd) != NULL); |
804 | 837 |
|
805 | 838 |
fclose(fd); |
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
* along with this program; if not, write to the Free Software |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 |
*/ |
18 |
-static char const rcsid[] = "$Id: message.c,v 1.146 2005/03/06 19:10:20 nigelhorne Exp $"; |
|
18 |
+static char const rcsid[] = "$Id: message.c,v 1.147 2005/03/07 11:23:12 nigelhorne Exp $"; |
|
19 | 19 |
|
20 | 20 |
#if HAVE_CONFIG_H |
21 | 21 |
#include "clamav-config.h" |
... | ... |
@@ -68,7 +68,6 @@ static char const rcsid[] = "$Id: message.c,v 1.146 2005/03/06 19:10:20 nigelhor |
68 | 68 |
typedef enum { FALSE = 0, TRUE = 1 } bool; |
69 | 69 |
|
70 | 70 |
static void messageIsEncoding(message *m); |
71 |
-static unsigned char *decodeLine(message *m, encoding_type enctype, const char *line, unsigned char *buf, size_t buflen); |
|
72 | 71 |
static unsigned char *decode(message *m, const char *in, unsigned char *out, unsigned char (*decoder)(char), bool isFast); |
73 | 72 |
static void sanitiseBase64(char *s); |
74 | 73 |
static unsigned char hex(char c); |
... | ... |
@@ -1858,7 +1857,7 @@ messageClearMarkers(message *m) |
1858 | 1858 |
* |
1859 | 1859 |
* len is sizeof(ptr) |
1860 | 1860 |
*/ |
1861 |
-static unsigned char * |
|
1861 |
+unsigned char * |
|
1862 | 1862 |
decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, size_t buflen) |
1863 | 1863 |
{ |
1864 | 1864 |
size_t len, reallen; |
... | ... |
@@ -14,71 +14,6 @@ |
14 | 14 |
* You should have received a copy of the GNU General Public License |
15 | 15 |
* along with this program; if not, write to the Free Software |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 |
- * |
|
18 |
- * $Log: message.h,v $ |
|
19 |
- * Revision 1.24 2004/11/28 22:06:40 nigelhorne |
|
20 |
- * Tidy space only headers code |
|
21 |
- * |
|
22 |
- * Revision 1.23 2004/11/28 21:05:50 nigelhorne |
|
23 |
- * Handle headers with only spaces |
|
24 |
- * |
|
25 |
- * Revision 1.22 2004/11/22 15:18:51 nigelhorne |
|
26 |
- * Performance work |
|
27 |
- * |
|
28 |
- * Revision 1.21 2004/10/16 17:24:15 nigelhorne |
|
29 |
- * Handle colons in quotes in headers |
|
30 |
- * |
|
31 |
- * Revision 1.20 2004/10/14 17:45:55 nigelhorne |
|
32 |
- * Try to reclaim some memory if it becomes low when decoding |
|
33 |
- * |
|
34 |
- * Revision 1.19 2004/09/17 13:47:19 nigelhorne |
|
35 |
- * Handle yEnc attachments |
|
36 |
- * |
|
37 |
- * Revision 1.18 2004/09/17 09:48:53 nigelhorne |
|
38 |
- * Handle attempts to hide mime type |
|
39 |
- * |
|
40 |
- * Revision 1.17 2004/09/15 18:08:23 nigelhorne |
|
41 |
- * Handle multiple encoding types |
|
42 |
- * |
|
43 |
- * Revision 1.16 2004/08/23 13:15:16 nigelhorne |
|
44 |
- * messageClearMarkers |
|
45 |
- * |
|
46 |
- * Revision 1.15 2004/08/22 15:08:59 nigelhorne |
|
47 |
- * messageExport |
|
48 |
- * |
|
49 |
- * Revision 1.14 2004/08/22 10:34:24 nigelhorne |
|
50 |
- * Use fileblob |
|
51 |
- * |
|
52 |
- * Revision 1.13 2004/08/21 11:57:57 nigelhorne |
|
53 |
- * Use line.[ch] |
|
54 |
- * |
|
55 |
- * Revision 1.12 2004/07/20 14:35:29 nigelhorne |
|
56 |
- * Some MYDOOM.I were getting through |
|
57 |
- * |
|
58 |
- * Revision 1.11 2004/05/06 18:01:25 nigelhorne |
|
59 |
- * Force attachments marked as RFC822 messages to be scanned |
|
60 |
- * |
|
61 |
- * Revision 1.10 2004/04/05 12:04:56 nigelhorne |
|
62 |
- * Scan attachments with no filename |
|
63 |
- * |
|
64 |
- * Revision 1.9 2004/04/01 15:32:34 nigelhorne |
|
65 |
- * Graceful exit if messageAddLine fails in strdup |
|
66 |
- * |
|
67 |
- * Revision 1.8 2004/03/29 09:22:03 nigelhorne |
|
68 |
- * Tidy up code and reduce shuffling of data |
|
69 |
- * |
|
70 |
- * Revision 1.7 2004/03/21 17:19:49 nigelhorne |
|
71 |
- * Handle bounce messages with no headers |
|
72 |
- * |
|
73 |
- * Revision 1.6 2004/03/21 09:41:27 nigelhorne |
|
74 |
- * Faster scanning for non MIME messages |
|
75 |
- * |
|
76 |
- * Revision 1.5 2004/01/28 10:15:24 nigelhorne |
|
77 |
- * Added support to scan some bounce messages |
|
78 |
- * |
|
79 |
- * Revision 1.4 2004/01/14 18:02:55 nigelhorne |
|
80 |
- * added definition of binhexBegin |
|
81 |
- * |
|
82 | 17 |
*/ |
83 | 18 |
|
84 | 19 |
#ifndef _MESSAGE_H |
... | ... |
@@ -136,5 +71,6 @@ const text *yEncBegin(const message *m); |
136 | 136 |
const text *bounceBegin(const message *m); |
137 | 137 |
const text *encodingLine(const message *m); |
138 | 138 |
void messageClearMarkers(message *m); |
139 |
+unsigned char *decodeLine(message *m, encoding_type enctype, const char *line, unsigned char *buf, size_t buflen); |
|
139 | 140 |
|
140 | 141 |
#endif /*_MESSAGE_H*/ |