drop a redundant check from phishcheck.

enable debug output in unit tests, they are dumped to
unit_tests/test-stderr.log.


git-svn: trunk@4028
remotes/push_mirror/0.95
Török Edvin 18 years ago
parent d39b528106
commit 2b9e5d2971
  1. 16
      libclamav/phishcheck.c
  2. 1
      libclamav/phishcheck.h
  3. 4
      unit_tests/check_clamav.c
  4. 2
      unit_tests/check_regex.c

@ -137,11 +137,6 @@ For the Whitelist(.wdb)/Domainlist(.pdb) format see regex_list.c (search for Fla
/* Constant strings and tables */
static char empty_string[]="";
#define ANY_CLOAK "(0[xX][0-9a-fA-F]+|[0-9]+)"
#define CLOAKED_URL "^"ANY_CLOAK"(\\."ANY_CLOAK"){0,3}$"
static const char cloaked_host_regex[] = CLOAKED_URL;
static const char dotnet[] = ".net";
static const char adonet[] = "ado.net";
static const char aspnet[] = "asp.net";
@ -907,12 +902,6 @@ int phishing_init(struct cl_engine* engine)
cli_dbgmsg("Initializing phishcheck module\n");
if(build_regex(&pchk->preg_hexurl,cloaked_host_regex,1)) {
free(pchk);
engine->phishcheck = NULL;
return CL_EFORMAT;
}
if(build_regex(&pchk->preg_numeric,numeric_url_regex,1)) {
free(pchk);
engine->phishcheck = NULL;
@ -928,7 +917,6 @@ void phishing_done(struct cl_engine* engine)
struct phishcheck* pchk = engine->phishcheck;
cli_dbgmsg("Cleaning up phishcheck\n");
if(pchk && !pchk->is_disabled) {
free_regex(&pchk->preg_hexurl);
free_regex(&pchk->preg_numeric);
pchk->is_disabled = 1;
}
@ -1151,10 +1139,6 @@ static int url_get_host(const struct phishcheck* pchk, struct url_check* url,str
cli_dbgmsg("Phishcheck:skipping invalid host\n");
return CL_PHISH_CLEAN;
}
if(url->flags&CHECK_CLOAKING && !cli_regexec(&pchk->preg_hexurl,host->data,0,NULL,0)) {
/* uses a regex here, so that we don't accidentally block 0xacab.net style hosts */
return CL_PHISH_HEX_URL;
}
if(isNumeric(host->data)) {
*phishy |= PHISHY_NUMERIC_IP;
}

@ -45,7 +45,6 @@ struct string {
struct phishcheck {
regex_t preg_numeric;
regex_t preg_hexurl;
int is_disabled;
};

@ -53,6 +53,7 @@ END_TEST
/* extern void cl_debug(void); */
START_TEST (test_cl_debug)
int old_status = cli_debug_flag;
cli_debug_flag = 0;
cl_debug();
fail_unless(1 == cli_debug_flag, "cl_debug failed to set cli_debug_flag");
@ -60,7 +61,7 @@ START_TEST (test_cl_debug)
cli_debug_flag = 1;
cl_debug();
fail_unless(1 == cli_debug_flag, "cl_debug failed when flag was already set");
cli_debug_flag = 0;
cli_debug_flag = old_status;
END_TEST
/* extern const char *cl_retdbdir(void); */
@ -328,6 +329,7 @@ int open_testfile(const char *name)
int main(int argc, char **argv)
{
int nf;
cl_debug();
Suite *s = test_cl_suite();
SRunner *sr = srunner_create(s);
srunner_add_suite(sr, test_cli_suite());

@ -184,7 +184,6 @@ static const struct rtest {
},
{NULL, "http://somefakeurl.example.com","someotherdomain-key.com",2},
{NULL, "http://somefakeurl.example.com","someotherdomain.key.com",0}
};
START_TEST (regex_list_match_test)
@ -246,7 +245,6 @@ static void psetup(void)
f = fdopen(open_testfile("input/daily.pdb"),"r");
fail_unless(!!f, "fopen daily.pdb");
cl_debug();
rc = load_regex_matcher(engine->domainlist_matcher, f, 0, 0, NULL);
fail_unless(rc == 0, "load_regex_matcher");
fclose(f);

Loading…
Cancel
Save