Browse code

minor cleanup

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@855 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/09/14 01:44:01
Showing 18 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Sep 13 18:41:05 CEST 2004 (tk)
2
+----------------------------------
3
+  * libclamav: minor cleanup
4
+
1 5
 Mon Sep 13 14:17:01 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/mbox.c:	return with CL_EFORMAT if mail can't be parsed
... ...
@@ -155,7 +155,7 @@ void *clamukoth(void *arg)
155 155
     }
156 156
 
157 157
     if(cfgopt(tharg->copt, "ClamukoScanArchive")) {
158
-	options |= CL_ARCHIVE;
158
+	options |= CL_SCAN_ARCHIVE;
159 159
 	logg("Clamuko: Archive support enabled.\n");
160 160
     } else {
161 161
 	logg("Clamuko: Archive support disabled.\n");
... ...
@@ -163,7 +163,7 @@ void *clamukoth(void *arg)
163 163
 
164 164
     if(cfgopt(tharg->copt, "ScanOLE2")) { 
165 165
 	logg("Clamuko: OLE2 support enabled.\n");
166
-	options |= CL_OLE2;
166
+	options |= CL_SCAN_OLE2;
167 167
     } else {
168 168
 	logg("Clamuko: OLE2 support disabled.\n");
169 169
     }
... ...
@@ -293,23 +293,23 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
293 293
 
294 294
     if(cfgopt(copt, "ScanArchive")) {
295 295
 	logg("Archive support enabled.\n");
296
-	options |= CL_ARCHIVE;
296
+	options |= CL_SCAN_ARCHIVE;
297 297
 
298 298
 	if(cfgopt(copt, "ScanRAR")) {
299 299
 	    logg("Archive: RAR support enabled.\n");
300 300
 	} else {
301 301
 	    logg("Archive: RAR support disabled.\n");
302
-	    options |= CL_DISABLERAR;
302
+	    options |= CL_SCAN_DISABLERAR;
303 303
 	}
304 304
 
305 305
 	if(cfgopt(copt, "ArchiveBlockEncrypted")) {
306 306
 	    logg("Archive: Blocking encrypted archives.\n");
307
-	    options |= CL_ENCRYPTED;
307
+	    options |= CL_SCAN_ENCRYPTED;
308 308
 	}
309 309
 
310 310
 	if(cfgopt(copt, "ArchiveBlockMax")) {
311 311
 	    logg("Archive: Blocking archives that exceed limits.\n");
312
-	    options |= CL_BLOCKMAX;
312
+	    options |= CL_SCAN_BLOCKMAX;
313 313
 	}
314 314
 
315 315
     } else {
... ...
@@ -318,11 +318,11 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
318 318
 
319 319
     if(cfgopt(copt, "ScanPE")) {
320 320
 	logg("Portable Executable support enabled.\n");
321
-	options |= CL_PE;
321
+	options |= CL_SCAN_PE;
322 322
 
323 323
 	if(cfgopt(copt, "DetectBrokenExecutables")) {
324 324
 	    logg("Detection of broken executables enabled.\n");
325
-	    options |= CL_BROKEN;
325
+	    options |= CL_SCAN_BROKEN;
326 326
 	}
327 327
 
328 328
     } else {
... ...
@@ -331,11 +331,11 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
331 331
 
332 332
     if(cfgopt(copt, "ScanMail")) {
333 333
 	logg("Mail files support enabled.\n");
334
-	options |= CL_MAIL;
334
+	options |= CL_SCAN_MAIL;
335 335
 
336 336
 	if(cfgopt(copt, "MailFollowURLs")) {
337 337
 	    logg("Mail: URL scanning enabled.\n");
338
-	    options |= CL_MAILURL;
338
+	    options |= CL_SCAN_MAILURL;
339 339
 	}
340 340
 
341 341
     } else {
... ...
@@ -344,14 +344,14 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
344 344
 
345 345
     if(cfgopt(copt, "ScanOLE2")) {
346 346
 	logg("OLE2 support enabled.\n");
347
-	options |= CL_OLE2;
347
+	options |= CL_SCAN_OLE2;
348 348
     } else {
349 349
 	logg("OLE2 support disabled.\n");
350 350
     }
351 351
 
352 352
     if(cfgopt(copt, "ScanHTML")) {
353 353
 	logg("HTML support enabled.\n");
354
-	options |= CL_HTML;
354
+	options |= CL_SCAN_HTML;
355 355
     } else {
356 356
 	logg("HTML support disabled.\n");
357 357
     }
... ...
@@ -105,7 +105,7 @@ int command(int desc, const struct cl_node *root, const struct cl_limits *limits
105 105
 	scan(buff + strlen(CMD1) + 1, NULL, root, limits, options, copt, desc, 0);
106 106
 
107 107
     } else if(!strncmp(buff, CMD2, strlen(CMD2))) { /* RAWSCAN */
108
-	opt = options & ~CL_ARCHIVE;
108
+	opt = options & ~CL_SCAN_ARCHIVE;
109 109
 	scan(buff + strlen(CMD2) + 1, NULL, root, NULL, opt, copt, desc, 0);
110 110
 
111 111
     } else if(!strncmp(buff, CMD3, strlen(CMD3))) { /* QUIT */
... ...
@@ -163,41 +163,41 @@ int scanmanager(const struct optstruct *opt)
163 163
     /* set options */
164 164
 
165 165
     if(optl(opt, "disable-archive") || optl(opt, "no-archive"))
166
-	options &= ~CL_ARCHIVE;
166
+	options &= ~CL_SCAN_ARCHIVE;
167 167
     else
168
-	options |= CL_ARCHIVE;
168
+	options |= CL_SCAN_ARCHIVE;
169 169
 
170 170
     if(optl(opt, "detect-broken"))
171
-	options |= CL_BROKEN;
171
+	options |= CL_SCAN_BROKEN;
172 172
 
173 173
     if(optl(opt, "block-encrypted"))
174
-	options |= CL_ENCRYPTED;
174
+	options |= CL_SCAN_ENCRYPTED;
175 175
 
176 176
     if(optl(opt, "block-max"))
177
-	options |= CL_BLOCKMAX;
177
+	options |= CL_SCAN_BLOCKMAX;
178 178
 
179 179
     if(optl(opt, "no-pe"))
180
-	options &= ~CL_PE;
180
+	options &= ~CL_SCAN_PE;
181 181
     else
182
-	options |= CL_PE;
182
+	options |= CL_SCAN_PE;
183 183
 
184 184
     if(optl(opt, "no-ole2"))
185
-	options &= ~CL_OLE2;
185
+	options &= ~CL_SCAN_OLE2;
186 186
     else
187
-	options |= CL_OLE2;
187
+	options |= CL_SCAN_OLE2;
188 188
 
189 189
     if(optl(opt, "no-html"))
190
-	options &= ~CL_HTML;
190
+	options &= ~CL_SCAN_HTML;
191 191
     else
192
-	options |= CL_HTML;
192
+	options |= CL_SCAN_HTML;
193 193
 
194 194
     if(optl(opt, "no-mail")) {
195
-	options &= ~CL_MAIL;
195
+	options &= ~CL_SCAN_MAIL;
196 196
     } else {
197
-	options |= CL_MAIL;
197
+	options |= CL_SCAN_MAIL;
198 198
 
199 199
 	if(optl(opt, "mail-follow-urls"))
200
-	    options |= CL_MAILURL;
200
+	    options |= CL_SCAN_MAILURL;
201 201
     }
202 202
 
203 203
 #ifdef C_LINUX
... ...
@@ -378,7 +378,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
378 378
      * external (if provided) when internal cannot extract data.
379 379
      */
380 380
 
381
-    if((cli_strbcasestr(filename, ".zip") || cli_strbcasestr(filename, ".rar")) && (options & CL_ARCHIVE)) {
381
+    if((cli_strbcasestr(filename, ".zip") || cli_strbcasestr(filename, ".rar")) && (options & CL_SCAN_ARCHIVE)) {
382 382
 	/* try to use internal archivers */
383 383
 	if((ret = checkfile(filename, root, limits, options)) == CL_VIRUS) {
384 384
 	    if(optl(opt, "remove")) {
... ...
@@ -398,7 +398,7 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us
398 398
 	} else if(ret == CL_CLEAN)
399 399
 	    return 0;
400 400
 	/* in other case try to continue with external archivers */
401
-	options &= ~CL_ARCHIVE; /* and disable decompression for the below checkfile() */
401
+	options &= ~CL_SCAN_ARCHIVE; /* and disable decompression for the below checkfile() */
402 402
     }
403 403
 
404 404
     if((cli_strbcasestr(filename, ".zip") && optl(opt, "unzip"))
... ...
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
74 74
     limits.archivememlim = 0; /* disable memory limit for bzip2 scanner */
75 75
 
76 76
     /* scan descriptor */
77
-    if((ret = cl_scandesc(fd, &virname, &size, root, &limits, CL_STDOPT)) == CL_VIRUS)
77
+    if((ret = cl_scandesc(fd, &virname, &size, root, &limits, CL_SCAN_STDOPT)) == CL_VIRUS)
78 78
 	printf("Virus detected: %s\n", virname);
79 79
     else {
80 80
 	printf("No virus detected.\n");
... ...
@@ -27,12 +27,10 @@
27 27
 extern "C"
28 28
 {
29 29
 #endif
30
- 
31 30
 
32 31
 
33 32
 #define CL_COUNT_PRECISION 4096
34 33
 
35
-
36 34
 /* return codes */
37 35
 #define CL_CLEAN	0   /* virus not found */
38 36
 #define CL_VIRUS	1   /* virus found */
... ...
@@ -65,22 +63,30 @@ extern "C"
65 65
 #define CL_EIO		-12 /* general I/O error */
66 66
 #define CL_EFORMAT	-13 /* bad format or broken file */
67 67
 
68
-/* options */
69
-#define CL_RAW		0
70
-#define CL_ARCHIVE	1
71
-#define CL_MAIL		2
72
-#define CL_DISABLERAR	4
73
-#define CL_OLE2		8
74
-#define CL_ENCRYPTED    16
75
-#define CL_HTML		32
76
-#define CL_PE		64
77
-#define CL_BROKEN	128
78
-#define CL_MAILURL	256
79
-#define CL_BLOCKMAX	512
80
-
68
+/* scan options */
69
+#define CL_SCAN_RAW		0
70
+#define CL_SCAN_ARCHIVE		1
71
+#define CL_SCAN_MAIL		2
72
+#define CL_SCAN_DISABLERAR	4
73
+#define CL_SCAN_OLE2		8
74
+#define CL_SCAN_ENCRYPTED	16
75
+#define CL_SCAN_HTML		32
76
+#define CL_SCAN_PE		64
77
+#define CL_SCAN_BROKEN		128
78
+#define CL_SCAN_MAILURL		256
79
+#define CL_SCAN_BLOCKMAX	512
81 80
 
82 81
 /* recommended options */
83
-#define CL_STDOPT	(CL_ARCHIVE | CL_MAIL | CL_OLE2 | CL_HTML | CL_PE) 
82
+#define CL_SCAN_STDOPT		(CL_SCAN_ARCHIVE | CL_SCAN_MAIL | CL_SCAN_OLE2 | CL_SCAN_HTML | CL_SCAN_PE) 
83
+
84
+/* aliases for backward compatibility */
85
+#define CL_RAW		CL_SCAN_RAW
86
+#define CL_ARCHIVE	CL_SCAN_ARCHIVE
87
+#define CL_MAIL		CL_SCAN_MAIL
88
+#define CL_DISABLERAR	CL_SCAN_DISABLERAR
89
+#define CL_OLE2		CL_SCAN_OLE2
90
+#define CL_ENCRYPTED    CL_SCAN_ENCRYPTED
91
+
84 92
 
85 93
 struct cli_bm_patt {
86 94
     char *pattern;
... ...
@@ -158,13 +164,13 @@ struct cl_cvd {
158 158
 /* file scanning */
159 159
 extern int cl_scanbuff(const char *buffer, unsigned int length, const char **virname, const struct cl_node *root);
160 160
 
161
-extern int cl_scandesc(int desc, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options);
161
+extern int cl_scandesc(int desc, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options);
162 162
 
163
-extern int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options);
163
+extern int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options);
164 164
 
165 165
 /* database */
166
-extern int cl_loaddb(const char *filename, struct cl_node **root, int *virnum);
167
-extern int cl_loaddbdir(const char *dirname, struct cl_node **root, int *virnum);
166
+extern int cl_loaddb(const char *filename, struct cl_node **root, unsigned int *signo);
167
+extern int cl_loaddbdir(const char *dirname, struct cl_node **root, unsigned int *signo);
168 168
 extern const char *cl_retdbdir(void);
169 169
 extern int cl_retflevel(void);
170 170
 
... ...
@@ -328,7 +328,7 @@ int cl_cvdverify(const char *file)
328 328
     return ret;
329 329
 }
330 330
 
331
-int cli_cvdload(FILE *fd, struct cl_node **root, int *virnum)
331
+int cli_cvdload(FILE *fd, struct cl_node **root, unsigned int *signo)
332 332
 {
333 333
         char *dir, *tmp, *buffer;
334 334
 	struct cl_cvd cvd;
... ...
@@ -432,7 +432,7 @@ int cli_cvdload(FILE *fd, struct cl_node **root, int *virnum)
432 432
 	    /* end */
433 433
 
434 434
     /* load extracted directory */
435
-    cl_loaddbdir(dir, root, virnum);
435
+    cl_loaddbdir(dir, root, signo);
436 436
 
437 437
     cli_rmdirs(dir);
438 438
     free(dir);
... ...
@@ -22,7 +22,7 @@
22 22
 #include <stdio.h>
23 23
 #include "clamav.h"
24 24
 
25
-int cli_cvdload(FILE *fd, struct cl_node **root, int *virnum);
25
+int cli_cvdload(FILE *fd, struct cl_node **root, unsigned int *signo);
26 26
 int cli_untgz(int fd, const char *destdir);
27 27
 
28 28
 #endif
... ...
@@ -49,102 +49,102 @@ static const struct cli_magic_s cli_magic[] = {
49 49
 
50 50
     /* Executables */
51 51
 
52
-    {0,  "MZ",				2,  "DOS/W32 executable/library/driver", CL_DOSEXE},
52
+    {0,  "MZ",				2,  "DOS/W32 executable/library/driver", CL_TYPE_MSEXE},
53 53
 
54 54
     /* Archives */
55 55
 
56
-    {0,	    "Rar!",			4,  "RAR",		  CL_RARFILE},
57
-    {0,	    "PK\003\004",		4,  "ZIP",		  CL_ZIPFILE},
58
-    {0,	    "PK00PK\003\004",		4,  "ZIP",		  CL_ZIPFILE},
59
-    {0,	    "\037\213",			2,  "GZip",		  CL_GZFILE},
60
-    {0,	    "BZh",			3,  "BZip",		  CL_BZFILE},
61
-    {0,	    "SZDD",			4,  "compress.exe'd",	  CL_MSCFILE},
62
-    {0,	    "MSCF",			4,  "MS CAB",		  CL_MSCABFILE},
63
-    {0,	    "ITSF",			4,  "MS CHM",             CL_MSCHMFILE},
64
-    {257,   "ustar",			5,  "POSIX tar",	  CL_TARFILE},
65
-    {0,     "#@~^",			4,  "SCRENC",		  CL_SCRENC},
56
+    {0,	    "Rar!",			4,  "RAR",		CL_TYPE_RAR},
57
+    {0,	    "PK\003\004",		4,  "ZIP",		CL_TYPE_ZIP},
58
+    {0,	    "PK00PK\003\004",		4,  "ZIP",		CL_TYPE_ZIP},
59
+    {0,	    "\037\213",			2,  "GZip",		CL_TYPE_GZ},
60
+    {0,	    "BZh",			3,  "BZip",		CL_TYPE_BZ},
61
+    {0,	    "SZDD",			4,  "compress.exe'd",	CL_TYPE_MSSZDD},
62
+    {0,	    "MSCF",			4,  "MS CAB",		CL_TYPE_MSCAB},
63
+    {0,	    "ITSF",			4,  "MS CHM",           CL_TYPE_MSCHM},
64
+    {257,   "ustar",			5,  "POSIX tar",	CL_TYPE_TAR},
65
+    {0,     "#@~^",			4,  "SCRENC",		CL_TYPE_SCRENC},
66 66
 
67 67
     /* Mail */
68 68
 
69
-    {0,  "From ",			 5, "MBox",		  CL_MAILFILE},
70
-    {0,  "Received: ",			10, "Raw mail",		  CL_MAILFILE},
71
-    {0,  "Return-Path: ",		13, "Maildir",		  CL_MAILFILE},
72
-    {0,  "Return-path: ",		13, "Maildir",		  CL_MAILFILE},
73
-    {0,  "Delivered-To: ",		14, "Mail",		  CL_MAILFILE},
74
-    {0,  "X-UIDL: ",			 8, "Mail",		  CL_MAILFILE},
75
-    {0,  "X-Apparently-To: ",		17, "Mail",		  CL_MAILFILE},
76
-    {0,  "X-Envelope-From: ",		17, "Mail",		  CL_MAILFILE},
77
-    {0,  "X-Original-To: ",		15, "Mail",		  CL_MAILFILE},
78
-    {0,  "X-Symantec-",			11, "Symantec",		  CL_MAILFILE},
79
-    {0,  "X-EVS",			 5, "EVS mail",		  CL_MAILFILE},
80
-    {0,  "X-Real-To: ",                 11, "Mail",               CL_MAILFILE},
81
-    {0,  ">From ",			 6, "Mail",		  CL_MAILFILE},
82
-    {0,  "Date: ",			 6, "Mail",		  CL_MAILFILE},
83
-    {0,  "Message-Id: ",		12, "Mail",		  CL_MAILFILE},
84
-    {0,  "Message-ID: ",		12, "Mail",		  CL_MAILFILE},
85
-    {0,  "Envelope-to: ",		13, "Mail",		  CL_MAILFILE},
86
-    {0,  "Delivery-date: ",		15, "Mail",		  CL_MAILFILE},
87
-    {0,  "To: ",			 4, "Mail",		  CL_MAILFILE},
88
-    {0,  "Subject: ",			 9, "Mail",		  CL_MAILFILE},
89
-    {0,  "For: ",			 5, "Eserv mail",	  CL_MAILFILE},
90
-    {0,  "From: ",			 6, "Exim mail",	  CL_MAILFILE},
91
-    {0,  "v:\015\012Received: ",	14, "VPOP3 Mail (DOS)",	  CL_MAILFILE},
92
-    {0,  "v:\012Received: ",		13, "VPOP3 Mail (UNIX)",  CL_MAILFILE},
93
-    {0,  "Hi. This is the qmail-send",  26, "Qmail bounce",	  CL_MAILFILE},
69
+    {0,  "From ",			 5, "MBox",		  CL_TYPE_MAIL},
70
+    {0,  "Received: ",			10, "Raw mail",		  CL_TYPE_MAIL},
71
+    {0,  "Return-Path: ",		13, "Maildir",		  CL_TYPE_MAIL},
72
+    {0,  "Return-path: ",		13, "Maildir",		  CL_TYPE_MAIL},
73
+    {0,  "Delivered-To: ",		14, "Mail",		  CL_TYPE_MAIL},
74
+    {0,  "X-UIDL: ",			 8, "Mail",		  CL_TYPE_MAIL},
75
+    {0,  "X-Apparently-To: ",		17, "Mail",		  CL_TYPE_MAIL},
76
+    {0,  "X-Envelope-From: ",		17, "Mail",		  CL_TYPE_MAIL},
77
+    {0,  "X-Original-To: ",		15, "Mail",		  CL_TYPE_MAIL},
78
+    {0,  "X-Symantec-",			11, "Symantec",		  CL_TYPE_MAIL},
79
+    {0,  "X-EVS",			 5, "EVS mail",		  CL_TYPE_MAIL},
80
+    {0,  "X-Real-To: ",                 11, "Mail",               CL_TYPE_MAIL},
81
+    {0,  ">From ",			 6, "Mail",		  CL_TYPE_MAIL},
82
+    {0,  "Date: ",			 6, "Mail",		  CL_TYPE_MAIL},
83
+    {0,  "Message-Id: ",		12, "Mail",		  CL_TYPE_MAIL},
84
+    {0,  "Message-ID: ",		12, "Mail",		  CL_TYPE_MAIL},
85
+    {0,  "Envelope-to: ",		13, "Mail",		  CL_TYPE_MAIL},
86
+    {0,  "Delivery-date: ",		15, "Mail",		  CL_TYPE_MAIL},
87
+    {0,  "To: ",			 4, "Mail",		  CL_TYPE_MAIL},
88
+    {0,  "Subject: ",			 9, "Mail",		  CL_TYPE_MAIL},
89
+    {0,  "For: ",			 5, "Eserv mail",	  CL_TYPE_MAIL},
90
+    {0,  "From: ",			 6, "Exim mail",	  CL_TYPE_MAIL},
91
+    {0,  "v:\015\012Received: ",	14, "VPOP3 Mail (DOS)",	  CL_TYPE_MAIL},
92
+    {0,  "v:\012Received: ",		13, "VPOP3 Mail (UNIX)",  CL_TYPE_MAIL},
93
+    {0,  "Hi. This is the qmail-send",  26, "Qmail bounce",	  CL_TYPE_MAIL},
94 94
 
95 95
     /* Others */
96 96
 
97 97
     {0,  "\320\317\021\340\241\261\032\341",
98
-	                    8, "OLE2 container",  CL_OLE2FILE},
98
+	                    8, "OLE2 container",  CL_TYPE_MSOLE2},
99 99
 
100 100
     /* Ignored types */
101 101
 
102
-    {0,  "\000\000\001\263",             4, "MPEG video stream",  CL_DATAFILE},
103
-    {0,  "\000\000\001\272",             4, "MPEG sys stream",    CL_DATAFILE},
104
-    {0,  "RIFF",                         4, "RIFF",		  CL_DATAFILE},
105
-    {0,  "GIF",				 3, "GIF",		  CL_DATAFILE},
106
-    {0,  "\x89PNG",			 4, "PNG",                CL_DATAFILE},
107
-    {0,  "\377\330\377",		 4, "JPEG",               CL_DATAFILE},
108
-    {0,  "BM",				 2, "BMP",                CL_DATAFILE},
109
-    {0,  "OggS",                         4, "Ogg Stream",         CL_DATAFILE},
110
-    {0,  "ID3",				 3, "MP3",		  CL_DATAFILE},
111
-    {0,  "\377\373\220",		 3, "MP3",		  CL_DATAFILE},
112
-    {0,  "\%PDF-",			 5, "PDF document",	  CL_DATAFILE},
113
-    {0,  "\%!PS-Adobe-",		11, "PostScript",	  CL_DATAFILE},
114
-    {0,  "\060\046\262\165\216\146\317", 7, "WMA/WMV/ASF",	  CL_DATAFILE},
115
-    {0,  ".RMF" ,			 4, "Real Media File",	  CL_DATAFILE},
116
-
117
-    {-1, NULL,				 0, NULL,              CL_UNKNOWN_DATA_TYPE}
102
+    {0,  "\000\000\001\263",             4, "MPEG video stream",  CL_TYPE_DATA},
103
+    {0,  "\000\000\001\272",             4, "MPEG sys stream",    CL_TYPE_DATA},
104
+    {0,  "RIFF",                         4, "RIFF",		  CL_TYPE_DATA},
105
+    {0,  "GIF",				 3, "GIF",		  CL_TYPE_DATA},
106
+    {0,  "\x89PNG",			 4, "PNG",                CL_TYPE_DATA},
107
+    {0,  "\377\330\377",		 4, "JPEG",               CL_TYPE_DATA},
108
+    {0,  "BM",				 2, "BMP",                CL_TYPE_DATA},
109
+    {0,  "OggS",                         4, "Ogg Stream",         CL_TYPE_DATA},
110
+    {0,  "ID3",				 3, "MP3",		  CL_TYPE_DATA},
111
+    {0,  "\377\373\220",		 3, "MP3",		  CL_TYPE_DATA},
112
+    {0,  "\%PDF-",			 5, "PDF document",	  CL_TYPE_DATA},
113
+    {0,  "\%!PS-Adobe-",		11, "PostScript",	  CL_TYPE_DATA},
114
+    {0,  "\060\046\262\165\216\146\317", 7, "WMA/WMV/ASF",	  CL_TYPE_DATA},
115
+    {0,  ".RMF" ,			 4, "Real Media File",	  CL_TYPE_DATA},
116
+
117
+    {-1, NULL,				 0, NULL,		  CL_TYPE_UNKNOWN_DATA}
118 118
 };
119 119
 
120 120
 static const struct cli_smagic_s cli_smagic[] = {
121 121
 
122 122
     /* "\nFrom: " * "\nContent-Type: " */
123
-    {"0a46726f6d3a20{-2048}0a436f6e74656e742d547970653a20", "Mail file", CL_MAILFILE},
123
+    {"0a46726f6d3a20{-2048}0a436f6e74656e742d547970653a20", "Mail file", CL_TYPE_MAIL},
124 124
 
125 125
     /* "\nReceived: " * "\nContent-Type: " */
126
-    {"0a52656365697665643a20{-2048}0a436f6e74656e742d547970653a20", "Mail file", CL_MAILFILE},
126
+    {"0a52656365697665643a20{-2048}0a436f6e74656e742d547970653a20", "Mail file", CL_TYPE_MAIL},
127 127
 
128 128
     /* "\nReceived: " * "\nContent-type: " */
129
-    {"0a52656365697665643a20{-2048}0a436f6e74656e742d747970653a20", "Mail file", CL_MAILFILE},
129
+    {"0a52656365697665643a20{-2048}0a436f6e74656e742d747970653a20", "Mail file", CL_TYPE_MAIL},
130 130
 
131 131
     /* remember the matcher is case sensitive */
132
-    {"3c62723e",       "HTML data", CL_HTMLFILE},	/* <br> */
133
-    {"3c42723e",       "HTML data", CL_HTMLFILE},	/* <Br> */
134
-    {"3c42523e",       "HTML data", CL_HTMLFILE},	/* <BR> */
135
-    {"3c703e",	       "HTML data", CL_HTMLFILE},	/* <p> */
136
-    {"3c503e",	       "HTML data", CL_HTMLFILE},	/* <P> */
137
-    {"68726566",       "HTML data", CL_HTMLFILE},	/* href */
138
-    {"48726566",       "HTML data", CL_HTMLFILE},	/* Href */
139
-    {"48524546",       "HTML data", CL_HTMLFILE},	/* HREF */
140
-    {"3c666f6e74",     "HTML data", CL_HTMLFILE},	/* <font */
141
-    {"3c466f6e74",     "HTML data", CL_HTMLFILE},	/* <Font */
142
-    {"3c464f4e54",     "HTML data", CL_HTMLFILE},	/* <FONT */
143
-    {"3c736372697074", "HTML data", CL_HTMLFILE},	/* <script */
144
-    {"3c536372697074", "HTML data", CL_HTMLFILE},	/* <Script */
145
-    {"3c534352495054", "HTML data", CL_HTMLFILE},	/* <SCRIPT */
146
-
147
-    {NULL,  NULL,   CL_UNKNOWN_DATA_TYPE}
132
+    {"3c62723e",       "HTML data", CL_TYPE_HTML},	/* <br> */
133
+    {"3c42723e",       "HTML data", CL_TYPE_HTML},	/* <Br> */
134
+    {"3c42523e",       "HTML data", CL_TYPE_HTML},	/* <BR> */
135
+    {"3c703e",	       "HTML data", CL_TYPE_HTML},	/* <p> */
136
+    {"3c503e",	       "HTML data", CL_TYPE_HTML},	/* <P> */
137
+    {"68726566",       "HTML data", CL_TYPE_HTML},	/* href */
138
+    {"48726566",       "HTML data", CL_TYPE_HTML},	/* Href */
139
+    {"48524546",       "HTML data", CL_TYPE_HTML},	/* HREF */
140
+    {"3c666f6e74",     "HTML data", CL_TYPE_HTML},	/* <font */
141
+    {"3c466f6e74",     "HTML data", CL_TYPE_HTML},	/* <Font */
142
+    {"3c464f4e54",     "HTML data", CL_TYPE_HTML},	/* <FONT */
143
+    {"3c736372697074", "HTML data", CL_TYPE_HTML},	/* <script */
144
+    {"3c536372697074", "HTML data", CL_TYPE_HTML},	/* <Script */
145
+    {"3c534352495054", "HTML data", CL_TYPE_HTML},	/* <SCRIPT */
146
+
147
+    {NULL,  NULL,   CL_TYPE_UNKNOWN_DATA}
148 148
 };
149 149
 
150 150
 cli_file_t cli_filetype(const char *buf, size_t buflen)
... ...
@@ -168,7 +168,7 @@ cli_file_t cli_filetype(const char *buf, size_t buflen)
168 168
 	    break;
169 169
 	}
170 170
 
171
-    return ascii ? CL_UNKNOWN_TEXT_TYPE : CL_UNKNOWN_DATA_TYPE;
171
+    return ascii ? CL_TYPE_UNKNOWN_TEXT : CL_TYPE_UNKNOWN_DATA;
172 172
 }
173 173
 
174 174
 int cli_addtypesigs(struct cl_node *root)
... ...
@@ -24,24 +24,24 @@
24 24
 #define CL_TYPENO 500
25 25
 
26 26
 typedef enum {
27
-    CL_UNKNOWN_TEXT_TYPE = CL_TYPENO,
28
-    CL_UNKNOWN_DATA_TYPE,
29
-    CL_DOSEXE,
30
-    CL_DATAFILE,
31
-    CL_TARFILE,
32
-    CL_GZFILE,
33
-    CL_ZIPFILE,
34
-    CL_BZFILE,
35
-    CL_RARFILE,
36
-    CL_MSCFILE,
37
-    CL_OLE2FILE,
38
-    CL_MSCABFILE,
39
-    CL_MSCHMFILE,
40
-    CL_SCRENC,
27
+    CL_TYPE_UNKNOWN_TEXT = CL_TYPENO,
28
+    CL_TYPE_UNKNOWN_DATA,
29
+    CL_TYPE_MSEXE,
30
+    CL_TYPE_DATA,
31
+    CL_TYPE_TAR,
32
+    CL_TYPE_GZ,
33
+    CL_TYPE_ZIP,
34
+    CL_TYPE_BZ,
35
+    CL_TYPE_RAR,
36
+    CL_TYPE_MSSZDD,
37
+    CL_TYPE_MSOLE2,
38
+    CL_TYPE_MSCAB,
39
+    CL_TYPE_MSCHM,
40
+    CL_TYPE_SCRENC,
41 41
 
42 42
     /* bigger numbers have higher priority (in o-t-f detection) */
43
-    CL_HTMLFILE, /* on the fly */
44
-    CL_MAILFILE  /* magic + on the fly */
43
+    CL_TYPE_HTML, /* on the fly */
44
+    CL_TYPE_MAIL  /* magic + on the fly */
45 45
 
46 46
 } cli_file_t;
47 47
 
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.117  2004/09/13 16:44:01  kojm
21
+ * minor cleanup
22
+ *
20 23
  * Revision 1.116  2004/09/13 13:16:28  nigelhorne
21 24
  * Return CL_EFORMAT on bad format
22 25
  *
... ...
@@ -336,7 +339,7 @@
336 336
  * Compilable under SCO; removed duplicate code with message.c
337 337
  *
338 338
  */
339
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.116 2004/09/13 13:16:28 nigelhorne Exp $";
339
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.117 2004/09/13 16:44:01 kojm Exp $";
340 340
 
341 341
 #if HAVE_CONFIG_H
342 342
 #include "clamav-config.h"
... ...
@@ -1395,7 +1398,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1395 1395
 									addAttachment = TRUE;
1396 1396
 								}
1397 1397
 							} else {
1398
-								if(options&CL_MAILURL)
1398
+								if(options&CL_SCAN_MAILURL)
1399 1399
 									if(tableFind(subtypeTable, cptr) == HTML)
1400 1400
 										checkURLs(aMessage, dir);
1401 1401
 								messageAddArgument(aMessage, "filename=textportion");
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.77  2004/09/13 16:44:01  kojm
21
+ * minor cleanup
22
+ *
20 23
  * Revision 1.76  2004/09/03 15:59:00  nigelhorne
21 24
  * Handle boundary= "foo"
22 25
  *
... ...
@@ -225,7 +228,7 @@
225 225
  * uuencodebegin() no longer static
226 226
  *
227 227
  */
228
-static	char	const	rcsid[] = "$Id: message.c,v 1.76 2004/09/03 15:59:00 nigelhorne Exp $";
228
+static	char	const	rcsid[] = "$Id: message.c,v 1.77 2004/09/13 16:44:01 kojm Exp $";
229 229
 
230 230
 #if HAVE_CONFIG_H
231 231
 #include "clamav-config.h"
... ...
@@ -939,7 +942,7 @@ messageIsEncoding(message *m)
939 939
 	   (strstr(line, "7bit") == NULL))
940 940
 		m->encoding = m->body_last;
941 941
 	else if(/*(m->bounce == NULL) &&*/
942
-		(cli_filetype(line, strlen(line)) == CL_MAILFILE))
942
+		(cli_filetype(line, strlen(line)) == CL_TYPE_MAIL))
943 943
 			m->bounce = m->body_last;
944 944
 	else if((m->binhex == NULL) &&
945 945
 		(strncasecmp(line, binhex, sizeof(binhex) - 1) == 0))
... ...
@@ -1574,7 +1577,7 @@ bounceBegin(const message *m)
1574 1574
 	const text *t_line;
1575 1575
 
1576 1576
 	for(t_line = messageGetBody(m); t_line; t_line = t_line->t_next)
1577
-		if(cli_filetype(t_line->t_text, strlen(t_line->t_text)) == CL_MAILFILE)
1577
+		if(cli_filetype(t_line->t_text, strlen(t_line->t_text)) == CL_TYPE_MAIL)
1578 1578
 			return t_line;
1579 1579
 
1580 1580
 	return NULL;
... ...
@@ -46,7 +46,7 @@
46 46
 #define IMAGE_NT_SIGNATURE	    0x00004550
47 47
 #define IMAGE_OPTIONAL_SIGNATURE    0x010b
48 48
 
49
-#define DETECT_BROKEN		    (options & CL_BROKEN)
49
+#define DETECT_BROKEN		    (options & CL_SCAN_BROKEN)
50 50
 
51 51
 #define UPX_NRV2B "\x11\xdb\x11\xc9\x01\xdb\x75\x07\x8b\x1e\x83\xee\xfc\x11\xdb\x11\xc9\x11\xc9\x75\x20\x41\x01\xdb"
52 52
 #define UPX_NRV2D "\x83\xf0\xff\x74\x78\xd1\xf8\x89\xc5\xeb\x0b\x01\xdb\x75\x07\x8b\x1e\x83\xee\xfc\x11\xdb\x11\xc9"
... ...
@@ -141,7 +141,7 @@ static int cli_ddump(int desc, int offset, int size, const char *file)
141 141
     return 0;
142 142
 }
143 143
 
144
-int cli_scanpe(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
144
+int cli_scanpe(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
145 145
 {
146 146
 	uint16_t e_magic; /* DOS signature ("MZ") */
147 147
 	uint16_t nsections;
... ...
@@ -100,7 +100,7 @@ struct cli_pe_info {
100 100
     struct SECTION *section;
101 101
 };
102 102
 
103
-int cli_scanpe(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec);
103
+int cli_scanpe(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec);
104 104
 
105 105
 int cli_peheader(int desc, struct cli_pe_info **peinfo);
106 106
 
... ...
@@ -383,7 +383,7 @@ int cli_parse_add(struct cl_node *root, const char *virname, const char *hexsig,
383 383
     return 0;
384 384
 }
385 385
 
386
-static int cli_loaddb(FILE *fd, struct cl_node **root, int *virnum)
386
+static int cli_loaddb(FILE *fd, struct cl_node **root, unsigned int *signo)
387 387
 {
388 388
 	char buffer[FILEBUFF], *pt, *start;
389 389
 	int line = 0, ret = 0;
... ...
@@ -448,13 +448,13 @@ static int cli_loaddb(FILE *fd, struct cl_node **root, int *virnum)
448 448
 	return ret;
449 449
     }
450 450
 
451
-    if(virnum)
452
-	*virnum += line;
451
+    if(signo)
452
+	*signo += line;
453 453
 
454 454
     return 0;
455 455
 }
456 456
 
457
-static int cli_loadhdb(FILE *fd, struct cl_node **root, int *virnum)
457
+static int cli_loadhdb(FILE *fd, struct cl_node **root, unsigned int *signo)
458 458
 {
459 459
 	char buffer[FILEBUFF], *pt;
460 460
 	int line = 0, ret = 0;
... ...
@@ -535,13 +535,13 @@ static int cli_loadhdb(FILE *fd, struct cl_node **root, int *virnum)
535 535
 	return ret;
536 536
     }
537 537
 
538
-    if(virnum)
539
-	*virnum += line;
538
+    if(signo)
539
+	*signo += line;
540 540
 
541 541
     return 0;
542 542
 }
543 543
 
544
-int cl_loaddb(const char *filename, struct cl_node **root, int *virnum)
544
+int cl_loaddb(const char *filename, struct cl_node **root, unsigned int *signo)
545 545
 {
546 546
 	FILE *fd;
547 547
 	int ret;
... ...
@@ -555,17 +555,17 @@ int cl_loaddb(const char *filename, struct cl_node **root, int *virnum)
555 555
     cli_dbgmsg("Loading %s\n", filename);
556 556
 
557 557
     if(cli_strbcasestr(filename, ".db")  || cli_strbcasestr(filename, ".db2") || cli_strbcasestr(filename, ".db3")) {
558
-	ret = cli_loaddb(fd, root, virnum);
558
+	ret = cli_loaddb(fd, root, signo);
559 559
 
560 560
     } else if(cli_strbcasestr(filename, ".cvd")) {
561
-	ret = cli_cvdload(fd, root, virnum);
561
+	ret = cli_cvdload(fd, root, signo);
562 562
 
563 563
     } else if(cli_strbcasestr(filename, ".hdb")) {
564
-	ret = cli_loadhdb(fd, root, virnum);
564
+	ret = cli_loadhdb(fd, root, signo);
565 565
 
566 566
     } else {
567 567
 	cli_dbgmsg("cl_loaddb: unknown extension - assuming old database format\n");
568
-	ret = cli_loaddb(fd, root, virnum);
568
+	ret = cli_loaddb(fd, root, signo);
569 569
     }
570 570
 
571 571
     if(ret)
... ...
@@ -575,7 +575,7 @@ int cl_loaddb(const char *filename, struct cl_node **root, int *virnum)
575 575
     return ret;
576 576
 }
577 577
 
578
-int cl_loaddbdir(const char *dirname, struct cl_node **root, int *virnum)
578
+int cl_loaddbdir(const char *dirname, struct cl_node **root, unsigned int *signo)
579 579
 {
580 580
 	DIR *dd;
581 581
 	struct dirent *dent;
... ...
@@ -610,7 +610,7 @@ int cl_loaddbdir(const char *dirname, struct cl_node **root, int *virnum)
610 610
 		    return CL_EMEM;
611 611
 		}
612 612
 		sprintf(dbfile, "%s/%s", dirname, dent->d_name);
613
-		if((ret = cl_loaddb(dbfile, root, virnum))) {
613
+		if((ret = cl_loaddb(dbfile, root, signo))) {
614 614
 		    cli_dbgmsg("cl_loaddbdir(): error loading database %s\n", dbfile);
615 615
 		    free(dbfile);
616 616
 		    closedir(dd);
... ...
@@ -76,18 +76,18 @@ extern int cli_mbox(const char *dir, int desc, unsigned int options); /* FIXME *
76 76
 #include <bzlib.h>
77 77
 #endif
78 78
 
79
-#define SCAN_ARCHIVE	    (options & CL_ARCHIVE)
80
-#define SCAN_MAIL	    (options & CL_MAIL)
81
-#define SCAN_OLE2	    (options & CL_OLE2)
82
-#define SCAN_HTML	    (options & CL_HTML)
83
-#define SCAN_PE		    (options & CL_PE)
84
-#define DISABLE_RAR	    (options & CL_DISABLERAR)
85
-#define DETECT_ENCRYPTED    (options & CL_ENCRYPTED)
86
-#define BLOCKMAX	    (options & CL_BLOCKMAX)
79
+#define SCAN_ARCHIVE	    (options & CL_SCAN_ARCHIVE)
80
+#define SCAN_MAIL	    (options & CL_SCAN_MAIL)
81
+#define SCAN_OLE2	    (options & CL_SCAN_OLE2)
82
+#define SCAN_HTML	    (options & CL_SCAN_HTML)
83
+#define SCAN_PE		    (options & CL_SCAN_PE)
84
+#define DISABLE_RAR	    (options & CL_SCAN_DISABLERAR)
85
+#define DETECT_ENCRYPTED    (options & CL_SCAN_ENCRYPTED)
86
+#define BLOCKMAX	    (options & CL_SCAN_BLOCKMAX)
87 87
 
88 88
 #define MAX_MAIL_RECURSION  15
89 89
 
90
-static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec);
90
+static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec);
91 91
 
92 92
 
93 93
 #ifdef CL_THREAD_SAFE
... ...
@@ -98,7 +98,7 @@ static void cli_unlock_mutex(void *mtx)
98 98
 }
99 99
 #endif
100 100
 
101
-static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
101
+static int cli_scanrar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
102 102
 {
103 103
 	FILE *tmp = NULL;
104 104
 	int files = 0, fd, ret = CL_CLEAN, afiles;
... ...
@@ -259,7 +259,7 @@ static int cli_scanrar(int desc, const char **virname, long int *scanned, const
259 259
 }
260 260
 
261 261
 #ifdef HAVE_ZLIB_H
262
-static int cli_scanzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
262
+static int cli_scanzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
263 263
 {
264 264
 	ZZIP_DIR *zdir;
265 265
 	ZZIP_DIRENT zdirent;
... ...
@@ -423,7 +423,7 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
423 423
     return ret;
424 424
 }
425 425
 
426
-static int cli_scangzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
426
+static int cli_scangzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
427 427
 {
428 428
 	int fd, bytes, ret = CL_CLEAN;
429 429
 	long int size = 0;
... ...
@@ -499,7 +499,7 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const
499 499
 #define BZ2_bzRead bzRead
500 500
 #endif
501 501
 
502
-static int cli_scanbzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
502
+static int cli_scanbzip(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
503 503
 {
504 504
 	int fd, bytes, ret = CL_CLEAN, bzerror = 0;
505 505
 	short memlim = 0;
... ...
@@ -580,7 +580,7 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const
580 580
 }
581 581
 #endif
582 582
 
583
-static int cli_scanmscomp(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
583
+static int cli_scanszdd(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
584 584
 {
585 585
 	int fd, ret = CL_CLEAN;
586 586
 	FILE *tmp = NULL, *in;
... ...
@@ -623,7 +623,7 @@ static int cli_scanmscomp(int desc, const char **virname, long int *scanned, con
623 623
     return ret;
624 624
 }
625 625
 
626
-static int cli_scanmscab(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
626
+static int cli_scanmscab(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
627 627
 {
628 628
 	struct mscab_decompressor *cabd = NULL;
629 629
 	struct mscabd_cabinet *base, *cab;
... ...
@@ -678,7 +678,7 @@ static int cli_scanmscab(int desc, const char **virname, long int *scanned, cons
678 678
     return ret;
679 679
 }
680 680
 
681
-static int cli_scanhtml(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
681
+static int cli_scanhtml(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
682 682
 {
683 683
 	char *tempname, fullname[1024];
684 684
 	const char *tmpdir;
... ...
@@ -734,7 +734,7 @@ static int cli_scanhtml(int desc, const char **virname, long int *scanned, const
734 734
     return ret;
735 735
 }
736 736
 
737
-static int  cli_scan_mydoom_log(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
737
+static int  cli_scan_mydoom_log(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
738 738
 {
739 739
 	int32_t record[8], check;
740 740
 	int i, retval=CL_VIRUS, j;
... ...
@@ -771,7 +771,7 @@ static int  cli_scan_mydoom_log(int desc, const char **virname, long int *scanne
771 771
     return retval;
772 772
 }
773 773
 
774
-static int cli_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
774
+static int cli_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
775 775
 {
776 776
 	DIR *dd;
777 777
 	struct dirent *dent;
... ...
@@ -820,7 +820,7 @@ static int cli_scandir(const char *dirname, const char **virname, long int *scan
820 820
     return 0;
821 821
 }
822 822
 
823
-static int cli_vba_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
823
+static int cli_vba_scandir(const char *dirname, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
824 824
 {
825 825
 	int ret = CL_CLEAN, i, fd, data_len;
826 826
 	vba_project_t *vba_project;
... ...
@@ -947,7 +947,7 @@ static int cli_vba_scandir(const char *dirname, const char **virname, long int *
947 947
     return ret;
948 948
 }
949 949
 
950
-static int cli_scanole2(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
950
+static int cli_scanole2(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
951 951
 {
952 952
 	const char *tmpdir;
953 953
 	char *dir;
... ...
@@ -988,7 +988,7 @@ static int cli_scanole2(int desc, const char **virname, long int *scanned, const
988 988
     return ret;
989 989
 }
990 990
 
991
-static int cli_scantar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
991
+static int cli_scantar(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
992 992
 {
993 993
 	const char *tmpdir;
994 994
 	char *dir;
... ...
@@ -1023,7 +1023,7 @@ static int cli_scantar(int desc, const char **virname, long int *scanned, const
1023 1023
     return ret;
1024 1024
 }
1025 1025
 
1026
-static int cli_scanmschm(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1026
+static int cli_scanmschm(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
1027 1027
 {
1028 1028
 	const char *tmpdir;
1029 1029
 	char *tempname;
... ...
@@ -1056,7 +1056,7 @@ static int cli_scanmschm(int desc, const char **virname, long int *scanned, cons
1056 1056
     return ret;
1057 1057
 }
1058 1058
 
1059
-static int cli_scanscrenc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1059
+static int cli_scanscrenc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
1060 1060
 {
1061 1061
 	const char *tmpdir;
1062 1062
 	char *tempname;
... ...
@@ -1087,7 +1087,7 @@ static int cli_scanscrenc(int desc, const char **virname, long int *scanned, con
1087 1087
     free(tempname);
1088 1088
     return ret;
1089 1089
 }
1090
-static int cli_scanmail(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1090
+static int cli_scanmail(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
1091 1091
 {
1092 1092
 	const char *tmpdir;
1093 1093
 	char *dir;
... ...
@@ -1124,7 +1124,7 @@ static int cli_scanmail(int desc, const char **virname, long int *scanned, const
1124 1124
 	return ret;
1125 1125
 }
1126 1126
 
1127
-int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1127
+int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
1128 1128
 {
1129 1129
 	char magic[MAGIC_BUFFER_SIZE + 1];
1130 1130
 	int ret = CL_CLEAN, nret;
... ...
@@ -1172,74 +1172,74 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1172 1172
     lseek(desc, 0, SEEK_SET);
1173 1173
     type = cli_filetype(magic, bread);
1174 1174
 
1175
-    type == CL_MAILFILE ? (*mrec)++ : (*arec)++;
1175
+    type == CL_TYPE_MAIL ? (*mrec)++ : (*arec)++;
1176 1176
 
1177 1177
     switch(type) {
1178
-	case CL_RARFILE:
1178
+	case CL_TYPE_RAR:
1179 1179
 	    if(!DISABLE_RAR && SCAN_ARCHIVE && !cli_scanrar_inuse)
1180 1180
 		ret = cli_scanrar(desc, virname, scanned, root, limits, options, arec, mrec);
1181 1181
 	    break;
1182 1182
 
1183
-	case CL_ZIPFILE:
1183
+	case CL_TYPE_ZIP:
1184 1184
 	    if(SCAN_ARCHIVE)
1185 1185
 		ret = cli_scanzip(desc, virname, scanned, root, limits, options, arec, mrec);
1186 1186
 	    break;
1187 1187
 
1188
-	case CL_GZFILE:
1188
+	case CL_TYPE_GZ:
1189 1189
 	    if(SCAN_ARCHIVE)
1190 1190
 		ret = cli_scangzip(desc, virname, scanned, root, limits, options, arec, mrec);
1191 1191
 	    break;
1192 1192
 
1193
-	case CL_BZFILE:
1193
+	case CL_TYPE_BZ:
1194 1194
 #ifdef HAVE_BZLIB_H
1195 1195
 	    if(SCAN_ARCHIVE)
1196 1196
 		ret = cli_scanbzip(desc, virname, scanned, root, limits, options, arec, mrec);
1197 1197
 #endif
1198 1198
 	    break;
1199 1199
 
1200
-	case CL_MSCFILE:
1200
+	case CL_TYPE_MSSZDD:
1201 1201
 	    if(SCAN_ARCHIVE)
1202
-		ret = cli_scanmscomp(desc, virname, scanned, root, limits, options, arec, mrec);
1202
+		ret = cli_scanszdd(desc, virname, scanned, root, limits, options, arec, mrec);
1203 1203
 	    break;
1204 1204
 
1205
-	case CL_MSCABFILE:
1205
+	case CL_TYPE_MSCAB:
1206 1206
 	    if(SCAN_ARCHIVE)
1207 1207
 		ret = cli_scanmscab(desc, virname, scanned, root, limits, options, arec, mrec);
1208 1208
 	    break;
1209 1209
 
1210
-	case CL_MAILFILE:
1210
+	case CL_TYPE_MAIL:
1211 1211
 	    if(SCAN_MAIL)
1212 1212
 		ret = cli_scanmail(desc, virname, scanned, root, limits, options, arec, mrec);
1213 1213
 	    break;
1214 1214
 
1215
-	case CL_MSCHMFILE:
1215
+	case CL_TYPE_MSCHM:
1216 1216
 	    if(SCAN_ARCHIVE)
1217 1217
 		ret = cli_scanmschm(desc, virname, scanned, root, limits, options, arec, mrec);
1218 1218
 	    break;
1219 1219
 
1220
-	case CL_OLE2FILE:
1220
+	case CL_TYPE_MSOLE2:
1221 1221
 	    if(SCAN_OLE2)
1222 1222
 		ret = cli_scanole2(desc, virname, scanned, root, limits, options, arec, mrec);
1223 1223
 	    break;
1224 1224
 
1225
-	case CL_TARFILE:
1225
+	case CL_TYPE_TAR:
1226 1226
 	    if(SCAN_ARCHIVE)
1227 1227
 		ret = cli_scantar(desc, virname, scanned, root, limits, options, arec, mrec);
1228 1228
 	    break;
1229 1229
 
1230
-	case CL_SCRENC:
1230
+	case CL_TYPE_SCRENC:
1231 1231
 	    ret = cli_scanscrenc(desc, virname, scanned, root, limits, options, arec, mrec);
1232 1232
 	    break;
1233 1233
 
1234
-	case CL_DATAFILE:
1234
+	case CL_TYPE_DATA:
1235 1235
 	    /* it could be a false positive and a standard DOS .COM file */
1236 1236
 	    {
1237 1237
 		struct stat s;
1238 1238
 		if(fstat(desc, &s) == 0 && S_ISREG(s.st_mode) && s.st_size < 65536)
1239
-		type = CL_UNKNOWN_DATA_TYPE;
1239
+		type = CL_TYPE_UNKNOWN_DATA;
1240 1240
 	    }
1241 1241
 
1242
-	case CL_UNKNOWN_DATA_TYPE:
1242
+	case CL_TYPE_UNKNOWN_DATA:
1243 1243
 	    ret = cli_scan_mydoom_log(desc, virname, scanned, root, limits, options, arec, mrec);
1244 1244
 	    break;
1245 1245
 
... ...
@@ -1247,12 +1247,12 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1247 1247
 	    break;
1248 1248
     }
1249 1249
 
1250
-    type == CL_MAILFILE ? (*mrec)-- : (*arec)--;
1250
+    type == CL_TYPE_MAIL ? (*mrec)-- : (*arec)--;
1251 1251
 
1252
-    if(type != CL_DATAFILE && ret != CL_VIRUS) { /* scan the raw file */
1252
+    if(type != CL_TYPE_DATA && ret != CL_VIRUS) { /* scan the raw file */
1253 1253
 	    int typerec;
1254 1254
 
1255
-	type == CL_UNKNOWN_TEXT_TYPE ? (typerec = 1) : (typerec = 0);
1255
+	type == CL_TYPE_UNKNOWN_TEXT ? (typerec = 1) : (typerec = 0);
1256 1256
 	lseek(desc, 0, SEEK_SET);
1257 1257
 
1258 1258
 	if((nret = cli_scandesc(desc, virname, scanned, root, typerec)) == CL_VIRUS) {
... ...
@@ -1263,13 +1263,13 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1263 1263
 	    lseek(desc, 0, SEEK_SET);
1264 1264
 
1265 1265
 	    switch(nret) {
1266
-		case CL_HTMLFILE:
1266
+		case CL_TYPE_HTML:
1267 1267
 		    if(SCAN_HTML)
1268 1268
 			if(cli_scanhtml(desc, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS)
1269 1269
 			    return CL_VIRUS;
1270 1270
 		    break;
1271 1271
 
1272
-		case CL_MAILFILE:
1272
+		case CL_TYPE_MAIL:
1273 1273
 		    if(SCAN_MAIL)
1274 1274
 			if(cli_scanmail(desc, virname, scanned, root, limits, options, arec, mrec) == CL_VIRUS)
1275 1275
 			    return CL_VIRUS;
... ...
@@ -1284,7 +1284,7 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1284 1284
 	/* Due to performance reasons all executables were first scanned
1285 1285
 	 * in raw mode. Now we will try to unpack them
1286 1286
 	 */
1287
-	case CL_DOSEXE:
1287
+	case CL_TYPE_MSEXE:
1288 1288
 	    if(SCAN_PE)
1289 1289
 		ret = cli_scanpe(desc, virname, scanned, root, limits, options, arec, mrec);
1290 1290
 	    break;
... ...
@@ -1298,14 +1298,14 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
1298 1298
     return ret;
1299 1299
 }
1300 1300
 
1301
-int cl_scandesc(int desc, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options)
1301
+int cl_scandesc(int desc, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options)
1302 1302
 {
1303 1303
 	int arec = 0, mrec = 0;
1304 1304
 
1305 1305
     return cli_magic_scandesc(desc, virname, scanned, root, limits, options, &arec, &mrec);
1306 1306
 }
1307 1307
 
1308
-static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec)
1308
+static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec)
1309 1309
 {
1310 1310
 	int fd, ret;
1311 1311
 
... ...
@@ -1320,7 +1320,7 @@ static int cli_scanfile(const char *filename, const char **virname, unsigned lon
1320 1320
     return ret;
1321 1321
 }
1322 1322
 
1323
-int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options)
1323
+int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options)
1324 1324
 {
1325 1325
 	int fd, ret;
1326 1326
 
... ...
@@ -21,6 +21,6 @@
21 21
 
22 22
 #include "clamav.h"
23 23
 
24
-int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *arec, int *mrec);
24
+int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, unsigned int options, int *arec, int *mrec);
25 25
 
26 26
 #endif