git-svn: trunk@2427
Tomasz Kojm authored on 2006/10/24 00:51:44... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon Oct 23 17:48:39 CEST 2006 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: improve support for NodalCore SDK 3.3 |
|
4 |
+ |
|
1 | 5 |
Sun Oct 22 11:24:07 BST 2006 (njh) |
2 | 6 |
---------------------------------- |
3 | 7 |
* libclamav/pdf.c: Handle ASCII85 encoded Flated objectes (bug#43) |
... | ... |
@@ -178,8 +178,8 @@ struct cl_engine { |
178 | 178 |
/* RAR metadata */ |
179 | 179 |
struct cli_meta_node *rar_mlist; |
180 | 180 |
|
181 |
- /* Hardware database handle */ |
|
182 |
- void *hwdb; |
|
181 |
+ /* NodalCore database handle */ |
|
182 |
+ void *ncdb; |
|
183 | 183 |
|
184 | 184 |
/* Phishing .pdb and .wdb databases*/ |
185 | 185 |
void *whitelist_matcher; |
... | ... |
@@ -75,7 +75,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname, |
75 | 75 |
#ifdef HAVE_NCORE |
76 | 76 |
if(engine->ncore) { |
77 | 77 |
/* TODO: Setup proper data bitmask (need specs) */ |
78 |
- if((hret = sn_sigscan_createstream(engine->hwdb, datamask, 2, &streamhandle)) < 0) { |
|
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 | 80 |
return CL_EHWIO; |
81 | 81 |
} |
... | ... |
@@ -133,7 +133,7 @@ int cli_scanbuff(const char *buffer, unsigned int length, const char **virname, |
133 | 133 |
sn_sigscan_resultfree(resulthandle); |
134 | 134 |
return CL_EHWIO; |
135 | 135 |
} |
136 |
- if(optionalsigdata) { |
|
136 |
+ if(optionalsigdata && strlen(optionalsigdata)) { |
|
137 | 137 |
if((pt = cli_strtok(optionalsigdata, 1, ":"))) { /* max version */ |
138 | 138 |
if(!isdigit(*pt)) { |
139 | 139 |
free(pt); |
... | ... |
@@ -434,7 +434,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f |
434 | 434 |
#ifdef HAVE_NCORE |
435 | 435 |
if(ctx->engine->ncore) { |
436 | 436 |
/* TODO: Setup proper data bitmask (need specs) */ |
437 |
- if((hret = sn_sigscan_createstream(ctx->engine->hwdb, datamask, 2, &streamhandle)) < 0) { |
|
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 | 439 |
return CL_EHWIO; |
440 | 440 |
} |
... | ... |
@@ -533,7 +533,7 @@ int cli_scandesc(int desc, cli_ctx *ctx, unsigned short otfrec, unsigned short f |
533 | 533 |
sn_sigscan_resultfree(resulthandle); |
534 | 534 |
return CL_EHWIO; |
535 | 535 |
} |
536 |
- if(optionalsigdata) { |
|
536 |
+ if(optionalsigdata && strlen(optionalsigdata)) { |
|
537 | 537 |
if((pt = cli_strtok(optionalsigdata, 1, ":"))) { /* max version */ |
538 | 538 |
if(!isdigit(*pt)) { |
539 | 539 |
free(pt); |
... | ... |
@@ -1097,9 +1097,10 @@ static int cli_loadmd(FILE *fd, struct cl_engine **engine, unsigned int *signo, |
1097 | 1097 |
} |
1098 | 1098 |
|
1099 | 1099 |
#ifdef HAVE_NCORE |
1100 |
-static int cli_loadhw(const char *filename, struct cl_engine **engine, unsigned int *signo, unsigned int options) |
|
1100 |
+static int cli_loadncdb(const char *filename, struct cl_engine **engine, unsigned int *signo, unsigned int options) |
|
1101 | 1101 |
{ |
1102 | 1102 |
int ret = 0; |
1103 |
+ unsigned int newsigs = 0; |
|
1103 | 1104 |
|
1104 | 1105 |
|
1105 | 1106 |
if((ret = cli_initengine(engine, options))) { |
... | ... |
@@ -1107,20 +1108,21 @@ static int cli_loadhw(const char *filename, struct cl_engine **engine, unsigned |
1107 | 1107 |
return ret; |
1108 | 1108 |
} |
1109 | 1109 |
|
1110 |
- if((ret = sn_sigscan_initdb(&(*engine)->hwdb)) < 0) { |
|
1111 |
- cli_errmsg("ncore: error initializing the matcher: %d\n", ret); |
|
1110 |
+ if((ret = sn_sigscan_initdb(&(*engine)->ncdb)) < 0) { |
|
1111 |
+ cli_errmsg("cli_loadncdb: error initializing the matcher: %d\n", ret); |
|
1112 | 1112 |
cl_free(*engine); |
1113 | 1113 |
return CL_EHWINIT; |
1114 | 1114 |
} |
1115 | 1115 |
|
1116 | 1116 |
(*engine)->ncore = 1; |
1117 | 1117 |
|
1118 |
- if((ret = sn_sigscan_loaddb((*engine)->hwdb, filename, 0, signo)) < 0) { |
|
1119 |
- cli_errmsg("ncore: can't load hardware database: %d\n", ret); |
|
1118 |
+ if((ret = sn_sigscan_loaddb((*engine)->ncdb, filename, 0, &newsigs)) < 0) { |
|
1119 |
+ cli_errmsg("cli_loadncdb: can't load hardware database: %d\n", ret); |
|
1120 | 1120 |
cl_free(*engine); |
1121 | 1121 |
return CL_EHWLOAD; |
1122 | 1122 |
} |
1123 | 1123 |
|
1124 |
+ *signo += newsigs; |
|
1124 | 1125 |
return CL_SUCCESS; |
1125 | 1126 |
} |
1126 | 1127 |
#endif /* HAVE_NCORE */ |
... | ... |
@@ -1184,10 +1186,10 @@ static int cli_load(const char *filename, struct cl_engine **engine, unsigned in |
1184 | 1184 |
} else if(cli_strbcasestr(filename, ".rmd")) { |
1185 | 1185 |
ret = cli_loadmd(fd, engine, signo, 2, options); |
1186 | 1186 |
|
1187 |
- } else if(cli_strbcasestr(filename, ".hw")) { |
|
1187 |
+ } else if(cli_strbcasestr(filename, ".ncdb")) { |
|
1188 | 1188 |
#ifdef HAVE_NCORE |
1189 | 1189 |
if(options & CL_DB_NCORE) |
1190 |
- ret = cli_loadhw(filename, engine, signo, options); |
|
1190 |
+ ret = cli_loadncdb(filename, engine, signo, options); |
|
1191 | 1191 |
else |
1192 | 1192 |
#endif |
1193 | 1193 |
skipped = 1; |
... | ... |
@@ -1272,7 +1274,7 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine **engine, unsigne |
1272 | 1272 |
cli_strbcasestr(dent->d_name, ".pdb") || |
1273 | 1273 |
cli_strbcasestr(dent->d_name, ".wdb") || |
1274 | 1274 |
#endif |
1275 |
- cli_strbcasestr(dent->d_name, ".hw") || |
|
1275 |
+ cli_strbcasestr(dent->d_name, ".ncdb") || |
|
1276 | 1276 |
cli_strbcasestr(dent->d_name, ".inc") || |
1277 | 1277 |
cli_strbcasestr(dent->d_name, ".cvd"))) { |
1278 | 1278 |
|
... | ... |
@@ -1393,7 +1395,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat) |
1393 | 1393 |
cli_strbcasestr(dent->d_name, ".pdb") || |
1394 | 1394 |
cli_strbcasestr(dent->d_name, ".wdb") || |
1395 | 1395 |
#endif |
1396 |
- cli_strbcasestr(dent->d_name, ".hw") || |
|
1396 |
+ cli_strbcasestr(dent->d_name, ".ncdb") || |
|
1397 | 1397 |
cli_strbcasestr(dent->d_name, ".inc") || |
1398 | 1398 |
cli_strbcasestr(dent->d_name, ".cvd"))) { |
1399 | 1399 |
|
... | ... |
@@ -1472,7 +1474,7 @@ int cl_statchkdir(const struct cl_stat *dbstat) |
1472 | 1472 |
cli_strbcasestr(dent->d_name, ".pdb") || |
1473 | 1473 |
cli_strbcasestr(dent->d_name, ".wdb") || |
1474 | 1474 |
#endif |
1475 |
- cli_strbcasestr(dent->d_name, ".hw") || |
|
1475 |
+ cli_strbcasestr(dent->d_name, ".ncdb") || |
|
1476 | 1476 |
cli_strbcasestr(dent->d_name, ".inc") || |
1477 | 1477 |
cli_strbcasestr(dent->d_name, ".cvd"))) { |
1478 | 1478 |
|
... | ... |
@@ -1572,7 +1574,7 @@ void cl_free(struct cl_engine *engine) |
1572 | 1572 |
|
1573 | 1573 |
#ifdef HAVE_NCORE |
1574 | 1574 |
if(engine->ncore) { |
1575 |
- if((ret = sn_sigscan_closedb(engine->hwdb)) < 0) { |
|
1575 |
+ if((ret = sn_sigscan_closedb(engine->ncdb)) < 0) { |
|
1576 | 1576 |
cli_errmsg("cl_free: can't close hardware database: %d\n", ret); |
1577 | 1577 |
} |
1578 | 1578 |
} |