Browse code

add whitelisting via cb to phish sigs too

aCaB authored on 2010/08/11 19:20:36
Showing 4 changed files
... ...
@@ -1,3 +1,7 @@
1
+Wed Aug 11 12:32:37 CEST 2010 (acab)
2
+------------------------------------
3
+ * libclamav: fix callback_sigload
4
+
1 5
 Tue Aug 10 14:01:27 CEST 2010 (tk)
2 6
 ----------------------------------
3 7
  * clamdscan: fix parsing of virus names in extended mode and --stream (bb#2184)
... ...
@@ -830,7 +830,7 @@ static int cli_loadwdb(FILE *fs, struct cl_engine *engine, unsigned int options,
830 830
 	}
831 831
     }
832 832
 
833
-    if((ret = load_regex_matcher(engine->whitelist_matcher, fs, NULL, options, 1, dbio, engine->dconf->other&OTHER_CONF_PREFILTERING))) {
833
+    if((ret = load_regex_matcher(engine, engine->whitelist_matcher, fs, NULL, options, 1, dbio, engine->dconf->other&OTHER_CONF_PREFILTERING))) {
834 834
 	return ret;
835 835
     }
836 836
 
... ...
@@ -851,7 +851,7 @@ static int cli_loadpdb(FILE *fs, struct cl_engine *engine, unsigned int *signo,
851 851
 	}
852 852
     }
853 853
 
854
-    if((ret = load_regex_matcher(engine->domainlist_matcher, fs, signo, options, 0, dbio, engine->dconf->other&OTHER_CONF_PREFILTERING))) {
854
+    if((ret = load_regex_matcher(engine, engine->domainlist_matcher, fs, signo, options, 0, dbio, engine->dconf->other&OTHER_CONF_PREFILTERING))) {
855 855
 	return ret;
856 856
     }
857 857
 
... ...
@@ -385,7 +385,7 @@ static int add_hash(struct regex_matcher *matcher, char* pattern, const char fl,
385 385
 
386 386
 
387 387
 /* Load patterns/regexes from file */
388
-int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int *signo,unsigned int options,int is_whitelist,struct cli_dbio *dbio, uint8_t dconf_prefiltering)
388
+int load_regex_matcher(struct cl_engine *engine,struct regex_matcher* matcher,FILE* fd,unsigned int *signo,unsigned int options,int is_whitelist,struct cli_dbio *dbio, uint8_t dconf_prefiltering)
389 389
 {
390 390
 	int rc,line=0,entry=0;
391 391
 	char buffer[FILEBUFF];
... ...
@@ -441,6 +441,11 @@ int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int *sign
441 441
 		if(functionality_level_check(buffer))
442 442
 			continue;
443 443
 
444
+		if(engine->cb_sigload && engine->cb_sigload("phishing", buffer, engine->cb_sigload_ctx)) {
445
+			cli_dbgmsg("load_regex_matcher: skipping %s due to callback\n", buffer);
446
+			continue;
447
+		}
448
+
444 449
 		entry++;
445 450
 		pattern = strchr(buffer,':');
446 451
 		if(!pattern) {
... ...
@@ -62,7 +62,7 @@ int cli_build_regex_list(struct regex_matcher* matcher);
62 62
 int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern);
63 63
 int regex_list_match(struct regex_matcher* matcher, char* real_url,const char* display_url,const struct pre_fixup_info* pre_fixup, int hostOnly,const char **info, int is_whitelist);
64 64
 int init_regex_list(struct regex_matcher* matcher, uint8_t dconf_prefiltering);
65
-int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int *signo,unsigned int options,int is_whitelist,struct cli_dbio *dbio,uint8_t dconf_prefiltering);
65
+int load_regex_matcher(struct cl_engine *engine,struct regex_matcher* matcher,FILE* fd,unsigned int *signo,unsigned int options,int is_whitelist,struct cli_dbio *dbio,uint8_t dconf_prefiltering);
66 66
 void regex_list_cleanup(struct regex_matcher* matcher);
67 67
 void regex_list_done(struct regex_matcher* matcher);
68 68
 int is_regex_ok(struct regex_matcher* matcher);