Browse code

minor clamav.h (and related) cleanup

git-svn: trunk@2470

Tomasz Kojm authored on 2006/11/02 01:04:54
Showing 7 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Nov  1 17:03:54 CET 2006 (tk)
2
+---------------------------------
3
+  * libclamav: minor clamav.h (and related) cleanup
4
+
1 5
 Mon Oct 30 19:29:36 CET 2006 (tk)
2 6
 ---------------------------------
3 7
   * 0.90RC2 (released with JS and PST code removed)
... ...
@@ -28,73 +28,71 @@ extern "C"
28 28
 {
29 29
 #endif
30 30
 
31
-
32 31
 #define CL_COUNT_PRECISION 4096
33 32
 
34 33
 /* return codes */
35
-#define CL_CLEAN	0   /* virus not found */
36
-#define CL_VIRUS	1   /* virus found */
34
+#define CL_CLEAN	0   /* no virus found */
35
+#define CL_VIRUS	1   /* virus(es) found */
37 36
 #define CL_SUCCESS	CL_CLEAN
38 37
 
39
-#define CL_EMAXREC	10  /* recursion level limit exceeded */
40
-#define CL_EMAXSIZE	11  /* size limit exceeded */
41
-#define CL_EMAXFILES	12  /* files limit exceeded */
42
-#define CL_ERAR		100 /* rar handler error */
43
-#define CL_EZIP		101 /* zip handler error */
44
-#define	CL_EMALFZIP	102 /* malformed zip */
45
-#define CL_EGZIP	103 /* gzip handler error */
46
-#define CL_EBZIP	104 /* bzip2 handler error */
47
-#define CL_EOLE2	105 /* OLE2 handler error */
48
-#define CL_EMSCOMP	106 /* compress.exe handler error */
49
-#define CL_EMSCAB	107 /* MS CAB module error */
50
-#define CL_EACCES	200 /* access denied */
51
-#define CL_ENULLARG	300 /* null argument error */
52
-
53
-#define CL_ETMPFILE	-1  /* tmpfile() failed */
54
-#define CL_EFSYNC	-2  /* fsync() failed */
55
-#define CL_EMEM		-3  /* memory allocation error */
56
-#define CL_EOPEN	-4  /* file open error */
57
-#define CL_EMALFDB	-5  /* malformed database */
58
-#define CL_EPATSHORT	-6  /* pattern too short */
59
-#define CL_ETMPDIR	-7  /* mkdir() failed */
60
-#define CL_ECVD		-8  /* not a CVD file (or broken) */
61
-#define CL_ECVDEXTR	-9  /* CVD extraction failure */
62
-#define CL_EMD5		-10 /* MD5 verification error */
63
-#define CL_EDSIG	-11 /* digital signature verification error */
64
-#define CL_EIO		-12 /* general I/O error */
65
-#define CL_EFORMAT	-13 /* bad format or broken file */
66
-#define CL_ESUPPORT	-14 /* not supported data format */
67
-
68
-#define CL_EHWINIT	-15 /* hardware initialization failed */
69
-#define	CL_EHWLOAD	-16 /* error loading hardware database */
70
-#define CL_EHWIO	-17 /* general hardware I/O error */
71
-
38
+#define CL_EMAXREC	-100 /* recursion limit exceeded */
39
+#define CL_EMAXSIZE	-101 /* size limit exceeded */
40
+#define CL_EMAXFILES	-102 /* files limit exceeded */
41
+#define CL_ERAR		-103 /* rar handler error */
42
+#define CL_EZIP		-104 /* zip handler error */
43
+#define CL_EGZIP	-105 /* gzip handler error */
44
+#define CL_EBZIP	-106 /* bzip2 handler error */
45
+#define CL_EOLE2	-107 /* OLE2 handler error */
46
+#define CL_EMSCOMP	-108 /* MS Expand handler error */
47
+#define CL_EMSCAB	-109 /* MS CAB module error */
48
+#define CL_EACCES	-110 /* access denied */
49
+#define CL_ENULLARG	-111 /* null argument */
50
+#define CL_ETMPFILE	-112 /* tmpfile() failed */
51
+#define CL_EFSYNC	-113 /* fsync() failed */
52
+#define CL_EMEM		-114 /* memory allocation error */
53
+#define CL_EOPEN	-115 /* file open error */
54
+#define CL_EMALFDB	-116 /* malformed database */
55
+#define CL_EPATSHORT	-117 /* pattern too short */
56
+#define CL_ETMPDIR	-118 /* mkdir() failed */
57
+#define CL_ECVD		-119 /* not a CVD file (or broken) */
58
+#define CL_ECVDEXTR	-120 /* CVD extraction failure */
59
+#define CL_EMD5		-121 /* MD5 verification error */
60
+#define CL_EDSIG	-122 /* digital signature verification error */
61
+#define CL_EIO		-123 /* general I/O error */
62
+#define CL_EFORMAT	-124 /* bad format or broken file */
63
+#define CL_ESUPPORT	-125 /* not supported data format */
64
+
65
+/* NodalCore */
66
+#define CL_ENCINIT	-200 /* NodalCore initialization failed */
67
+#define	CL_ENCLOAD	-201 /* error loading NodalCore database */
68
+#define CL_ENCIO	-202 /* general NodalCore I/O error */
72 69
 
73 70
 /* db options */
74
-#define CL_DB_NCORE		1
75
-#define CL_DB_NOPHISHING	2
76
-#define CL_DB_ACONLY		4   /* for developers only */
71
+#define CL_DB_NCORE	    0x1
72
+#define CL_DB_NOPHISHING    0x2
73
+#define CL_DB_ACONLY	    0x4 /* WARNING: only for developers */
77 74
 
78
-#define CL_DB_STDOPT		0
75
+/* recommended db settings */
76
+#define CL_DB_STDOPT	    0x0
79 77
 
80 78
 /* scan options */
81
-#define CL_SCAN_RAW		0
82
-#define CL_SCAN_ARCHIVE		1
83
-#define CL_SCAN_MAIL		2
84
-#define CL_SCAN_OLE2		4
85
-#define CL_SCAN_BLOCKENCRYPTED	8
86
-#define CL_SCAN_HTML		16
87
-#define CL_SCAN_PE		32
88
-#define CL_SCAN_BLOCKBROKEN	64
89
-#define CL_SCAN_MAILURL		128
90
-#define CL_SCAN_BLOCKMAX	256
91
-#define CL_SCAN_ALGO		512
92
-#define CL_SCAN_NOPHISHING      1024
93
-#define CL_PHISH_NO_DOMAINLIST  4096
94
-#define CL_SCAN_ELF		8192
95
-
96
-/* recommended options */
97
-#define CL_SCAN_STDOPT		(CL_SCAN_ARCHIVE | CL_SCAN_MAIL | CL_SCAN_OLE2 | CL_SCAN_HTML | CL_SCAN_PE | CL_SCAN_ALGO) 
79
+#define CL_SCAN_RAW		0x0
80
+#define CL_SCAN_ARCHIVE		0x1
81
+#define CL_SCAN_MAIL		0x2
82
+#define CL_SCAN_OLE2		0x4
83
+#define CL_SCAN_BLOCKENCRYPTED	0x8
84
+#define CL_SCAN_HTML		0x10
85
+#define CL_SCAN_PE		0x20
86
+#define CL_SCAN_BLOCKBROKEN	0x40
87
+#define CL_SCAN_MAILURL		0x80
88
+#define CL_SCAN_BLOCKMAX	0x100
89
+#define CL_SCAN_ALGO		0x200
90
+#define CL_SCAN_NOPHISHING      0x400
91
+#define CL_PHISH_NO_DOMAINLIST  0x800
92
+#define CL_SCAN_ELF		0x1000
93
+
94
+/* recommended scan settings */
95
+#define CL_SCAN_STDOPT		(CL_SCAN_ARCHIVE | CL_SCAN_MAIL | CL_SCAN_OLE2 | CL_SCAN_HTML | CL_SCAN_PE | CL_SCAN_ALGO | CL_SCAN_ELF) 
98 96
 
99 97
 /* aliases for backward compatibility */
100 98
 #define CL_RAW		CL_SCAN_RAW
... ...
@@ -104,7 +102,7 @@ extern "C"
104 104
 #define CL_ENCRYPTED    CL_SCAN_BLOCKENCRYPTED
105 105
 #define cl_node		cl_engine
106 106
 
107
-
107
+/* internal structures */
108 108
 struct cli_bm_patt {
109 109
     char *pattern, *virname, *offset;
110 110
     const char *viralias;
... ...
@@ -125,7 +123,7 @@ struct cli_ac_patt {
125 125
 };
126 126
 
127 127
 struct cli_ac_node {
128
-    char islast;
128
+    unsigned char islast;
129 129
     struct cli_ac_patt *list;
130 130
     struct cli_ac_node *trans[256], *fail;
131 131
 };
... ...
@@ -189,33 +187,33 @@ struct cl_engine {
189 189
 };
190 190
 
191 191
 struct cl_limits {
192
-    unsigned int maxreclevel; /* maximal recursion level */
193
-    unsigned int maxfiles; /* maximal number of files to be
194
-			    * scanned within an archive
195
-			    */
196
-    unsigned int maxratio; /* maximal compression ratio */
197
-    unsigned short archivememlim; /* limit memory usage for bzip2 (0/1) */
198
-    unsigned long int maxfilesize; /* files in an archive larger than
199
-				    * this limit will not be scanned
200
-				    */
192
+    unsigned int maxreclevel;	    /* maximum recursion level */
193
+    unsigned int maxfiles;	    /* maximum number of files to be scanned
194
+				     * within a single archive
195
+				     */
196
+    unsigned int maxratio;	    /* maximum compression ratio */
197
+    unsigned short archivememlim;   /* limit memory usage for some unpackers */
198
+    unsigned long int maxfilesize;  /* compressed files larger than this limit
199
+				     * will not be scanned
200
+				     */
201 201
 };
202 202
 
203 203
 struct cl_stat {
204 204
     char *dir;
205
-    int no;
205
+    unsigned int entries;
206 206
     struct stat *stattab;
207 207
     char **statdname;
208 208
 };
209 209
 
210
-struct cl_cvd {
211
-    char *time;	    /* 2 */
212
-    int version;    /* 3 */
213
-    int sigs;	    /* 4 */
214
-    short int fl;   /* 5 */
215
-    char *md5;	    /* 6 */
216
-    char *dsig;	    /* 7 */
217
-    char *builder;  /* 8 */
218
-    int stime;	    /* 9 */
210
+struct cl_cvd {		    /* field no. */
211
+    char *time;		    /* 2 */
212
+    unsigned int version;   /* 3 */
213
+    unsigned int sigs;	    /* 4 */
214
+    unsigned int fl;	    /* 5 */
215
+    char *md5;		    /* 6 */
216
+    char *dsig;		    /* 7 */
217
+    char *builder;	    /* 8 */
218
+    unsigned int stime;	    /* 9 */
219 219
 };
220 220
 
221 221
 /* file scanning */
... ...
@@ -223,16 +221,14 @@ extern int cl_scandesc(int desc, const char **virname, unsigned long int *scanne
223 223
 
224 224
 extern int cl_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_engine *engine, const struct cl_limits *limits, unsigned int options);
225 225
 
226
-/* software versions */
227
-extern int cl_retflevel(void);
228
-extern const char *cl_retver(void);
229
-
230
-/* database */
231
-extern int cl_loaddb(const char *filename, struct cl_engine **engine, unsigned int *signo);
232
-extern int cl_loaddbdir(const char *dirname, struct cl_engine **engine, unsigned int *signo);
226
+/* database handling */
233 227
 extern int cl_load(const char *path, struct cl_engine **engine, unsigned int *signo, unsigned int options);
234 228
 extern const char *cl_retdbdir(void);
229
+
230
+/* engine handling */
231
+extern int cl_build(struct cl_engine *engine);
235 232
 extern struct cl_engine *cl_dup(struct cl_engine *engine);
233
+extern void cl_free(struct cl_engine *engine);
236 234
 
237 235
 /* CVD */
238 236
 extern struct cl_cvd *cl_cvdhead(const char *file);
... ...
@@ -240,23 +236,24 @@ extern struct cl_cvd *cl_cvdparse(const char *head);
240 240
 extern int cl_cvdverify(const char *file);
241 241
 extern void cl_cvdfree(struct cl_cvd *cvd);
242 242
 
243
-/* data dir stat functions */
243
+/* db dir stat functions */
244 244
 extern int cl_statinidir(const char *dirname, struct cl_stat *dbstat);
245 245
 extern int cl_statchkdir(const struct cl_stat *dbstat);
246 246
 extern int cl_statfree(struct cl_stat *dbstat);
247 247
 
248
-/* enable debug information */
248
+/* enable debug messages */
249 249
 extern void cl_debug(void);
250 250
 
251
-extern void cl_settempdir(const char *dir, short leavetemps);
252
-
253
-extern int cl_build(struct cl_engine *engine);
254
-extern void cl_free(struct cl_engine *engine);
251
+/* software versions */
252
+extern unsigned int cl_retflevel(void);
253
+extern const char *cl_retver(void);
255 254
 
255
+/* others */
256
+extern void cl_settempdir(const char *dir, short leavetemps);
256 257
 extern const char *cl_strerror(int clerror);
257 258
 
258 259
 #ifdef __cplusplus
259 260
 }
260 261
 #endif
261 262
  
262
-#endif
263
+#endif /* __CLAMAV_H */
... ...
@@ -217,7 +217,7 @@ struct cl_cvd *cl_cvdparse(const char *head)
217 217
 	free(cvd);
218 218
 	return NULL;
219 219
     }
220
-    cvd->fl = (short int) atoi(pt);
220
+    cvd->fl = atoi(pt);
221 221
     free(pt);
222 222
 
223 223
     if(!(cvd->md5 = cli_strtok(head, 5, ":"))) {
... ...
@@ -77,18 +77,18 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname,
77 77
 	/* TODO: Setup proper data bitmask (need specs) */
78 78
 	if((hret = sn_sigscan_createstream(engine->ncdb, datamask, 2, &streamhandle)) < 0) {
79 79
 	    cli_errmsg("cli_scanbuff: can't create new hardware stream: %d\n", hret);
80
-	    return CL_EHWIO;
80
+	    return CL_ENCIO;
81 81
 	}
82 82
 
83 83
 	if((hret = sn_sigscan_writestream(streamhandle, buffer, length)) < 0) {
84 84
 	    cli_errmsg("cli_scanbuff: can't write %u bytes to hardware stream: %d\n", length, hret);
85 85
 	    sn_sigscan_closestream(streamhandle, &resulthandle);
86
-	    return CL_EHWIO;
86
+	    return CL_ENCIO;
87 87
 	}
88 88
 
89 89
 	if((hret = sn_sigscan_closestream(streamhandle, &resulthandle)) < 0) {
90 90
 	    cli_errmsg("cli_scanbuff: can't close hardware stream: %d\n", hret);
91
-	    return CL_EHWIO;
91
+	    return CL_ENCIO;
92 92
 	}
93 93
 
94 94
 	count = sn_sigscan_resultcount(resulthandle);
... ...
@@ -100,7 +100,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname,
100 100
 	    if((hret = sn_sigscan_resultget_name(resulthandle, i, &matchname) < 0)) {
101 101
 		cli_errmsg("cli_scanbuff: sn_sigscan_resultget_name failed for result %d: %d\n", i, hret);
102 102
 		sn_sigscan_resultfree(resulthandle);
103
-		return CL_EHWIO;
103
+		return CL_ENCIO;
104 104
 	    }
105 105
 	    if(!matchname) {
106 106
 		cli_errmsg("cli_scanbuff: HW Result[%d]: Signature without name\n", i);
... ...
@@ -111,7 +111,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname,
111 111
 	    if((hret = sn_sigscan_resultget_targettype(resulthandle, i, &targettype) < 0)) {
112 112
 		cli_errmsg("cli_scanbuff: sn_sigscan_resultget_targettype failed for result %d, signature %s: %d\n", i, matchname, hret);
113 113
 		sn_sigscan_resultfree(resulthandle);
114
-		return CL_EHWIO;
114
+		return CL_ENCIO;
115 115
 	    }
116 116
 	    if(targettype && targettab[targettype] != (int) ftype) {
117 117
 		cli_dbgmsg("cli_scanbuff: HW Result[%d]: %s: Target type: %d, expected: %d\n", i, matchname, targettab[targettype], ftype);
... ...
@@ -121,7 +121,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname,
121 121
 	    if((hret = sn_sigscan_resultget_offsetstring(resulthandle, i, &offsetstring) < 0)) {
122 122
 		cli_errmsg("cli_scanbuff: sn_sigscan_resultget_offsetstring failed for result %d, signature %s: %d\n", i, matchname, hret);
123 123
 		sn_sigscan_resultfree(resulthandle);
124
-		return CL_EHWIO;
124
+		return CL_ENCIO;
125 125
 	    }
126 126
 	    if(offsetstring) {
127 127
 		cli_dbgmsg("cli_scanbuff: HW Result[%d]: %s: Offset based signature not supported in buffer mode\n", i, matchname);
... ...
@@ -131,7 +131,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname,
131 131
 	    if((hret = sn_sigscan_resultget_extradata(resulthandle, i, &optionalsigdata) < 0)) {
132 132
 		cli_errmsg("cli_scanbuff: sn_sigscan_resultget_extradata failed for result %d, signature %s: %d\n", i, matchname, hret);
133 133
 		sn_sigscan_resultfree(resulthandle);
134
-		return CL_EHWIO;
134
+		return CL_ENCIO;
135 135
 	    }
136 136
 	    if(optionalsigdata && strlen(optionalsigdata)) {
137 137
 		if((pt = cli_strtok(optionalsigdata, 1, ":"))) { /* max version */
... ...
@@ -186,7 +186,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname,
186 186
 
187 187
 	if((hret = sn_sigscan_resultfree(resulthandle)) < 0) {
188 188
 	    cli_errmsg("cli_scanbuff: can't free results: %d\n", ret);
189
-	    return CL_EHWIO;
189
+	    return CL_ENCIO;
190 190
 	}
191 191
 
192 192
 	return ret;
... ...
@@ -436,7 +436,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
436 436
 	/* TODO: Setup proper data bitmask (need specs) */
437 437
 	if((hret = sn_sigscan_createstream(ctx->engine->ncdb, datamask, 2, &streamhandle)) < 0) {
438 438
 	    cli_errmsg("cli_scandesc: can't create new hardware stream: %d\n", hret);
439
-	    return CL_EHWIO;
439
+	    return CL_ENCIO;
440 440
 	}
441 441
 
442 442
 	if(!(buffer = (char *) cli_calloc(HWBUFFSIZE, sizeof(char)))) {
... ...
@@ -456,7 +456,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
456 456
 	while((bytes = cli_readn(desc, buffer, HWBUFFSIZE)) > 0) {
457 457
 	    if((hret = sn_sigscan_writestream(streamhandle, buffer, bytes)) < 0) {
458 458
 		cli_errmsg("cli_scandesc: can't write to hardware stream: %d\n", hret);
459
-		ret = CL_EHWIO;
459
+		ret = CL_ENCIO;
460 460
 		break;
461 461
 	    } else {
462 462
 		if(ctx->scanned)
... ...
@@ -471,7 +471,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
471 471
 
472 472
 	if((hret = sn_sigscan_closestream(streamhandle, &resulthandle)) < 0) {
473 473
 	    cli_errmsg("cli_scandesc: can't close hardware stream: %d\n", hret);
474
-	    return CL_EHWIO;
474
+	    return CL_ENCIO;
475 475
 	}
476 476
 
477 477
 	count = sn_sigscan_resultcount(resulthandle);
... ...
@@ -484,7 +484,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
484 484
 	    if((hret = sn_sigscan_resultget_name(resulthandle, i, &matchname) < 0)) {
485 485
 		cli_errmsg("cli_scandesc: sn_sigscan_resultget_name failed for result %d: %d\n", i, hret);
486 486
 		sn_sigscan_resultfree(resulthandle);
487
-		return CL_EHWIO;
487
+		return CL_ENCIO;
488 488
 	    }
489 489
 
490 490
 	    if(!matchname) {
... ...
@@ -496,7 +496,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
496 496
 	    if((hret = sn_sigscan_resultget_targettype(resulthandle, i, &targettype) < 0)) {
497 497
 		cli_errmsg("cli_scandesc: sn_sigscan_resultget_targettype failed for result %d, signature %s: %d\n", i, matchname, hret);
498 498
 		sn_sigscan_resultfree(resulthandle);
499
-		return CL_EHWIO;
499
+		return CL_ENCIO;
500 500
 	    }
501 501
 	    if(targettype && targettab[targettype] != (int) ftype) {
502 502
 		cli_dbgmsg("cli_scandesc: HW Result[%d]: %s: Target type: %d, expected: %d\n", i, matchname, targettab[targettype], ftype);
... ...
@@ -506,12 +506,12 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
506 506
 	    if((hret = sn_sigscan_resultget_offsetstring(resulthandle, i, &offsetstring) < 0)) {
507 507
 		cli_errmsg("cli_scandesc: sn_sigscan_resultget_offsetstring failed for result %d, signature %s: %d\n", i, matchname, hret);
508 508
 		sn_sigscan_resultfree(resulthandle);
509
-		return CL_EHWIO;
509
+		return CL_ENCIO;
510 510
 	    }
511 511
 	    if((hret = sn_sigscan_resultget_startoffset(resulthandle, i, &startoffset) < 0)) {
512 512
 		cli_errmsg("cli_scandesc: sn_sigscan_resultget_startoffset failed for result %d, signature %s: %d\n", i, matchname, hret);
513 513
 		sn_sigscan_resultfree(resulthandle);
514
-		return CL_EHWIO;
514
+		return CL_ENCIO;
515 515
 	    }
516 516
 	    if(offsetstring && strcmp(offsetstring, "*")) {
517 517
 		    long int off = cli_caloff(offsetstring, desc, ftype);
... ...
@@ -531,7 +531,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
531 531
 	    if((hret = sn_sigscan_resultget_extradata(resulthandle, i, &optionalsigdata) < 0)) {
532 532
 		cli_errmsg("cli_scandesc: sn_sigscan_resultget_extradata failed for result %d, signature %s: %d\n", i, matchname, hret);
533 533
 		sn_sigscan_resultfree(resulthandle);
534
-		return CL_EHWIO;
534
+		return CL_ENCIO;
535 535
 	    }
536 536
 	    if(optionalsigdata && strlen(optionalsigdata)) {
537 537
 		if((pt = cli_strtok(optionalsigdata, 1, ":"))) { /* max version */
... ...
@@ -586,7 +586,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f
586 586
 
587 587
 	if((hret = sn_sigscan_resultfree(resulthandle)) < 0) {
588 588
 	    cli_errmsg("cli_scandesc: can't free results: %d\n", ret);
589
-	    return CL_EHWIO;
589
+	    return CL_ENCIO;
590 590
 	}
591 591
 
592 592
 	if(ctx->engine->md5_hlist) {
... ...
@@ -152,7 +152,7 @@ void cl_debug(void)
152 152
     cli_debug_flag = 1;
153 153
 }
154 154
 
155
-int cl_retflevel(void)
155
+unsigned int cl_retflevel(void)
156 156
 {
157 157
     return CL_FLEVEL;
158 158
 }
... ...
@@ -179,8 +179,6 @@ const char *cl_strerror(int clerror)
179 179
 	    return "RAR module failure";
180 180
 	case CL_EZIP:
181 181
 	    return "Zip module failure";
182
-	case CL_EMALFZIP:
183
-	    return "Malformed Zip detected";
184 182
 	case CL_EGZIP:
185 183
 	    return "GZip module failure";
186 184
 	case CL_EMSCOMP:
... ...
@@ -219,12 +217,12 @@ const char *cl_strerror(int clerror)
219 219
 	    return "Bad format or broken data";
220 220
 	case CL_ESUPPORT:
221 221
 	    return "Not supported data format";
222
-	case CL_EHWINIT:
223
-	    return "Hardware initialization failure";
224
-	case CL_EHWLOAD:
225
-	    return "Error loading hardware database";
226
-	case CL_EHWIO:
227
-	    return "Hardware accelerator Input/Output error";
222
+	case CL_ENCINIT:
223
+	    return "NodalCore initialization failure";
224
+	case CL_ENCLOAD:
225
+	    return "Error loading NodalCore database";
226
+	case CL_ENCIO:
227
+	    return "NodalCore accelerator Input/Output error";
228 228
 	default:
229 229
 	    return "Unknown error code";
230 230
     }
... ...
@@ -1111,7 +1111,7 @@ static int cli_loadncdb(const char *filename, struct cl_engine **engine, unsigne
1111 1111
     if((ret = sn_sigscan_initdb(&(*engine)->ncdb)) < 0) {
1112 1112
 	cli_errmsg("cli_loadncdb: error initializing the matcher: %d\n", ret);
1113 1113
 	cl_free(*engine);
1114
-	return CL_EHWINIT;
1114
+	return CL_ENCINIT;
1115 1115
     }
1116 1116
 
1117 1117
     (*engine)->ncore = 1;
... ...
@@ -1119,7 +1119,7 @@ static int cli_loadncdb(const char *filename, struct cl_engine **engine, unsigne
1119 1119
     if((ret = sn_sigscan_loaddb((*engine)->ncdb, filename, 0, &newsigs)) < 0) {
1120 1120
 	cli_errmsg("cli_loadncdb: can't load hardware database: %d\n", ret);
1121 1121
 	cl_free(*engine);
1122
-	return CL_EHWLOAD;
1122
+	return CL_ENCLOAD;
1123 1123
     }
1124 1124
 
1125 1125
     *signo += newsigs;
... ...
@@ -1353,7 +1353,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
1353 1353
 
1354 1354
 
1355 1355
     if(dbstat) {
1356
-	dbstat->no = 0;
1356
+	dbstat->entries = 0;
1357 1357
 	dbstat->stattab = NULL;
1358 1358
 	dbstat->statdname = NULL;
1359 1359
 	dbstat->dir = strdup(dirname);
... ...
@@ -1399,10 +1399,10 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
1399 1399
 	    cli_strbcasestr(dent->d_name, ".inc")   ||
1400 1400
 	    cli_strbcasestr(dent->d_name, ".cvd"))) {
1401 1401
 
1402
-		dbstat->no++;
1403
-		dbstat->stattab = (struct stat *) realloc(dbstat->stattab, dbstat->no * sizeof(struct stat));
1402
+		dbstat->entries++;
1403
+		dbstat->stattab = (struct stat *) realloc(dbstat->stattab, dbstat->entries * sizeof(struct stat));
1404 1404
 #if defined(C_INTERIX) || defined(C_OS2)
1405
-		dbstat->statdname = (char **) realloc(dbstat->statdname, dbstat->no * sizeof(char *));
1405
+		dbstat->statdname = (char **) realloc(dbstat->statdname, dbstat->entries * sizeof(char *));
1406 1406
 #endif
1407 1407
 
1408 1408
                 fname = cli_calloc(strlen(dirname) + strlen(dent->d_name) + 32, sizeof(char));
... ...
@@ -1415,10 +1415,10 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
1415 1415
 		    sprintf(fname, "%s/%s", dirname, dent->d_name);
1416 1416
 		}
1417 1417
 #if defined(C_INTERIX) || defined(C_OS2)
1418
-		dbstat->statdname[dbstat->no - 1] = (char *) cli_calloc(strlen(dent->d_name) + 1, sizeof(char));
1419
-		strcpy(dbstat->statdname[dbstat->no - 1], dent->d_name);
1418
+		dbstat->statdname[dbstat->entries - 1] = (char *) cli_calloc(strlen(dent->d_name) + 1, sizeof(char));
1419
+		strcpy(dbstat->statdname[dbstat->entries - 1], dent->d_name);
1420 1420
 #endif
1421
-		stat(fname, &dbstat->stattab[dbstat->no - 1]);
1421
+		stat(fname, &dbstat->stattab[dbstat->entries - 1]);
1422 1422
 		free(fname);
1423 1423
 	    }
1424 1424
 	}
... ...
@@ -1498,7 +1498,7 @@ int cl_statchkdir(const struct cl_stat *dbstat)
1498 1498
 		free(fname);
1499 1499
 
1500 1500
 		found = 0;
1501
-		for(i = 0; i < dbstat->no; i++)
1501
+		for(i = 0; i < dbstat->entries; i++)
1502 1502
 #if defined(C_INTERIX) || defined(C_OS2)
1503 1503
 		    if(!strcmp(dbstat->statdname[i], dent->d_name)) {
1504 1504
 #else
... ...
@@ -1531,7 +1531,7 @@ int cl_statfree(struct cl_stat *dbstat)
1531 1531
 #if defined(C_INTERIX) || defined(C_OS2)
1532 1532
 	    int i;
1533 1533
 
1534
-	for(i = 0;i < dbstat->no; i++) {
1534
+	for(i = 0;i < dbstat->entries; i++) {
1535 1535
 	    free(dbstat->statdname[i]);
1536 1536
 	    dbstat->statdname[i] = NULL;
1537 1537
 	}
... ...
@@ -1541,7 +1541,7 @@ int cl_statfree(struct cl_stat *dbstat)
1541 1541
 
1542 1542
 	free(dbstat->stattab);
1543 1543
 	dbstat->stattab = NULL;
1544
-	dbstat->no = 0;
1544
+	dbstat->entries = 0;
1545 1545
 	if(dbstat->dir) {
1546 1546
 	    free(dbstat->dir);
1547 1547
 	    dbstat->dir = NULL;
... ...
@@ -492,11 +492,6 @@ static int cli_scanzip(int desc, cli_ctx *ctx, off_t sfx_offset, uint32_t *sfx_c
492 492
 	    cli_dbgmsg("Zip: Infected with %s\n", *ctx->virname);
493 493
 	    ret = CL_VIRUS;
494 494
 	    break;
495
-	} else if(ret == CL_EMALFZIP) {
496
-	    cli_dbgmsg("Zip: Malformed Zip file, scanning stopped.\n");
497
-	    *ctx->virname = "Suspect.Zip";
498
-	    ret = CL_VIRUS;
499
-	    break;
500 495
 	}
501 496
 
502 497
 	if(tmp) {