git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@816 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/09/01 03:46:00... | ... |
@@ -1,3 +1,10 @@ |
1 |
+Tue Aug 31 20:39:34 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * sigtool: add support for *.hdb files in -l; include creation time in |
|
4 |
+ seconds in cvd header |
|
5 |
+ * libclamav: do not load Eicar signature (detected with MD5 checksum in |
|
6 |
+ daily.cvd > 472) |
|
7 |
+ |
|
1 | 8 |
Tue Aug 31 13:43:11 CEST 2004 (acab) |
2 | 9 |
------------------------------------ |
3 | 10 |
* libclamav/petite.c: Fixed section compacting for v2.1 |
... | ... |
@@ -415,6 +415,10 @@ static int cli_loaddb(FILE *fd, struct cl_node **root, int *virnum) |
415 | 415 |
} |
416 | 416 |
|
417 | 417 |
while(fgets(buffer, FILEBUFF, fd)) { |
418 |
+ |
|
419 |
+ if(strstr(buffer, "Eicar")) /* FIXME: Remove me some day! */ |
|
420 |
+ continue; |
|
421 |
+ |
|
418 | 422 |
line++; |
419 | 423 |
cli_chomp(buffer); |
420 | 424 |
|
... | ... |
@@ -448,7 +452,7 @@ static int cli_loaddb(FILE *fd, struct cl_node **root, int *virnum) |
448 | 448 |
return ret; |
449 | 449 |
} |
450 | 450 |
|
451 |
- if(virnum != NULL) |
|
451 |
+ if(virnum) |
|
452 | 452 |
*virnum += line; |
453 | 453 |
|
454 | 454 |
return 0; |
... | ... |
@@ -535,6 +539,9 @@ 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; |
|
540 |
+ |
|
538 | 541 |
return 0; |
539 | 542 |
} |
540 | 543 |
|
... | ... |
@@ -217,7 +217,7 @@ int build(struct optstruct *opt) |
217 | 217 |
{ |
218 | 218 |
int ret, no = 0, realno = 0, bytes, itmp; |
219 | 219 |
struct stat foo; |
220 |
- char buffer[FILEBUFF], *tarfile = NULL, *gzfile = NULL, header[257], |
|
220 |
+ char buffer[FILEBUFF], *tarfile = NULL, *gzfile = NULL, header[512], |
|
221 | 221 |
smbuff[30], *pt; |
222 | 222 |
struct cl_node *root = NULL; |
223 | 223 |
FILE *tar, *cvd, *fd; |
... | ... |
@@ -236,7 +236,7 @@ int build(struct optstruct *opt) |
236 | 236 |
exit(1); |
237 | 237 |
} |
238 | 238 |
|
239 |
- if(stat("viruses.db", &foo) == -1 && stat("viruses.db2", &foo) == -1) { |
|
239 |
+ if(stat("viruses.db", &foo) == -1 && stat("viruses.db2", &foo) == -1 && stat("malware.hdb", &foo) == -1) { |
|
240 | 240 |
mprintf("Virus database not found in current working directory.\n"); |
241 | 241 |
exit(1); |
242 | 242 |
} |
... | ... |
@@ -256,7 +256,7 @@ int build(struct optstruct *opt) |
256 | 256 |
mprintf("WARNING: There are no signatures in the database(s).\n"); |
257 | 257 |
} else { |
258 | 258 |
mprintf("Signatures: %d\n", no); |
259 |
- realno = countlines("viruses.db") + countlines("viruses.db2"); |
|
259 |
+ realno = countlines("viruses.db") + countlines("viruses.db2") + countlines("malware.hdb"); |
|
260 | 260 |
|
261 | 261 |
if(realno != no) { |
262 | 262 |
mprintf("!Signatures in database: %d. Loaded: %d.\n", realno, no); |
... | ... |
@@ -274,7 +274,7 @@ int build(struct optstruct *opt) |
274 | 274 |
exit(1); |
275 | 275 |
case 0: |
276 | 276 |
{ |
277 |
- char *args[] = { "tar", "-cvf", NULL, "COPYING", "viruses.db", "viruses.db2", "Notes", "viruses.db3", NULL }; |
|
277 |
+ char *args[] = { "tar", "-cvf", NULL, "COPYING", "viruses.db", "viruses.db2", "Notes", "viruses.db3", "malware.hdb", NULL }; |
|
278 | 278 |
args[2] = tarfile; |
279 | 279 |
execv("/bin/tar", args); |
280 | 280 |
mprintf("!Can't execute tar\n"); |
... | ... |
@@ -358,7 +358,7 @@ int build(struct optstruct *opt) |
358 | 358 |
free(pt); |
359 | 359 |
strcat(header, ":"); |
360 | 360 |
|
361 |
- /* builder - question */ |
|
361 |
+ /* ask for builder name */ |
|
362 | 362 |
fflush(stdin); |
363 | 363 |
mprintf("Builder id: "); |
364 | 364 |
fscanf(stdin, "%s", smbuff); |
... | ... |
@@ -377,9 +377,12 @@ int build(struct optstruct *opt) |
377 | 377 |
free(pt); |
378 | 378 |
strcat(header, ":"); |
379 | 379 |
|
380 |
- /* builder - add */ |
|
380 |
+ /* add builder */ |
|
381 | 381 |
strcat(header, smbuff); |
382 | 382 |
|
383 |
+ /* add current time */ |
|
384 |
+ sprintf(header + strlen(header), ":%d", (int) timet); |
|
385 |
+ |
|
383 | 386 |
/* fill up with spaces */ |
384 | 387 |
|
385 | 388 |
while(strlen(header) < 512) |
... | ... |
@@ -638,26 +641,49 @@ int listdb(const char *filename) |
638 | 638 |
return 0; |
639 | 639 |
} |
640 | 640 |
|
641 |
+ if(cli_strbcasestr(filename, ".db") || cli_strbcasestr(filename, ".db2")) { |
|
642 |
+ /* old style database */ |
|
643 |
+ |
|
644 |
+ while(fgets(buffer, FILEBUFF, fd)) { |
|
645 |
+ line++; |
|
646 |
+ pt = strchr(buffer, '='); |
|
647 |
+ if(!pt) { |
|
648 |
+ mprintf("!listdb(): Malformed pattern line %d (file %s).\n", line, filename); |
|
649 |
+ fclose(fd); |
|
650 |
+ free(buffer); |
|
651 |
+ return -1; |
|
652 |
+ } |
|
641 | 653 |
|
642 |
- /* old style database */ |
|
654 |
+ start = buffer; |
|
655 |
+ *pt = 0; |
|
643 | 656 |
|
644 |
- while(fgets(buffer, FILEBUFF, fd)) { |
|
645 |
- line++; |
|
646 |
- pt = strchr(buffer, '='); |
|
647 |
- if(!pt) { |
|
648 |
- mprintf("!listdb(): Malformed pattern line %d (file %s).\n", line, filename); |
|
649 |
- fclose(fd); |
|
650 |
- free(buffer); |
|
651 |
- return -1; |
|
657 |
+ if((pt = strstr(start, " (Clam)"))) |
|
658 |
+ *pt = 0; |
|
659 |
+ |
|
660 |
+ mprintf("%s\n", start); |
|
652 | 661 |
} |
653 | 662 |
|
654 |
- start = buffer; |
|
655 |
- *pt = 0; |
|
663 |
+ } else if(cli_strbcasestr(filename, ".hdb")) { |
|
656 | 664 |
|
657 |
- if((pt = strstr(start, " (Clam)"))) |
|
658 |
- *pt = 0; |
|
665 |
+ while(fgets(buffer, FILEBUFF, fd)) { |
|
666 |
+ line++; |
|
667 |
+ cli_chomp(buffer); |
|
668 |
+ start = cli_strtok(buffer, 2, ":"); |
|
669 |
+ |
|
670 |
+ if(!start) { |
|
671 |
+ mprintf("!listdb(): Malformed pattern line %d (file %s).\n", line, filename); |
|
672 |
+ fclose(fd); |
|
673 |
+ free(buffer); |
|
674 |
+ return -1; |
|
675 |
+ } |
|
676 |
+ |
|
677 |
+ if((pt = strstr(start, " (Clam)"))) |
|
678 |
+ *pt = 0; |
|
679 |
+ |
|
680 |
+ mprintf("%s\n", start); |
|
681 |
+ free(start); |
|
682 |
+ } |
|
659 | 683 |
|
660 |
- mprintf("%s\n", start); |
|
661 | 684 |
} |
662 | 685 |
|
663 | 686 |
fclose(fd); |
... | ... |
@@ -685,6 +711,7 @@ int listdir(const char *dirname) |
685 | 685 |
if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..") && |
686 | 686 |
(cli_strbcasestr(dent->d_name, ".db") || |
687 | 687 |
cli_strbcasestr(dent->d_name, ".db2") || |
688 |
+ cli_strbcasestr(dent->d_name, ".hdb") || |
|
688 | 689 |
cli_strbcasestr(dent->d_name, ".cvd"))) { |
689 | 690 |
|
690 | 691 |
dbfile = (char *) mcalloc(strlen(dent->d_name) + strlen(dirname) + 2, sizeof(char)); |