mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00
more tests for regex
run unit-tests under valgrind if available. git-svn: trunk@3990
This commit is contained in:
parent
82167b0a77
commit
3dcc2d784e
16 changed files with 864 additions and 47 deletions
48
configure
vendored
48
configure
vendored
|
@ -871,13 +871,13 @@ GPERF
|
|||
PKG_CONFIG
|
||||
CHECK_CFLAGS
|
||||
CHECK_LIBS
|
||||
GCOV
|
||||
LCOV
|
||||
GENHTML
|
||||
ENABLE_COVERAGE_TRUE
|
||||
ENABLE_COVERAGE_FALSE
|
||||
ENABLE_UT_INSTALL_TRUE
|
||||
ENABLE_UT_INSTALL_FALSE
|
||||
GCOV
|
||||
LCOV
|
||||
GENHTML
|
||||
MAINTAINER_MODE_TRUE
|
||||
MAINTAINER_MODE_FALSE
|
||||
MAINT
|
||||
|
@ -13540,24 +13540,6 @@ echo "$as_me: error: coverage testing only works if gcc is used" >&2;}
|
|||
|
||||
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
|
||||
LDFLAGS="$LDFLAGS -lgcov"
|
||||
fi
|
||||
|
||||
if test "x$enable_coverage" = "xyes"; then
|
||||
ENABLE_COVERAGE_TRUE=
|
||||
ENABLE_COVERAGE_FALSE='#'
|
||||
else
|
||||
ENABLE_COVERAGE_TRUE='#'
|
||||
ENABLE_COVERAGE_FALSE=
|
||||
fi
|
||||
|
||||
if test "x$enable_ut_install" = "xyes"; then
|
||||
ENABLE_UT_INSTALL_TRUE=
|
||||
ENABLE_UT_INSTALL_FALSE='#'
|
||||
else
|
||||
ENABLE_UT_INSTALL_TRUE='#'
|
||||
ENABLE_UT_INSTALL_FALSE=
|
||||
fi
|
||||
|
||||
for ac_prog in gcov
|
||||
do
|
||||
# Extract the first word of "$ac_prog", so it can be a program name with args.
|
||||
|
@ -13687,6 +13669,24 @@ fi
|
|||
done
|
||||
test -n "$GENHTML" || GENHTML="false"
|
||||
|
||||
fi
|
||||
|
||||
if test "x$enable_coverage" = "xyes"; then
|
||||
ENABLE_COVERAGE_TRUE=
|
||||
ENABLE_COVERAGE_FALSE='#'
|
||||
else
|
||||
ENABLE_COVERAGE_TRUE='#'
|
||||
ENABLE_COVERAGE_FALSE=
|
||||
fi
|
||||
|
||||
if test "x$enable_ut_install" = "xyes"; then
|
||||
ENABLE_UT_INSTALL_TRUE=
|
||||
ENABLE_UT_INSTALL_FALSE='#'
|
||||
else
|
||||
ENABLE_UT_INSTALL_TRUE='#'
|
||||
ENABLE_UT_INSTALL_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
have_pthreads=no
|
||||
if test "${ac_cv_header_pthread_h+set}" = set; then
|
||||
|
@ -20703,13 +20703,13 @@ GPERF!$GPERF$ac_delim
|
|||
PKG_CONFIG!$PKG_CONFIG$ac_delim
|
||||
CHECK_CFLAGS!$CHECK_CFLAGS$ac_delim
|
||||
CHECK_LIBS!$CHECK_LIBS$ac_delim
|
||||
GCOV!$GCOV$ac_delim
|
||||
LCOV!$LCOV$ac_delim
|
||||
GENHTML!$GENHTML$ac_delim
|
||||
ENABLE_COVERAGE_TRUE!$ENABLE_COVERAGE_TRUE$ac_delim
|
||||
ENABLE_COVERAGE_FALSE!$ENABLE_COVERAGE_FALSE$ac_delim
|
||||
ENABLE_UT_INSTALL_TRUE!$ENABLE_UT_INSTALL_TRUE$ac_delim
|
||||
ENABLE_UT_INSTALL_FALSE!$ENABLE_UT_INSTALL_FALSE$ac_delim
|
||||
GCOV!$GCOV$ac_delim
|
||||
LCOV!$LCOV$ac_delim
|
||||
GENHTML!$GENHTML$ac_delim
|
||||
MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
|
||||
MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
|
||||
MAINT!$MAINT$ac_delim
|
||||
|
|
|
@ -375,13 +375,13 @@ if test "x$enable_coverage" = "xyes"; then
|
|||
|
||||
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
|
||||
LDFLAGS="$LDFLAGS -lgcov"
|
||||
AC_CHECK_PROGS(GCOV, gcov, false)
|
||||
AC_CHECK_PROGS(LCOV, lcov, false)
|
||||
AC_CHECK_PROGS(GENHTML, genhtml, false)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" = "xyes")
|
||||
AM_CONDITIONAL(ENABLE_UT_INSTALL, test "x$enable_ut_install" = "xyes")
|
||||
AC_CHECK_PROGS(GCOV, gcov, false)
|
||||
AC_CHECK_PROGS(LCOV, lcov, false)
|
||||
AC_CHECK_PROGS(GENHTML, genhtml, false)
|
||||
|
||||
have_pthreads=no
|
||||
AC_CHECK_HEADER([pthread.h],[have_pthreads=yes],)
|
||||
|
|
|
@ -85,6 +85,22 @@ CLAMAV_PRIVATE {
|
|||
cli_dconf_init;
|
||||
cli_regex2suffix;
|
||||
html_normalise_mem;
|
||||
init_regex_list;
|
||||
is_regex_ok;
|
||||
regex_list_done;
|
||||
regex_list_add_pattern;
|
||||
cli_build_regex_list;
|
||||
regex_list_match;
|
||||
cli_initengine;
|
||||
phishing_init;
|
||||
init_domainlist;
|
||||
init_whitelist;
|
||||
phishing_done;
|
||||
blobCreate;
|
||||
blobAddData;
|
||||
phishingScan;
|
||||
blobDestroy;
|
||||
load_regex_matcher;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "regex_suffix.h"
|
||||
/* Prototypes */
|
||||
static size_t reverse_string(char *pattern);
|
||||
static int add_pattern(struct regex_matcher *matcher, char *pattern);
|
||||
static int add_pattern_suffix(void *cbdata, const char *suffix, size_t suffix_len, struct regex_list *regex);
|
||||
static int add_static_pattern(struct regex_matcher *matcher, char* pattern);
|
||||
/* ---------- */
|
||||
|
@ -463,7 +462,7 @@ int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int optio
|
|||
|
||||
if((buffer[0] == 'R' && !is_whitelist) || ((buffer[0] == 'X' || buffer[0] == 'Y') && is_whitelist)) {
|
||||
/* regex for hostname*/
|
||||
if (( rc = add_pattern(matcher, pattern) ))
|
||||
if (( rc = regex_list_add_pattern(matcher, pattern) ))
|
||||
return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB;
|
||||
}
|
||||
else if( ( buffer[0] == 'H' && !is_whitelist) || (buffer[0] == 'M' && is_whitelist)) {
|
||||
|
@ -514,6 +513,7 @@ void regex_list_done(struct regex_matcher* matcher)
|
|||
struct regex_list *r = matcher->suffix_regexes[i];
|
||||
while(r) {
|
||||
free(r->pattern);
|
||||
r->pattern = NULL;
|
||||
cli_regfree(&r->preg);
|
||||
r = r->nxt;
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ static int add_static_pattern(struct regex_matcher *matcher, char* pattern)
|
|||
return add_pattern_suffix(matcher, pattern, len, regex);
|
||||
}
|
||||
|
||||
static int add_pattern(struct regex_matcher *matcher, char *pattern)
|
||||
int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern)
|
||||
{
|
||||
int rc;
|
||||
struct regex_list *regex = cli_malloc(sizeof(*regex));
|
||||
|
@ -655,9 +655,11 @@ static int add_pattern(struct regex_matcher *matcher, char *pattern)
|
|||
if(len > sizeof(remove_end)) {
|
||||
if(strncmp(&pattern[len - sizeof(remove_end)+1], remove_end, sizeof(remove_end)-1) == 0) {
|
||||
len -= sizeof(remove_end) - 1;
|
||||
pattern[len++]='/';
|
||||
}
|
||||
if(strncmp(&pattern[len - sizeof(remove_end2)+1], remove_end2, sizeof(remove_end2)-1) == 0) {
|
||||
len -= sizeof(remove_end2) - 1;
|
||||
pattern[len++]='/';
|
||||
}
|
||||
}
|
||||
pattern[len] = '\0';
|
||||
|
|
|
@ -48,6 +48,7 @@ struct regex_matcher {
|
|||
};
|
||||
|
||||
int cli_build_regex_list(struct regex_matcher* matcher);
|
||||
int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern);
|
||||
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);
|
||||
int init_regex_list(struct regex_matcher* matcher);
|
||||
int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist,struct cli_dbio *dbio);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "regex/regex.h"
|
||||
|
||||
struct regex_list {
|
||||
const char *pattern;
|
||||
char *pattern;
|
||||
regex_t preg;
|
||||
struct regex_list *nxt;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
programs = check_clamav
|
||||
scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh
|
||||
scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh valgrind_tests.sh
|
||||
|
||||
TESTS = $(programs) $(scripts)
|
||||
if ENABLE_UT_INSTALL
|
||||
|
@ -10,7 +10,7 @@ check_PROGRAMS = $(programs)
|
|||
check_SCRIPTS = $(scripts)
|
||||
endif
|
||||
check_clamav_SOURCES = check_clamav.c check_jsnorm.c check_str.c check_regex.c checks.h $(top_builddir)/libclamav/clamav.h
|
||||
check_clamav_CFLAGS = @CHECK_CFLAGS@
|
||||
check_clamav_CFLAGS = @CHECK_CFLAGS@ -DSRCDIR=\"$(abs_srcdir)\"
|
||||
check_clamav_LDADD = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@ @CHECK_LIBS@
|
||||
|
||||
check_clamd.sh: $(top_builddir)/test/clam.exe
|
||||
|
@ -24,17 +24,18 @@ if ENABLE_COVERAGE
|
|||
LCOV_OUTPUT = lcov.out
|
||||
LCOV_HTML = lcov_html
|
||||
LCOV_LCOV = @LCOV@
|
||||
LCOV_GCOV = @GCOV@
|
||||
LCOV_GENHTML = @GENHTML@
|
||||
CLEANFILES=lcov.out *.gcno *.gcda *.log /tmp/clamd-test.log
|
||||
lcov: $(LCOV_HTML)
|
||||
|
||||
DIRECTORIES=--directory . --directory ../libclamav --directory ../clamd --directory ../freshclam --directory ../sigtool --directory ../clamscan --directory ../clamdscan
|
||||
.libs/check_clamav.gcda: $(TESTS)
|
||||
lcov $(DIRECTORIES) --zerocounters
|
||||
$(LCOV_LCOV) $(DIRECTORIES) --zerocounters
|
||||
@$(MAKE) check
|
||||
|
||||
$(LCOV_OUTPUT): .libs/check_clamav.gcda
|
||||
$(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file $@
|
||||
$(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file --gcov-tool $(LCOV_GCOV) $@
|
||||
|
||||
$(LCOV_HTML): $(LCOV_OUTPUT)
|
||||
-$(RM) -r $@
|
||||
|
@ -45,7 +46,7 @@ clean-local: lcov-clean
|
|||
.PHONY: lcov-clean
|
||||
lcov-clean:
|
||||
-$(RM) -r $(LCOV_HTML) $(LCOV_OUTPUT)
|
||||
lcov $(DIRECTORIES) --zerocounters
|
||||
$(LCOV_LCOV) $(DIRECTORIES) --zerocounters
|
||||
else
|
||||
|
||||
CLEANFILES=/tmp/clamd-test.log
|
||||
|
|
|
@ -63,7 +63,7 @@ check_clamav_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
|
|||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(check_clamav_CFLAGS) \
|
||||
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am__dist_bin_SCRIPTS_DIST = check_clamd.sh check_freshclam.sh \
|
||||
check_sigtool.sh check_clamscan.sh
|
||||
check_sigtool.sh check_clamscan.sh valgrind_tests.sh
|
||||
dist_binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
|
||||
SCRIPTS = $(dist_bin_SCRIPTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
|
@ -217,16 +217,17 @@ target_vendor = @target_vendor@
|
|||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
programs = check_clamav
|
||||
scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh
|
||||
scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh valgrind_tests.sh
|
||||
@ENABLE_UT_INSTALL_TRUE@dist_bin_SCRIPTS = $(scripts)
|
||||
@ENABLE_UT_INSTALL_FALSE@check_SCRIPTS = $(scripts)
|
||||
check_clamav_SOURCES = check_clamav.c check_jsnorm.c check_str.c check_regex.c checks.h $(top_builddir)/libclamav/clamav.h
|
||||
check_clamav_CFLAGS = @CHECK_CFLAGS@
|
||||
check_clamav_CFLAGS = @CHECK_CFLAGS@ -DSRCDIR=\"$(abs_srcdir)\"
|
||||
check_clamav_LDADD = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@ @CHECK_LIBS@
|
||||
EXTRA_DIST = test-clamd.conf test-freshclam.conf
|
||||
@ENABLE_COVERAGE_TRUE@LCOV_OUTPUT = lcov.out
|
||||
@ENABLE_COVERAGE_TRUE@LCOV_HTML = lcov_html
|
||||
@ENABLE_COVERAGE_TRUE@LCOV_LCOV = @LCOV@
|
||||
@ENABLE_COVERAGE_TRUE@LCOV_GCOV = @GCOV@
|
||||
@ENABLE_COVERAGE_TRUE@LCOV_GENHTML = @GENHTML@
|
||||
@ENABLE_COVERAGE_FALSE@CLEANFILES = /tmp/clamd-test.log
|
||||
@ENABLE_COVERAGE_TRUE@CLEANFILES = lcov.out *.gcno *.gcda *.log /tmp/clamd-test.log
|
||||
|
@ -682,11 +683,11 @@ $(top_builddir)/test/clam.exe:
|
|||
(cd $(top_builddir)/test && $(MAKE))
|
||||
@ENABLE_COVERAGE_TRUE@lcov: $(LCOV_HTML)
|
||||
@ENABLE_COVERAGE_TRUE@.libs/check_clamav.gcda: $(TESTS)
|
||||
@ENABLE_COVERAGE_TRUE@ lcov $(DIRECTORIES) --zerocounters
|
||||
@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) $(DIRECTORIES) --zerocounters
|
||||
@ENABLE_COVERAGE_TRUE@ @$(MAKE) check
|
||||
|
||||
@ENABLE_COVERAGE_TRUE@$(LCOV_OUTPUT): .libs/check_clamav.gcda
|
||||
@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file $@
|
||||
@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file --gcov-tool $(LCOV_GCOV) $@
|
||||
|
||||
@ENABLE_COVERAGE_TRUE@$(LCOV_HTML): $(LCOV_OUTPUT)
|
||||
@ENABLE_COVERAGE_TRUE@ -$(RM) -r $@
|
||||
|
@ -697,7 +698,7 @@ $(top_builddir)/test/clam.exe:
|
|||
@ENABLE_COVERAGE_TRUE@.PHONY: lcov-clean
|
||||
@ENABLE_COVERAGE_TRUE@lcov-clean:
|
||||
@ENABLE_COVERAGE_TRUE@ -$(RM) -r $(LCOV_HTML) $(LCOV_OUTPUT)
|
||||
@ENABLE_COVERAGE_TRUE@ lcov $(DIRECTORIES) --zerocounters
|
||||
@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) $(DIRECTORIES) --zerocounters
|
||||
@ENABLE_COVERAGE_FALSE@lcov:
|
||||
@ENABLE_COVERAGE_FALSE@ @echo "Coverage information gathering is not enabled in this build"
|
||||
@ENABLE_COVERAGE_FALSE@ @echo "Use ./configure --enable-coverage to enable it"
|
||||
|
|
|
@ -15,6 +15,7 @@ int main(int argc, char **argv)
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <check.h>
|
||||
#include "../libclamav/clamav.h"
|
||||
|
@ -303,6 +304,27 @@ void errmsg_expected(void)
|
|||
fputs("cli_errmsg() expected here\n", stderr);
|
||||
}
|
||||
|
||||
int open_testfile(const char *name)
|
||||
{
|
||||
int fd;
|
||||
const char * srcdir = getenv("srcdir");
|
||||
char *str;
|
||||
|
||||
if(!srcdir) {
|
||||
/* when run from automake srcdir is set, but if run manually then not */
|
||||
srcdir = SRCDIR;
|
||||
}
|
||||
|
||||
str = cli_malloc(strlen(name)+strlen(srcdir)+2);
|
||||
fail_unless(!!str, "cli_malloc");
|
||||
sprintf(str, "%s/%s", srcdir, name);
|
||||
|
||||
fd = open(str, O_RDONLY);
|
||||
fail_unless(fd >= 0, "open()");
|
||||
free(str);
|
||||
return fd;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int nf;
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
#include "../libclamav/clamav.h"
|
||||
#include "../libclamav/others.h"
|
||||
#include "../libclamav/regex_suffix.h"
|
||||
#include "../libclamav/regex_list.h"
|
||||
#include "../libclamav/htmlnorm.h"
|
||||
#include "../libclamav/mbox.h"
|
||||
#include "../libclamav/message.h"
|
||||
#include "../libclamav/phishcheck.h"
|
||||
#include "checks.h"
|
||||
|
||||
static int cb_called = 0;
|
||||
|
@ -126,17 +131,177 @@ static void teardown(void)
|
|||
free(regex.pattern);
|
||||
}
|
||||
|
||||
static struct regex_matcher matcher;
|
||||
|
||||
static void rsetup(void)
|
||||
{
|
||||
int rc = init_regex_list(&matcher);
|
||||
fail_unless(rc == 0, "init_regex_list");
|
||||
}
|
||||
|
||||
static void rteardown(void)
|
||||
{
|
||||
regex_list_done(&matcher);
|
||||
}
|
||||
|
||||
static const struct rtest {
|
||||
const char *pattern;/* NULL if not meant for whitelist testing */
|
||||
const char *realurl;
|
||||
const char *displayurl;
|
||||
int result;/* 0 - phish, 1 - whitelisted, 2 - clean */
|
||||
} rtests[] = {
|
||||
/* entry taken from .wdb with a / appended */
|
||||
{".+\\.ebayrtm\\.com([/?].*)?:.+\\.ebay\\.(de|com|co\\.uk)([/?].*)?/",
|
||||
"http://srx.main.ebayrtm.com",
|
||||
"pages.ebay.de",
|
||||
1 /* should be whitelisted */}
|
||||
};
|
||||
|
||||
START_TEST (regex_list_match_test)
|
||||
{
|
||||
const char *info;
|
||||
const struct rtest *rtest = &rtests[_i];
|
||||
char *pattern;
|
||||
|
||||
if(!rtest->pattern) {
|
||||
fail_unless(rtest->result != 1,
|
||||
"whitelist test must have pattern set");
|
||||
/* this test entry is not meant for whitelist testing */
|
||||
return;
|
||||
}
|
||||
|
||||
fail_unless(rtest->result == 0 || rtest->result == 1,
|
||||
"whitelist test result must be either 0 or 1");
|
||||
pattern = cli_strdup(rtest->pattern);
|
||||
fail_unless(!!pattern, "cli_strdup");
|
||||
|
||||
int rc = regex_list_add_pattern(&matcher, pattern);
|
||||
fail_unless(rc == 0,"regex_list_add_pattern");
|
||||
|
||||
matcher.list_loaded = 1;
|
||||
|
||||
rc = cli_build_regex_list(&matcher);
|
||||
fail_unless(rc == 0,"cli_build_regex_list");
|
||||
|
||||
fail_unless(is_regex_ok(&matcher),"is_regex_ok");
|
||||
|
||||
/* regex_list_match is not supposed to modify realurl in this case */
|
||||
rc = regex_list_match(&matcher, (char*)rtest->realurl, rtest->displayurl, NULL, 1, &info, 1);
|
||||
fail_unless(rc == rtest->result,"regex_list_match");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
static struct cl_engine *engine;
|
||||
static void psetup(void)
|
||||
{
|
||||
FILE *f;
|
||||
struct phishcheck *pchk;
|
||||
int rc;
|
||||
rc = cli_initengine(&engine, 0);
|
||||
fail_unless(rc == 0, "cl_initengine");
|
||||
|
||||
rc = phishing_init(engine);
|
||||
fail_unless(rc == 0,"phishing_init");
|
||||
pchk = engine->phishcheck;
|
||||
fail_unless(!!pchk, "engine->phishcheck");
|
||||
|
||||
rc = init_domainlist(engine);
|
||||
fail_unless(rc == 0,"init_domainlist");
|
||||
|
||||
f = fdopen(open_testfile("input/daily.pdb"),"r");
|
||||
fail_unless(!!f, "fopen daily.pdb");
|
||||
|
||||
rc = load_regex_matcher(engine->domainlist_matcher, f, 0, 0, NULL);
|
||||
fail_unless(rc == 0, "load_regex_matcher");
|
||||
fclose(f);
|
||||
|
||||
rc = init_whitelist(engine);
|
||||
fail_unless(rc == 0,"init_whitelist");
|
||||
|
||||
f = fdopen(open_testfile("input/daily.wdb"),"r");
|
||||
rc = load_regex_matcher(engine->whitelist_matcher, f, 0, 1, NULL);
|
||||
fail_unless(rc == 0,"load_regex_matcher");
|
||||
fclose(f);
|
||||
|
||||
rc = cli_build_regex_list(engine->whitelist_matcher);
|
||||
fail_unless(rc == 0,"cli_build_regex_list");
|
||||
|
||||
rc = cli_build_regex_list(engine->domainlist_matcher);
|
||||
fail_unless(rc == 0,"cli_build_regex_list");
|
||||
|
||||
fail_unless(is_regex_ok(engine->whitelist_matcher),"is_regex_ok");
|
||||
fail_unless(is_regex_ok(engine->domainlist_matcher),"is_regex_ok");
|
||||
}
|
||||
|
||||
static void pteardown(void)
|
||||
{
|
||||
phishing_done(engine);
|
||||
cl_free(engine);
|
||||
engine = NULL;
|
||||
}
|
||||
|
||||
START_TEST (phishingScan_test)
|
||||
{
|
||||
const char *info;
|
||||
const struct rtest *rtest = &rtests[_i];
|
||||
char *realurl;
|
||||
cli_ctx ctx;
|
||||
const char *virname;
|
||||
tag_arguments_t hrefs;
|
||||
int rc;
|
||||
|
||||
memset(&ctx, 0, sizeof(ctx));
|
||||
|
||||
realurl = cli_strdup(rtest->realurl);
|
||||
fail_unless(!!realurl, "cli_strdup");
|
||||
|
||||
hrefs.count = 1;
|
||||
hrefs.value = cli_malloc(sizeof(*hrefs.value));
|
||||
fail_unless(!!hrefs.value, "cli_malloc");
|
||||
hrefs.value[0] = realurl;
|
||||
hrefs.contents = cli_malloc(sizeof(*hrefs.contents));
|
||||
fail_unless(!!hrefs.contents, "cli_malloc");
|
||||
hrefs.contents[0] = blobCreate();
|
||||
hrefs.tag = cli_malloc(sizeof(*hrefs.tag));
|
||||
fail_unless(!!hrefs.tag, "cli_malloc");
|
||||
hrefs.tag[0] = "href";
|
||||
blobAddData(hrefs.contents[0], rtest->displayurl, strlen(rtest->displayurl)+1);
|
||||
|
||||
ctx.engine = engine;
|
||||
ctx.virname = &virname;
|
||||
rc = phishingScan(NULL, NULL, &ctx, &hrefs);
|
||||
blobDestroy(hrefs.contents[0]);
|
||||
free(realurl);
|
||||
fail_unless(rc == CL_CLEAN,"phishingScan");
|
||||
fail_unless(!!ctx.found_possibly_unwanted == !rtest->result ,
|
||||
"found unwanted: %d, expected: %d\n", ctx.found_possibly_unwanted, !rtest->result);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
||||
Suite *test_regex_suite(void)
|
||||
{
|
||||
cl_debug();
|
||||
Suite *s = suite_create("regex");
|
||||
TCase *tc_static, *tc_simple, *tc_api;
|
||||
TCase *tc_static, *tc_simple, *tc_api, *tc_matching, *tc_phish;
|
||||
|
||||
tc_api = tcase_create("cli_regex2suffix");
|
||||
tcase_add_checked_fixture (tc_api, setup, teardown);
|
||||
suite_add_tcase(s, tc_api);
|
||||
tcase_add_checked_fixture (tc_api, setup, teardown);
|
||||
tcase_add_test(tc_api, empty);
|
||||
tcase_add_test(tc_api, one);
|
||||
tcase_add_loop_test(tc_api, test_suffix, 0, sizeof(tests)/sizeof(tests[0]));
|
||||
|
||||
tc_matching = tcase_create("regex_list");
|
||||
suite_add_tcase(s, tc_matching);
|
||||
tcase_add_checked_fixture (tc_matching, rsetup, rteardown);
|
||||
tcase_add_loop_test(tc_matching, regex_list_match_test, 0, sizeof(rtests)/sizeof(rtests[0]));
|
||||
|
||||
tc_phish = tcase_create("phishingScan");
|
||||
suite_add_tcase(s, tc_phish);
|
||||
tcase_add_checked_fixture(tc_phish, psetup, pteardown);
|
||||
tcase_add_loop_test(tc_phish, phishingScan_test, 0, sizeof(rtests)/sizeof(rtests[0]));
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,4 +4,5 @@ Suite *test_jsnorm_suite(void);
|
|||
Suite *test_str_suite(void);
|
||||
Suite *test_regex_suite(void);
|
||||
void errmsg_expected(void);
|
||||
int open_testfile(const char *name);
|
||||
#endif
|
||||
|
|
340
unit_tests/input/COPYING
Normal file
340
unit_tests/input/COPYING
Normal file
|
@ -0,0 +1,340 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
202
unit_tests/input/daily.pdb
Normal file
202
unit_tests/input/daily.pdb
Normal file
|
@ -0,0 +1,202 @@
|
|||
H:key.com
|
||||
H:keybank.com
|
||||
H:lloydstsb.co.uk
|
||||
H:maybank2u.com.my
|
||||
H:nafcu.org
|
||||
H:nationwide.co.uk
|
||||
H:servis24.cz
|
||||
H:societegenerale.fr
|
||||
H:southtrust.com
|
||||
H:postfinance.ch
|
||||
H:royalbank.com
|
||||
H:natwest.com
|
||||
H:nbd.ae
|
||||
H:nbd.com
|
||||
H:cic.fr
|
||||
H:comfedbank.com
|
||||
H:commbank.com
|
||||
H:ba-ca.com
|
||||
H:bancaroma.it
|
||||
H:bankofamerica.com
|
||||
H:bankofcastile.com
|
||||
H:bankofscotlandhalifax-online.co.uk
|
||||
H:bankofscotlandhalifax.co.uk
|
||||
H:bankofthewest.com
|
||||
H:barclays.co.uk
|
||||
H:bluemountain.com
|
||||
H:bnpparibas.com
|
||||
H:cahoot.com
|
||||
H:ccbg.com
|
||||
H:ccf.fr
|
||||
H:chase.com
|
||||
H:365online.com
|
||||
H:commerzbank.de
|
||||
H:desjardins.com
|
||||
H:deutsche-bank.de
|
||||
H:e-gold.com
|
||||
H:netbanking.at
|
||||
H:olb2.nationet.com
|
||||
H:paypal.com
|
||||
H:postbank.de
|
||||
H:commbank.com.au
|
||||
H:sparkasse.de
|
||||
H:spk-luebeck.de
|
||||
H:suntrust.com
|
||||
H:usbank.com
|
||||
H:visa.com
|
||||
H:volksbank.de
|
||||
H:wachovia.com
|
||||
H:wamu.com
|
||||
H:wellsfargo.com
|
||||
H:amazon.de
|
||||
H:ebay.de
|
||||
H:egg.com
|
||||
H:etrade.com
|
||||
H:halifax-online.co.uk
|
||||
H:halifax.co.uk
|
||||
H:hsbc.co.uk
|
||||
H:hsbc.fr
|
||||
H:hypovereinsbank.de
|
||||
H:searscard.com
|
||||
H:capitalone.com
|
||||
H:hawaiiusafcu.com
|
||||
H:oibank.com
|
||||
H:smile.co.uk
|
||||
H:sears.com
|
||||
H:moneybookers.com
|
||||
H:cuwestathome.org
|
||||
H:kctcu.org
|
||||
H:bankwithheritage.com
|
||||
H:virginmoney.com
|
||||
H:elevationscu.com
|
||||
H:abbeynational.co.uk
|
||||
H:huntington.com
|
||||
H:coop-bank.com
|
||||
H:lasallebank.com
|
||||
H:coop-bankonline.com
|
||||
H:bankatunited.com
|
||||
H:nwolb.com
|
||||
H:www.stgeorge.com.au
|
||||
H:mbna.co.uk
|
||||
H:citizensbankonline.com
|
||||
H:regions.com
|
||||
H:citibank.de
|
||||
H:lloydstsb.com
|
||||
H:stgeorge.com.au
|
||||
H:citibank.com
|
||||
H:bankofscotland.co.uk
|
||||
H:bancafideuram.it
|
||||
H:national.com.au
|
||||
H:banesto.es
|
||||
H:erstebank.hu
|
||||
H:anz.com
|
||||
H:woolwich.co.uk
|
||||
H:mandtbank.com
|
||||
H:raiffeisen.hu
|
||||
H:cacu.com
|
||||
H:morganstanleycard.co.uk
|
||||
H:gruposantander.es
|
||||
H:bendigobank.com.au
|
||||
H:westpac.com.au
|
||||
H:regionsnet.com
|
||||
H:posteitaliane.it
|
||||
H:postei.it
|
||||
H:rbsdigital.com
|
||||
H:aib.ie
|
||||
H:tcunet.com
|
||||
H:nationalcity.com
|
||||
H:ebay.com:14-
|
||||
H:ebay.com.au:14-
|
||||
H:amazon.com:14-
|
||||
H:ebay.co.uk:14-
|
||||
H:tcfexpress.com
|
||||
H:standardbank.co.za
|
||||
H:anz.com.au
|
||||
H:nordea.se
|
||||
H:bancosantander.es
|
||||
H:nbg.gr
|
||||
H:westernunion.gr
|
||||
H:westernunion.de
|
||||
H:westernunion.fr
|
||||
H:westernunion.es
|
||||
H:westernunion.it
|
||||
H:wachoviabank.com
|
||||
H:arizonafederal.org
|
||||
H:azfcu.org
|
||||
H:bancaintesa.it
|
||||
H:harrisbank.com
|
||||
H:wbsavings.com
|
||||
H:akbank.com
|
||||
H:akbank.com.tr
|
||||
H:midamericabank.com
|
||||
H:cathaybank.com
|
||||
H:co-operativebank.co.uk
|
||||
H:centralbank.net
|
||||
H:secure.skype.com
|
||||
H:rasbank.it
|
||||
H:tdcanadatrust.com
|
||||
H:downeysavings.com
|
||||
H:rbc.com
|
||||
H:ncua.gov
|
||||
H:bancadiroma.it
|
||||
H:sella.it
|
||||
H:banamex.com
|
||||
H:paylinks.cunet.org
|
||||
H:hvb.de
|
||||
H:cscu.cyberbranch.com
|
||||
H:mybusinessbank.co.uk
|
||||
H:poste.it
|
||||
H:westernunion.co.uk
|
||||
H:chasefrauddetector.com
|
||||
H:ybonline.co.uk
|
||||
H:cscu.org
|
||||
H:flagstar.com
|
||||
H:irs.gov
|
||||
H:co-operative.co.uk
|
||||
H:abbey.co.uk
|
||||
H:natwest.co.uk
|
||||
H:capital1.com
|
||||
H:monster.com
|
||||
H:alliance-leicester.co.uk
|
||||
H:gtefcu.org
|
||||
H:lloydstsbbusiness.com
|
||||
H:citizensbankmoneymanagergps.com
|
||||
H:commercebank.com
|
||||
H:ibanking-services.com
|
||||
H:new.egg.com
|
||||
H:firstmeritib.com
|
||||
H:vr-networld.de
|
||||
H:53.com
|
||||
H:hsbc.com
|
||||
H:bancodisicilia.it
|
||||
H:if.com
|
||||
H:abbey.com
|
||||
H:soopercu.org
|
||||
H:halifaxlegalsolutions.co.uk
|
||||
H:hdfcbank.com
|
||||
H:argonnecu.org
|
||||
H:comerica.com
|
||||
H:cajamadrid.es
|
||||
H:anbtx.com
|
||||
H:anbtx.net
|
||||
H:scotiabank.com
|
||||
H:cahoot.co.uk
|
||||
H:postfinance.info
|
||||
H:ibercaja.es
|
||||
H:gesa.com
|
||||
H:susquehanna.net
|
||||
H:sterlingbank.com
|
||||
H:ing-diba.de
|
||||
H:tcfbank.com
|
||||
H:rbs.com
|
||||
H:rbs.de
|
||||
H:cartasi.it
|
||||
H:rbcroyalbank.com
|
||||
H:csas.cz
|
||||
H:adwords.google.com
|
||||
H:centrum24.pl
|
||||
H:uboc.com
|
||||
H:fideuramonline.it
|
||||
H:bnl.it
|
||||
H:mybdo.com
|
||||
H:metrobankdirect.com
|
31
unit_tests/input/daily.wdb
Normal file
31
unit_tests/input/daily.wdb
Normal file
|
@ -0,0 +1,31 @@
|
|||
M:poste.it:posteitaliane.it
|
||||
M:news.apple.co.jp:images.apple.com
|
||||
M:l.usbank-email.com:usbank.com
|
||||
M:mail.ebay.at:dm.ebay.de
|
||||
M:email.etradefinancial.com:etrade.com
|
||||
X:.+\.commerzbank.com([/?].*)?:.+\.commerzbank.de:17-
|
||||
X:.+\.hvb\.de([/?].*)?:.+\.hypovereinsbank\.de:17-
|
||||
M:email.chase.com:www.chasefrauddetector.com
|
||||
M:info.searscard.com:sears.com
|
||||
X:htt[p].//email.\.paypal\.com([/?].*)?:https.//www\.paypal\.com([/?].*):17-
|
||||
X:.+\.amazon\.(at|ca|co\.uk|co\.jp|de|fr)([/?].*)?:.+\.amazon\.com([/?].*)?:17-
|
||||
X:htt[p].//info\.citibank\.com([/?].*)?:https.//offer\.citibank\.com([/?].*)?:17-
|
||||
X:.+\.ebay\.com([/?].*)?:gotoebay\.co\.uk([/?].*)?:17-
|
||||
X:.+\.usbank-email\.com([/?].*)?:.+\.usbank\.com([/?].*)?:17-
|
||||
X:.+\.ebay\.(ca|com)([/?].*)?:ebay\.caorebay\.com([/?].*)?:17-
|
||||
M:www.postfinance.info:www.postfinance.ch
|
||||
X:.+\.paypal\.(de|fr|it)([/?].*)?:.+\.paypal\.com([/?].*)?:17-
|
||||
X:.+\.ebay\.(at|be|ca|ch|co\.uk|de|es|fr|ie|in|it|nl|ph|pl|com\.(au|cn|hk|my|sg))([/?].*)?:.+\.ebay\.com([/?].*)?:17-
|
||||
X:.+\.ebayrtm\.com([/?].*)?:.+\.ebay\.(de|com|co\.uk)([/?].*)?:17-
|
||||
X:.+\.ebaymotors\.com([/?].*)?:.+\.ebay\.com([/?].*)?:17-
|
||||
X:.+adfarm\.mediaplex\.com([/?].*)?:.+\.ebay\.com([/?].*)?:17-
|
||||
X:.+\.etradefinancial\.com([/?].*)?:(.+\.)?etrade\.com([/?].*)?:17-
|
||||
M:www.deliverymail.com:media.monster.com
|
||||
X:.+\.ebay\.com([/?].*)?:.+ebay\.co\.uk([/?].*)?:17-
|
||||
X:.+:.+images\.amazon\.com([/?].*)?:17-
|
||||
X:.+:.+images-eu\.amazon\.com([/?].*)?:17-
|
||||
X:.+:.+rcm\.amazon\.com([/?].*)?:17-
|
||||
X:.+\.ebay\.com([/?].*)?:.+\.ebay\.(at|be|ca|ch|co\.uk|de|es|fr|ie|in|it|nl|ph|pl|com\.(au|cn|hk|my|sg))([/?].*)?:17-
|
||||
M:www.paypal.com%a0:www.paypal.com
|
||||
M:www.monster.fr:media.monster.com
|
||||
X:.+\.paypal\.(com|de|fr|it)([/?].*)?:.+\.ebay\.(at|be|ca|ch|co\.uk|de|es|fr|ie|in|it|nl|ph|pl|com(\.(au|cn|hk|my|sg))?)([/?].*)?:17-
|
7
unit_tests/valgrind.supp
Normal file
7
unit_tests/valgrind.supp
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
glibc-2.7-exit-free
|
||||
Memcheck:Free
|
||||
fun:free
|
||||
fun:free_mem
|
||||
fun:__libc_freeres
|
||||
}
|
28
unit_tests/valgrind_tests.sh
Executable file
28
unit_tests/valgrind_tests.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
VALGRIND=`which ${VALGRIND-valgrind}`
|
||||
VALGRIND_FLAGS="--trace-children=yes --track-fds=yes --leak-check=full --show-reachable=yes --suppressions=$srcdir/valgrind.supp"
|
||||
test -n "$VALGRIND" || { echo "*** valgrind not found, skipping test"; exit 77; }
|
||||
test -x "$VALGRIND" || { echo "*** valgrind not executable, skipping test"; exit 77; }
|
||||
|
||||
echo "Running valgrind"
|
||||
CK_FORK=no ../libtool --mode=execute $VALGRIND $VALGRIND_FLAGS ./check_clamav 2>&1 | cat >valgrind.log
|
||||
if test $? -eq 0; then
|
||||
if grep "no leaks are possible" valgrind.log >/dev/null; then
|
||||
echo "Valgrind tests successful"
|
||||
exit 0;
|
||||
fi
|
||||
echo "*** Valgrind test FAILED, memory LEAKS detected ***"
|
||||
else
|
||||
echo "*** Valgrind test FAILED, memory ERRORS detected ****"
|
||||
fi
|
||||
echo
|
||||
grep "ERROR SUMMARY" valgrind.log
|
||||
echo `grep "Invalid read" valgrind.log| wc -l` "invalid reads"
|
||||
echo `grep "Invalid write" valgrind.log| wc -l` "invalid writes"
|
||||
echo `grep "Invalid free" valgrind.log| wc -l` "invalid frees"
|
||||
echo `grep "uninitialized value" valgrind.log|wc -l` "uses of uninitialized values"
|
||||
grep " lost:" valgrind.log
|
||||
grep "still reachable:" valgrind.log
|
||||
grep "FILE DESCRIPTORS" valgrind.log
|
||||
echo
|
||||
exit 1;
|
Loading…
Add table
Add a link
Reference in a new issue