Browse code

clamscan: add support for loading multiple dbs at command line with -d (bb#2033)

Tomasz Kojm authored on 2010/05/28 20:28:46
Showing 3 changed files
... ...
@@ -2,6 +2,11 @@ Fri May 28 13:24:21 CEST 2010 (tk)
2 2
 ----------------------------------
3 3
  * freshclam/manager.c: randomize getaddrinfo()'s results (bb#2021)
4 4
 
5
+Tue May 25 14:36:41 CEST 2010 (tk)
6
+----------------------------------
7
+ * clamscan: add support for loading multiple dbs at command line with
8
+	     -d (bb#2033)
9
+
5 10
 Wed May 19 12:21:02 CEST 2010 (acab)
6 11
 ------------------------------------
7 12
  * libclamav/7z/Archive/7z/7zIn.c: fix possible(?) null dereference reported
... ...
@@ -414,12 +414,14 @@ int scanmanager(const struct optstruct *opts)
414 414
     }
415 415
 
416 416
     if((opt = optget(opts, "database"))->active) {
417
-	if((ret = cl_load(opt->strarg, engine, &info.sigs, dboptions))) {
418
-	    logg("!%s\n", cl_strerror(ret));
419
-	    cl_engine_free(engine);
420
-	    return 2;
417
+	while(opt) {
418
+	    if((ret = cl_load(opt->strarg, engine, &info.sigs, dboptions))) {
419
+		logg("!%s\n", cl_strerror(ret));
420
+		cl_engine_free(engine);
421
+		return 2;
422
+	    }
423
+	    opt = opt->nextarg;
421 424
 	}
422
-
423 425
     } else {
424 426
 	    char *dbdir = freshdbdir();
425 427
 
... ...
@@ -80,7 +80,7 @@ const struct clam_option __clam_options[] = {
80 80
     { NULL, "multiscan", 'm', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
81 81
     { NULL, "fdpass", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
82 82
     { NULL, "stream", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMDSCAN, "", "" },
83
-    { NULL, "database", 'd', TYPE_STRING, NULL, -1, DATADIR, FLAG_REQUIRED, OPT_CLAMSCAN, "", "" }, /* merge it with DatabaseDirectory (and fix conflict with --datadir */
83
+    { NULL, "database", 'd', TYPE_STRING, NULL, -1, DATADIR, FLAG_REQUIRED | FLAG_MULTIPLE, OPT_CLAMSCAN, "", "" }, /* merge it with DatabaseDirectory (and fix conflict with --datadir */
84 84
     { NULL, "recursive", 'r', TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "", "" },
85 85
     { NULL, "bell", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "", "" },
86 86
     { NULL, "no-summary", 0, TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN | OPT_CLAMDSCAN, "", "" },