git-svn: trunk@3990
Török Edvin authored on 2008/07/26 01:03:04... | ... |
@@ -871,13 +871,13 @@ GPERF |
871 | 871 |
PKG_CONFIG |
872 | 872 |
CHECK_CFLAGS |
873 | 873 |
CHECK_LIBS |
874 |
+GCOV |
|
875 |
+LCOV |
|
876 |
+GENHTML |
|
874 | 877 |
ENABLE_COVERAGE_TRUE |
875 | 878 |
ENABLE_COVERAGE_FALSE |
876 | 879 |
ENABLE_UT_INSTALL_TRUE |
877 | 880 |
ENABLE_UT_INSTALL_FALSE |
878 |
-GCOV |
|
879 |
-LCOV |
|
880 |
-GENHTML |
|
881 | 881 |
MAINTAINER_MODE_TRUE |
882 | 882 |
MAINTAINER_MODE_FALSE |
883 | 883 |
MAINT |
... | ... |
@@ -13540,25 +13540,7 @@ echo "$as_me: error: coverage testing only works if gcc is used" >&2;} |
13540 | 13540 |
|
13541 | 13541 |
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
13542 | 13542 |
LDFLAGS="$LDFLAGS -lgcov" |
13543 |
-fi |
|
13544 |
- |
|
13545 |
- if test "x$enable_coverage" = "xyes"; then |
|
13546 |
- ENABLE_COVERAGE_TRUE= |
|
13547 |
- ENABLE_COVERAGE_FALSE='#' |
|
13548 |
-else |
|
13549 |
- ENABLE_COVERAGE_TRUE='#' |
|
13550 |
- ENABLE_COVERAGE_FALSE= |
|
13551 |
-fi |
|
13552 |
- |
|
13553 |
- if test "x$enable_ut_install" = "xyes"; then |
|
13554 |
- ENABLE_UT_INSTALL_TRUE= |
|
13555 |
- ENABLE_UT_INSTALL_FALSE='#' |
|
13556 |
-else |
|
13557 |
- ENABLE_UT_INSTALL_TRUE='#' |
|
13558 |
- ENABLE_UT_INSTALL_FALSE= |
|
13559 |
-fi |
|
13560 |
- |
|
13561 |
-for ac_prog in gcov |
|
13543 |
+ for ac_prog in gcov |
|
13562 | 13544 |
do |
13563 | 13545 |
# Extract the first word of "$ac_prog", so it can be a program name with args. |
13564 | 13546 |
set dummy $ac_prog; ac_word=$2 |
... | ... |
@@ -13601,7 +13583,7 @@ fi |
13601 | 13601 |
done |
13602 | 13602 |
test -n "$GCOV" || GCOV="false" |
13603 | 13603 |
|
13604 |
-for ac_prog in lcov |
|
13604 |
+ for ac_prog in lcov |
|
13605 | 13605 |
do |
13606 | 13606 |
# Extract the first word of "$ac_prog", so it can be a program name with args. |
13607 | 13607 |
set dummy $ac_prog; ac_word=$2 |
... | ... |
@@ -13644,7 +13626,7 @@ fi |
13644 | 13644 |
done |
13645 | 13645 |
test -n "$LCOV" || LCOV="false" |
13646 | 13646 |
|
13647 |
-for ac_prog in genhtml |
|
13647 |
+ for ac_prog in genhtml |
|
13648 | 13648 |
do |
13649 | 13649 |
# Extract the first word of "$ac_prog", so it can be a program name with args. |
13650 | 13650 |
set dummy $ac_prog; ac_word=$2 |
... | ... |
@@ -13687,6 +13669,24 @@ fi |
13687 | 13687 |
done |
13688 | 13688 |
test -n "$GENHTML" || GENHTML="false" |
13689 | 13689 |
|
13690 |
+fi |
|
13691 |
+ |
|
13692 |
+ if test "x$enable_coverage" = "xyes"; then |
|
13693 |
+ ENABLE_COVERAGE_TRUE= |
|
13694 |
+ ENABLE_COVERAGE_FALSE='#' |
|
13695 |
+else |
|
13696 |
+ ENABLE_COVERAGE_TRUE='#' |
|
13697 |
+ ENABLE_COVERAGE_FALSE= |
|
13698 |
+fi |
|
13699 |
+ |
|
13700 |
+ if test "x$enable_ut_install" = "xyes"; then |
|
13701 |
+ ENABLE_UT_INSTALL_TRUE= |
|
13702 |
+ ENABLE_UT_INSTALL_FALSE='#' |
|
13703 |
+else |
|
13704 |
+ ENABLE_UT_INSTALL_TRUE='#' |
|
13705 |
+ ENABLE_UT_INSTALL_FALSE= |
|
13706 |
+fi |
|
13707 |
+ |
|
13690 | 13708 |
|
13691 | 13709 |
have_pthreads=no |
13692 | 13710 |
if test "${ac_cv_header_pthread_h+set}" = set; then |
... | ... |
@@ -20703,13 +20703,13 @@ GPERF!$GPERF$ac_delim |
20703 | 20703 |
PKG_CONFIG!$PKG_CONFIG$ac_delim |
20704 | 20704 |
CHECK_CFLAGS!$CHECK_CFLAGS$ac_delim |
20705 | 20705 |
CHECK_LIBS!$CHECK_LIBS$ac_delim |
20706 |
+GCOV!$GCOV$ac_delim |
|
20707 |
+LCOV!$LCOV$ac_delim |
|
20708 |
+GENHTML!$GENHTML$ac_delim |
|
20706 | 20709 |
ENABLE_COVERAGE_TRUE!$ENABLE_COVERAGE_TRUE$ac_delim |
20707 | 20710 |
ENABLE_COVERAGE_FALSE!$ENABLE_COVERAGE_FALSE$ac_delim |
20708 | 20711 |
ENABLE_UT_INSTALL_TRUE!$ENABLE_UT_INSTALL_TRUE$ac_delim |
20709 | 20712 |
ENABLE_UT_INSTALL_FALSE!$ENABLE_UT_INSTALL_FALSE$ac_delim |
20710 |
-GCOV!$GCOV$ac_delim |
|
20711 |
-LCOV!$LCOV$ac_delim |
|
20712 |
-GENHTML!$GENHTML$ac_delim |
|
20713 | 20713 |
MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim |
20714 | 20714 |
MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim |
20715 | 20715 |
MAINT!$MAINT$ac_delim |
... | ... |
@@ -375,13 +375,13 @@ if test "x$enable_coverage" = "xyes"; then |
375 | 375 |
|
376 | 376 |
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
377 | 377 |
LDFLAGS="$LDFLAGS -lgcov" |
378 |
+ AC_CHECK_PROGS(GCOV, gcov, false) |
|
379 |
+ AC_CHECK_PROGS(LCOV, lcov, false) |
|
380 |
+ AC_CHECK_PROGS(GENHTML, genhtml, false) |
|
378 | 381 |
fi |
379 | 382 |
|
380 | 383 |
AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_coverage" = "xyes") |
381 | 384 |
AM_CONDITIONAL(ENABLE_UT_INSTALL, test "x$enable_ut_install" = "xyes") |
382 |
-AC_CHECK_PROGS(GCOV, gcov, false) |
|
383 |
-AC_CHECK_PROGS(LCOV, lcov, false) |
|
384 |
-AC_CHECK_PROGS(GENHTML, genhtml, false) |
|
385 | 385 |
|
386 | 386 |
have_pthreads=no |
387 | 387 |
AC_CHECK_HEADER([pthread.h],[have_pthreads=yes],) |
... | ... |
@@ -85,6 +85,22 @@ CLAMAV_PRIVATE { |
85 | 85 |
cli_dconf_init; |
86 | 86 |
cli_regex2suffix; |
87 | 87 |
html_normalise_mem; |
88 |
+ init_regex_list; |
|
89 |
+ is_regex_ok; |
|
90 |
+ regex_list_done; |
|
91 |
+ regex_list_add_pattern; |
|
92 |
+ cli_build_regex_list; |
|
93 |
+ regex_list_match; |
|
94 |
+ cli_initengine; |
|
95 |
+ phishing_init; |
|
96 |
+ init_domainlist; |
|
97 |
+ init_whitelist; |
|
98 |
+ phishing_done; |
|
99 |
+ blobCreate; |
|
100 |
+ blobAddData; |
|
101 |
+ phishingScan; |
|
102 |
+ blobDestroy; |
|
103 |
+ load_regex_matcher; |
|
88 | 104 |
local: |
89 | 105 |
*; |
90 | 106 |
}; |
... | ... |
@@ -59,7 +59,6 @@ |
59 | 59 |
#include "regex_suffix.h" |
60 | 60 |
/* Prototypes */ |
61 | 61 |
static size_t reverse_string(char *pattern); |
62 |
-static int add_pattern(struct regex_matcher *matcher, char *pattern); |
|
63 | 62 |
static int add_pattern_suffix(void *cbdata, const char *suffix, size_t suffix_len, struct regex_list *regex); |
64 | 63 |
static int add_static_pattern(struct regex_matcher *matcher, char* pattern); |
65 | 64 |
/* ---------- */ |
... | ... |
@@ -463,7 +462,7 @@ int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int optio |
463 | 463 |
|
464 | 464 |
if((buffer[0] == 'R' && !is_whitelist) || ((buffer[0] == 'X' || buffer[0] == 'Y') && is_whitelist)) { |
465 | 465 |
/* regex for hostname*/ |
466 |
- if (( rc = add_pattern(matcher, pattern) )) |
|
466 |
+ if (( rc = regex_list_add_pattern(matcher, pattern) )) |
|
467 | 467 |
return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB; |
468 | 468 |
} |
469 | 469 |
else if( ( buffer[0] == 'H' && !is_whitelist) || (buffer[0] == 'M' && is_whitelist)) { |
... | ... |
@@ -514,6 +513,7 @@ void regex_list_done(struct regex_matcher* matcher) |
514 | 514 |
struct regex_list *r = matcher->suffix_regexes[i]; |
515 | 515 |
while(r) { |
516 | 516 |
free(r->pattern); |
517 |
+ r->pattern = NULL; |
|
517 | 518 |
cli_regfree(&r->preg); |
518 | 519 |
r = r->nxt; |
519 | 520 |
} |
... | ... |
@@ -638,7 +638,7 @@ static int add_static_pattern(struct regex_matcher *matcher, char* pattern) |
638 | 638 |
return add_pattern_suffix(matcher, pattern, len, regex); |
639 | 639 |
} |
640 | 640 |
|
641 |
-static int add_pattern(struct regex_matcher *matcher, char *pattern) |
|
641 |
+int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern) |
|
642 | 642 |
{ |
643 | 643 |
int rc; |
644 | 644 |
struct regex_list *regex = cli_malloc(sizeof(*regex)); |
... | ... |
@@ -655,9 +655,11 @@ static int add_pattern(struct regex_matcher *matcher, char *pattern) |
655 | 655 |
if(len > sizeof(remove_end)) { |
656 | 656 |
if(strncmp(&pattern[len - sizeof(remove_end)+1], remove_end, sizeof(remove_end)-1) == 0) { |
657 | 657 |
len -= sizeof(remove_end) - 1; |
658 |
+ pattern[len++]='/'; |
|
658 | 659 |
} |
659 | 660 |
if(strncmp(&pattern[len - sizeof(remove_end2)+1], remove_end2, sizeof(remove_end2)-1) == 0) { |
660 | 661 |
len -= sizeof(remove_end2) - 1; |
662 |
+ pattern[len++]='/'; |
|
661 | 663 |
} |
662 | 664 |
} |
663 | 665 |
pattern[len] = '\0'; |
... | ... |
@@ -48,6 +48,7 @@ struct regex_matcher { |
48 | 48 |
}; |
49 | 49 |
|
50 | 50 |
int cli_build_regex_list(struct regex_matcher* matcher); |
51 |
+int regex_list_add_pattern(struct regex_matcher *matcher, char *pattern); |
|
51 | 52 |
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); |
52 | 53 |
int init_regex_list(struct regex_matcher* matcher); |
53 | 54 |
int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist,struct cli_dbio *dbio); |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
programs = check_clamav |
2 |
-scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh |
|
2 |
+scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh valgrind_tests.sh |
|
3 | 3 |
|
4 | 4 |
TESTS = $(programs) $(scripts) |
5 | 5 |
if ENABLE_UT_INSTALL |
... | ... |
@@ -10,7 +10,7 @@ check_PROGRAMS = $(programs) |
10 | 10 |
check_SCRIPTS = $(scripts) |
11 | 11 |
endif |
12 | 12 |
check_clamav_SOURCES = check_clamav.c check_jsnorm.c check_str.c check_regex.c checks.h $(top_builddir)/libclamav/clamav.h |
13 |
-check_clamav_CFLAGS = @CHECK_CFLAGS@ |
|
13 |
+check_clamav_CFLAGS = @CHECK_CFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" |
|
14 | 14 |
check_clamav_LDADD = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@ @CHECK_LIBS@ |
15 | 15 |
|
16 | 16 |
check_clamd.sh: $(top_builddir)/test/clam.exe |
... | ... |
@@ -24,17 +24,18 @@ if ENABLE_COVERAGE |
24 | 24 |
LCOV_OUTPUT = lcov.out |
25 | 25 |
LCOV_HTML = lcov_html |
26 | 26 |
LCOV_LCOV = @LCOV@ |
27 |
+LCOV_GCOV = @GCOV@ |
|
27 | 28 |
LCOV_GENHTML = @GENHTML@ |
28 | 29 |
CLEANFILES=lcov.out *.gcno *.gcda *.log /tmp/clamd-test.log |
29 | 30 |
lcov: $(LCOV_HTML) |
30 | 31 |
|
31 | 32 |
DIRECTORIES=--directory . --directory ../libclamav --directory ../clamd --directory ../freshclam --directory ../sigtool --directory ../clamscan --directory ../clamdscan |
32 | 33 |
.libs/check_clamav.gcda: $(TESTS) |
33 |
- lcov $(DIRECTORIES) --zerocounters |
|
34 |
+ $(LCOV_LCOV) $(DIRECTORIES) --zerocounters |
|
34 | 35 |
@$(MAKE) check |
35 | 36 |
|
36 | 37 |
$(LCOV_OUTPUT): .libs/check_clamav.gcda |
37 |
- $(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file $@ |
|
38 |
+ $(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file --gcov-tool $(LCOV_GCOV) $@ |
|
38 | 39 |
|
39 | 40 |
$(LCOV_HTML): $(LCOV_OUTPUT) |
40 | 41 |
-$(RM) -r $@ |
... | ... |
@@ -45,7 +46,7 @@ clean-local: lcov-clean |
45 | 45 |
.PHONY: lcov-clean |
46 | 46 |
lcov-clean: |
47 | 47 |
-$(RM) -r $(LCOV_HTML) $(LCOV_OUTPUT) |
48 |
- lcov $(DIRECTORIES) --zerocounters |
|
48 |
+ $(LCOV_LCOV) $(DIRECTORIES) --zerocounters |
|
49 | 49 |
else |
50 | 50 |
|
51 | 51 |
CLEANFILES=/tmp/clamd-test.log |
... | ... |
@@ -63,7 +63,7 @@ check_clamav_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ |
63 | 63 |
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(check_clamav_CFLAGS) \ |
64 | 64 |
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ |
65 | 65 |
am__dist_bin_SCRIPTS_DIST = check_clamd.sh check_freshclam.sh \ |
66 |
- check_sigtool.sh check_clamscan.sh |
|
66 |
+ check_sigtool.sh check_clamscan.sh valgrind_tests.sh |
|
67 | 67 |
dist_binSCRIPT_INSTALL = $(INSTALL_SCRIPT) |
68 | 68 |
SCRIPTS = $(dist_bin_SCRIPTS) |
69 | 69 |
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) |
... | ... |
@@ -217,16 +217,17 @@ target_vendor = @target_vendor@ |
217 | 217 |
top_builddir = @top_builddir@ |
218 | 218 |
top_srcdir = @top_srcdir@ |
219 | 219 |
programs = check_clamav |
220 |
-scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh |
|
220 |
+scripts = check_clamd.sh check_freshclam.sh check_sigtool.sh check_clamscan.sh valgrind_tests.sh |
|
221 | 221 |
@ENABLE_UT_INSTALL_TRUE@dist_bin_SCRIPTS = $(scripts) |
222 | 222 |
@ENABLE_UT_INSTALL_FALSE@check_SCRIPTS = $(scripts) |
223 | 223 |
check_clamav_SOURCES = check_clamav.c check_jsnorm.c check_str.c check_regex.c checks.h $(top_builddir)/libclamav/clamav.h |
224 |
-check_clamav_CFLAGS = @CHECK_CFLAGS@ |
|
224 |
+check_clamav_CFLAGS = @CHECK_CFLAGS@ -DSRCDIR=\"$(abs_srcdir)\" |
|
225 | 225 |
check_clamav_LDADD = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@ @CHECK_LIBS@ |
226 | 226 |
EXTRA_DIST = test-clamd.conf test-freshclam.conf |
227 | 227 |
@ENABLE_COVERAGE_TRUE@LCOV_OUTPUT = lcov.out |
228 | 228 |
@ENABLE_COVERAGE_TRUE@LCOV_HTML = lcov_html |
229 | 229 |
@ENABLE_COVERAGE_TRUE@LCOV_LCOV = @LCOV@ |
230 |
+@ENABLE_COVERAGE_TRUE@LCOV_GCOV = @GCOV@ |
|
230 | 231 |
@ENABLE_COVERAGE_TRUE@LCOV_GENHTML = @GENHTML@ |
231 | 232 |
@ENABLE_COVERAGE_FALSE@CLEANFILES = /tmp/clamd-test.log |
232 | 233 |
@ENABLE_COVERAGE_TRUE@CLEANFILES = lcov.out *.gcno *.gcda *.log /tmp/clamd-test.log |
... | ... |
@@ -682,11 +683,11 @@ $(top_builddir)/test/clam.exe: |
682 | 682 |
(cd $(top_builddir)/test && $(MAKE)) |
683 | 683 |
@ENABLE_COVERAGE_TRUE@lcov: $(LCOV_HTML) |
684 | 684 |
@ENABLE_COVERAGE_TRUE@.libs/check_clamav.gcda: $(TESTS) |
685 |
-@ENABLE_COVERAGE_TRUE@ lcov $(DIRECTORIES) --zerocounters |
|
685 |
+@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) $(DIRECTORIES) --zerocounters |
|
686 | 686 |
@ENABLE_COVERAGE_TRUE@ @$(MAKE) check |
687 | 687 |
|
688 | 688 |
@ENABLE_COVERAGE_TRUE@$(LCOV_OUTPUT): .libs/check_clamav.gcda |
689 |
-@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file $@ |
|
689 |
+@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) --capture $(DIRECTORIES) --base-directory . --output-file --gcov-tool $(LCOV_GCOV) $@ |
|
690 | 690 |
|
691 | 691 |
@ENABLE_COVERAGE_TRUE@$(LCOV_HTML): $(LCOV_OUTPUT) |
692 | 692 |
@ENABLE_COVERAGE_TRUE@ -$(RM) -r $@ |
... | ... |
@@ -697,7 +698,7 @@ $(top_builddir)/test/clam.exe: |
697 | 697 |
@ENABLE_COVERAGE_TRUE@.PHONY: lcov-clean |
698 | 698 |
@ENABLE_COVERAGE_TRUE@lcov-clean: |
699 | 699 |
@ENABLE_COVERAGE_TRUE@ -$(RM) -r $(LCOV_HTML) $(LCOV_OUTPUT) |
700 |
-@ENABLE_COVERAGE_TRUE@ lcov $(DIRECTORIES) --zerocounters |
|
700 |
+@ENABLE_COVERAGE_TRUE@ $(LCOV_LCOV) $(DIRECTORIES) --zerocounters |
|
701 | 701 |
@ENABLE_COVERAGE_FALSE@lcov: |
702 | 702 |
@ENABLE_COVERAGE_FALSE@ @echo "Coverage information gathering is not enabled in this build" |
703 | 703 |
@ENABLE_COVERAGE_FALSE@ @echo "Use ./configure --enable-coverage to enable it" |
... | ... |
@@ -15,6 +15,7 @@ int main(int argc, char **argv) |
15 | 15 |
|
16 | 16 |
#include <stdlib.h> |
17 | 17 |
#include <limits.h> |
18 |
+#include <fcntl.h> |
|
18 | 19 |
#include <string.h> |
19 | 20 |
#include <check.h> |
20 | 21 |
#include "../libclamav/clamav.h" |
... | ... |
@@ -303,6 +304,27 @@ void errmsg_expected(void) |
303 | 303 |
fputs("cli_errmsg() expected here\n", stderr); |
304 | 304 |
} |
305 | 305 |
|
306 |
+int open_testfile(const char *name) |
|
307 |
+{ |
|
308 |
+ int fd; |
|
309 |
+ const char * srcdir = getenv("srcdir"); |
|
310 |
+ char *str; |
|
311 |
+ |
|
312 |
+ if(!srcdir) { |
|
313 |
+ /* when run from automake srcdir is set, but if run manually then not */ |
|
314 |
+ srcdir = SRCDIR; |
|
315 |
+ } |
|
316 |
+ |
|
317 |
+ str = cli_malloc(strlen(name)+strlen(srcdir)+2); |
|
318 |
+ fail_unless(!!str, "cli_malloc"); |
|
319 |
+ sprintf(str, "%s/%s", srcdir, name); |
|
320 |
+ |
|
321 |
+ fd = open(str, O_RDONLY); |
|
322 |
+ fail_unless(fd >= 0, "open()"); |
|
323 |
+ free(str); |
|
324 |
+ return fd; |
|
325 |
+} |
|
326 |
+ |
|
306 | 327 |
int main(int argc, char **argv) |
307 | 328 |
{ |
308 | 329 |
int nf; |
... | ... |
@@ -32,6 +32,11 @@ |
32 | 32 |
#include "../libclamav/clamav.h" |
33 | 33 |
#include "../libclamav/others.h" |
34 | 34 |
#include "../libclamav/regex_suffix.h" |
35 |
+#include "../libclamav/regex_list.h" |
|
36 |
+#include "../libclamav/htmlnorm.h" |
|
37 |
+#include "../libclamav/mbox.h" |
|
38 |
+#include "../libclamav/message.h" |
|
39 |
+#include "../libclamav/phishcheck.h" |
|
35 | 40 |
#include "checks.h" |
36 | 41 |
|
37 | 42 |
static int cb_called = 0; |
... | ... |
@@ -126,17 +131,177 @@ static void teardown(void) |
126 | 126 |
free(regex.pattern); |
127 | 127 |
} |
128 | 128 |
|
129 |
+static struct regex_matcher matcher; |
|
130 |
+ |
|
131 |
+static void rsetup(void) |
|
132 |
+{ |
|
133 |
+ int rc = init_regex_list(&matcher); |
|
134 |
+ fail_unless(rc == 0, "init_regex_list"); |
|
135 |
+} |
|
136 |
+ |
|
137 |
+static void rteardown(void) |
|
138 |
+{ |
|
139 |
+ regex_list_done(&matcher); |
|
140 |
+} |
|
141 |
+ |
|
142 |
+static const struct rtest { |
|
143 |
+ const char *pattern;/* NULL if not meant for whitelist testing */ |
|
144 |
+ const char *realurl; |
|
145 |
+ const char *displayurl; |
|
146 |
+ int result;/* 0 - phish, 1 - whitelisted, 2 - clean */ |
|
147 |
+} rtests[] = { |
|
148 |
+ /* entry taken from .wdb with a / appended */ |
|
149 |
+ {".+\\.ebayrtm\\.com([/?].*)?:.+\\.ebay\\.(de|com|co\\.uk)([/?].*)?/", |
|
150 |
+ "http://srx.main.ebayrtm.com", |
|
151 |
+ "pages.ebay.de", |
|
152 |
+ 1 /* should be whitelisted */} |
|
153 |
+}; |
|
154 |
+ |
|
155 |
+START_TEST (regex_list_match_test) |
|
156 |
+{ |
|
157 |
+ const char *info; |
|
158 |
+ const struct rtest *rtest = &rtests[_i]; |
|
159 |
+ char *pattern; |
|
160 |
+ |
|
161 |
+ if(!rtest->pattern) { |
|
162 |
+ fail_unless(rtest->result != 1, |
|
163 |
+ "whitelist test must have pattern set"); |
|
164 |
+ /* this test entry is not meant for whitelist testing */ |
|
165 |
+ return; |
|
166 |
+ } |
|
167 |
+ |
|
168 |
+ fail_unless(rtest->result == 0 || rtest->result == 1, |
|
169 |
+ "whitelist test result must be either 0 or 1"); |
|
170 |
+ pattern = cli_strdup(rtest->pattern); |
|
171 |
+ fail_unless(!!pattern, "cli_strdup"); |
|
172 |
+ |
|
173 |
+ int rc = regex_list_add_pattern(&matcher, pattern); |
|
174 |
+ fail_unless(rc == 0,"regex_list_add_pattern"); |
|
175 |
+ |
|
176 |
+ matcher.list_loaded = 1; |
|
177 |
+ |
|
178 |
+ rc = cli_build_regex_list(&matcher); |
|
179 |
+ fail_unless(rc == 0,"cli_build_regex_list"); |
|
180 |
+ |
|
181 |
+ fail_unless(is_regex_ok(&matcher),"is_regex_ok"); |
|
182 |
+ |
|
183 |
+ /* regex_list_match is not supposed to modify realurl in this case */ |
|
184 |
+ rc = regex_list_match(&matcher, (char*)rtest->realurl, rtest->displayurl, NULL, 1, &info, 1); |
|
185 |
+ fail_unless(rc == rtest->result,"regex_list_match"); |
|
186 |
+} |
|
187 |
+END_TEST |
|
188 |
+ |
|
189 |
+static struct cl_engine *engine; |
|
190 |
+static void psetup(void) |
|
191 |
+{ |
|
192 |
+ FILE *f; |
|
193 |
+ struct phishcheck *pchk; |
|
194 |
+ int rc; |
|
195 |
+ rc = cli_initengine(&engine, 0); |
|
196 |
+ fail_unless(rc == 0, "cl_initengine"); |
|
197 |
+ |
|
198 |
+ rc = phishing_init(engine); |
|
199 |
+ fail_unless(rc == 0,"phishing_init"); |
|
200 |
+ pchk = engine->phishcheck; |
|
201 |
+ fail_unless(!!pchk, "engine->phishcheck"); |
|
202 |
+ |
|
203 |
+ rc = init_domainlist(engine); |
|
204 |
+ fail_unless(rc == 0,"init_domainlist"); |
|
205 |
+ |
|
206 |
+ f = fdopen(open_testfile("input/daily.pdb"),"r"); |
|
207 |
+ fail_unless(!!f, "fopen daily.pdb"); |
|
208 |
+ |
|
209 |
+ rc = load_regex_matcher(engine->domainlist_matcher, f, 0, 0, NULL); |
|
210 |
+ fail_unless(rc == 0, "load_regex_matcher"); |
|
211 |
+ fclose(f); |
|
212 |
+ |
|
213 |
+ rc = init_whitelist(engine); |
|
214 |
+ fail_unless(rc == 0,"init_whitelist"); |
|
215 |
+ |
|
216 |
+ f = fdopen(open_testfile("input/daily.wdb"),"r"); |
|
217 |
+ rc = load_regex_matcher(engine->whitelist_matcher, f, 0, 1, NULL); |
|
218 |
+ fail_unless(rc == 0,"load_regex_matcher"); |
|
219 |
+ fclose(f); |
|
220 |
+ |
|
221 |
+ rc = cli_build_regex_list(engine->whitelist_matcher); |
|
222 |
+ fail_unless(rc == 0,"cli_build_regex_list"); |
|
223 |
+ |
|
224 |
+ rc = cli_build_regex_list(engine->domainlist_matcher); |
|
225 |
+ fail_unless(rc == 0,"cli_build_regex_list"); |
|
226 |
+ |
|
227 |
+ fail_unless(is_regex_ok(engine->whitelist_matcher),"is_regex_ok"); |
|
228 |
+ fail_unless(is_regex_ok(engine->domainlist_matcher),"is_regex_ok"); |
|
229 |
+} |
|
230 |
+ |
|
231 |
+static void pteardown(void) |
|
232 |
+{ |
|
233 |
+ phishing_done(engine); |
|
234 |
+ cl_free(engine); |
|
235 |
+ engine = NULL; |
|
236 |
+} |
|
237 |
+ |
|
238 |
+START_TEST (phishingScan_test) |
|
239 |
+{ |
|
240 |
+ const char *info; |
|
241 |
+ const struct rtest *rtest = &rtests[_i]; |
|
242 |
+ char *realurl; |
|
243 |
+ cli_ctx ctx; |
|
244 |
+ const char *virname; |
|
245 |
+ tag_arguments_t hrefs; |
|
246 |
+ int rc; |
|
247 |
+ |
|
248 |
+ memset(&ctx, 0, sizeof(ctx)); |
|
249 |
+ |
|
250 |
+ realurl = cli_strdup(rtest->realurl); |
|
251 |
+ fail_unless(!!realurl, "cli_strdup"); |
|
252 |
+ |
|
253 |
+ hrefs.count = 1; |
|
254 |
+ hrefs.value = cli_malloc(sizeof(*hrefs.value)); |
|
255 |
+ fail_unless(!!hrefs.value, "cli_malloc"); |
|
256 |
+ hrefs.value[0] = realurl; |
|
257 |
+ hrefs.contents = cli_malloc(sizeof(*hrefs.contents)); |
|
258 |
+ fail_unless(!!hrefs.contents, "cli_malloc"); |
|
259 |
+ hrefs.contents[0] = blobCreate(); |
|
260 |
+ hrefs.tag = cli_malloc(sizeof(*hrefs.tag)); |
|
261 |
+ fail_unless(!!hrefs.tag, "cli_malloc"); |
|
262 |
+ hrefs.tag[0] = "href"; |
|
263 |
+ blobAddData(hrefs.contents[0], rtest->displayurl, strlen(rtest->displayurl)+1); |
|
264 |
+ |
|
265 |
+ ctx.engine = engine; |
|
266 |
+ ctx.virname = &virname; |
|
267 |
+ rc = phishingScan(NULL, NULL, &ctx, &hrefs); |
|
268 |
+ blobDestroy(hrefs.contents[0]); |
|
269 |
+ free(realurl); |
|
270 |
+ fail_unless(rc == CL_CLEAN,"phishingScan"); |
|
271 |
+ fail_unless(!!ctx.found_possibly_unwanted == !rtest->result , |
|
272 |
+ "found unwanted: %d, expected: %d\n", ctx.found_possibly_unwanted, !rtest->result); |
|
273 |
+} |
|
274 |
+END_TEST |
|
275 |
+ |
|
276 |
+ |
|
129 | 277 |
Suite *test_regex_suite(void) |
130 | 278 |
{ |
279 |
+ cl_debug(); |
|
131 | 280 |
Suite *s = suite_create("regex"); |
132 |
- TCase *tc_static, *tc_simple, *tc_api; |
|
281 |
+ TCase *tc_static, *tc_simple, *tc_api, *tc_matching, *tc_phish; |
|
133 | 282 |
|
134 | 283 |
tc_api = tcase_create("cli_regex2suffix"); |
135 |
- tcase_add_checked_fixture (tc_api, setup, teardown); |
|
136 | 284 |
suite_add_tcase(s, tc_api); |
285 |
+ tcase_add_checked_fixture (tc_api, setup, teardown); |
|
137 | 286 |
tcase_add_test(tc_api, empty); |
138 | 287 |
tcase_add_test(tc_api, one); |
139 | 288 |
tcase_add_loop_test(tc_api, test_suffix, 0, sizeof(tests)/sizeof(tests[0])); |
289 |
+ |
|
290 |
+ tc_matching = tcase_create("regex_list"); |
|
291 |
+ suite_add_tcase(s, tc_matching); |
|
292 |
+ tcase_add_checked_fixture (tc_matching, rsetup, rteardown); |
|
293 |
+ tcase_add_loop_test(tc_matching, regex_list_match_test, 0, sizeof(rtests)/sizeof(rtests[0])); |
|
294 |
+ |
|
295 |
+ tc_phish = tcase_create("phishingScan"); |
|
296 |
+ suite_add_tcase(s, tc_phish); |
|
297 |
+ tcase_add_checked_fixture(tc_phish, psetup, pteardown); |
|
298 |
+ tcase_add_loop_test(tc_phish, phishingScan_test, 0, sizeof(rtests)/sizeof(rtests[0])); |
|
299 |
+ |
|
140 | 300 |
return s; |
141 | 301 |
} |
142 | 302 |
|
8 | 9 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,340 @@ |
0 |
+ GNU GENERAL PUBLIC LICENSE |
|
1 |
+ Version 2, June 1991 |
|
2 |
+ |
|
3 |
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
|
4 |
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
5 |
+ Everyone is permitted to copy and distribute verbatim copies |
|
6 |
+ of this license document, but changing it is not allowed. |
|
7 |
+ |
|
8 |
+ Preamble |
|
9 |
+ |
|
10 |
+ The licenses for most software are designed to take away your |
|
11 |
+freedom to share and change it. By contrast, the GNU General Public |
|
12 |
+License is intended to guarantee your freedom to share and change free |
|
13 |
+software--to make sure the software is free for all its users. This |
|
14 |
+General Public License applies to most of the Free Software |
|
15 |
+Foundation's software and to any other program whose authors commit to |
|
16 |
+using it. (Some other Free Software Foundation software is covered by |
|
17 |
+the GNU Library General Public License instead.) You can apply it to |
|
18 |
+your programs, too. |
|
19 |
+ |
|
20 |
+ When we speak of free software, we are referring to freedom, not |
|
21 |
+price. Our General Public Licenses are designed to make sure that you |
|
22 |
+have the freedom to distribute copies of free software (and charge for |
|
23 |
+this service if you wish), that you receive source code or can get it |
|
24 |
+if you want it, that you can change the software or use pieces of it |
|
25 |
+in new free programs; and that you know you can do these things. |
|
26 |
+ |
|
27 |
+ To protect your rights, we need to make restrictions that forbid |
|
28 |
+anyone to deny you these rights or to ask you to surrender the rights. |
|
29 |
+These restrictions translate to certain responsibilities for you if you |
|
30 |
+distribute copies of the software, or if you modify it. |
|
31 |
+ |
|
32 |
+ For example, if you distribute copies of such a program, whether |
|
33 |
+gratis or for a fee, you must give the recipients all the rights that |
|
34 |
+you have. You must make sure that they, too, receive or can get the |
|
35 |
+source code. And you must show them these terms so they know their |
|
36 |
+rights. |
|
37 |
+ |
|
38 |
+ We protect your rights with two steps: (1) copyright the software, and |
|
39 |
+(2) offer you this license which gives you legal permission to copy, |
|
40 |
+distribute and/or modify the software. |
|
41 |
+ |
|
42 |
+ Also, for each author's protection and ours, we want to make certain |
|
43 |
+that everyone understands that there is no warranty for this free |
|
44 |
+software. If the software is modified by someone else and passed on, we |
|
45 |
+want its recipients to know that what they have is not the original, so |
|
46 |
+that any problems introduced by others will not reflect on the original |
|
47 |
+authors' reputations. |
|
48 |
+ |
|
49 |
+ Finally, any free program is threatened constantly by software |
|
50 |
+patents. We wish to avoid the danger that redistributors of a free |
|
51 |
+program will individually obtain patent licenses, in effect making the |
|
52 |
+program proprietary. To prevent this, we have made it clear that any |
|
53 |
+patent must be licensed for everyone's free use or not licensed at all. |
|
54 |
+ |
|
55 |
+ The precise terms and conditions for copying, distribution and |
|
56 |
+modification follow. |
|
57 |
+ |
|
58 |
+ GNU GENERAL PUBLIC LICENSE |
|
59 |
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
|
60 |
+ |
|
61 |
+ 0. This License applies to any program or other work which contains |
|
62 |
+a notice placed by the copyright holder saying it may be distributed |
|
63 |
+under the terms of this General Public License. The "Program", below, |
|
64 |
+refers to any such program or work, and a "work based on the Program" |
|
65 |
+means either the Program or any derivative work under copyright law: |
|
66 |
+that is to say, a work containing the Program or a portion of it, |
|
67 |
+either verbatim or with modifications and/or translated into another |
|
68 |
+language. (Hereinafter, translation is included without limitation in |
|
69 |
+the term "modification".) Each licensee is addressed as "you". |
|
70 |
+ |
|
71 |
+Activities other than copying, distribution and modification are not |
|
72 |
+covered by this License; they are outside its scope. The act of |
|
73 |
+running the Program is not restricted, and the output from the Program |
|
74 |
+is covered only if its contents constitute a work based on the |
|
75 |
+Program (independent of having been made by running the Program). |
|
76 |
+Whether that is true depends on what the Program does. |
|
77 |
+ |
|
78 |
+ 1. You may copy and distribute verbatim copies of the Program's |
|
79 |
+source code as you receive it, in any medium, provided that you |
|
80 |
+conspicuously and appropriately publish on each copy an appropriate |
|
81 |
+copyright notice and disclaimer of warranty; keep intact all the |
|
82 |
+notices that refer to this License and to the absence of any warranty; |
|
83 |
+and give any other recipients of the Program a copy of this License |
|
84 |
+along with the Program. |
|
85 |
+ |
|
86 |
+You may charge a fee for the physical act of transferring a copy, and |
|
87 |
+you may at your option offer warranty protection in exchange for a fee. |
|
88 |
+ |
|
89 |
+ 2. You may modify your copy or copies of the Program or any portion |
|
90 |
+of it, thus forming a work based on the Program, and copy and |
|
91 |
+distribute such modifications or work under the terms of Section 1 |
|
92 |
+above, provided that you also meet all of these conditions: |
|
93 |
+ |
|
94 |
+ a) You must cause the modified files to carry prominent notices |
|
95 |
+ stating that you changed the files and the date of any change. |
|
96 |
+ |
|
97 |
+ b) You must cause any work that you distribute or publish, that in |
|
98 |
+ whole or in part contains or is derived from the Program or any |
|
99 |
+ part thereof, to be licensed as a whole at no charge to all third |
|
100 |
+ parties under the terms of this License. |
|
101 |
+ |
|
102 |
+ c) If the modified program normally reads commands interactively |
|
103 |
+ when run, you must cause it, when started running for such |
|
104 |
+ interactive use in the most ordinary way, to print or display an |
|
105 |
+ announcement including an appropriate copyright notice and a |
|
106 |
+ notice that there is no warranty (or else, saying that you provide |
|
107 |
+ a warranty) and that users may redistribute the program under |
|
108 |
+ these conditions, and telling the user how to view a copy of this |
|
109 |
+ License. (Exception: if the Program itself is interactive but |
|
110 |
+ does not normally print such an announcement, your work based on |
|
111 |
+ the Program is not required to print an announcement.) |
|
112 |
+ |
|
113 |
+These requirements apply to the modified work as a whole. If |
|
114 |
+identifiable sections of that work are not derived from the Program, |
|
115 |
+and can be reasonably considered independent and separate works in |
|
116 |
+themselves, then this License, and its terms, do not apply to those |
|
117 |
+sections when you distribute them as separate works. But when you |
|
118 |
+distribute the same sections as part of a whole which is a work based |
|
119 |
+on the Program, the distribution of the whole must be on the terms of |
|
120 |
+this License, whose permissions for other licensees extend to the |
|
121 |
+entire whole, and thus to each and every part regardless of who wrote it. |
|
122 |
+ |
|
123 |
+Thus, it is not the intent of this section to claim rights or contest |
|
124 |
+your rights to work written entirely by you; rather, the intent is to |
|
125 |
+exercise the right to control the distribution of derivative or |
|
126 |
+collective works based on the Program. |
|
127 |
+ |
|
128 |
+In addition, mere aggregation of another work not based on the Program |
|
129 |
+with the Program (or with a work based on the Program) on a volume of |
|
130 |
+a storage or distribution medium does not bring the other work under |
|
131 |
+the scope of this License. |
|
132 |
+ |
|
133 |
+ 3. You may copy and distribute the Program (or a work based on it, |
|
134 |
+under Section 2) in object code or executable form under the terms of |
|
135 |
+Sections 1 and 2 above provided that you also do one of the following: |
|
136 |
+ |
|
137 |
+ a) Accompany it with the complete corresponding machine-readable |
|
138 |
+ source code, which must be distributed under the terms of Sections |
|
139 |
+ 1 and 2 above on a medium customarily used for software interchange; or, |
|
140 |
+ |
|
141 |
+ b) Accompany it with a written offer, valid for at least three |
|
142 |
+ years, to give any third party, for a charge no more than your |
|
143 |
+ cost of physically performing source distribution, a complete |
|
144 |
+ machine-readable copy of the corresponding source code, to be |
|
145 |
+ distributed under the terms of Sections 1 and 2 above on a medium |
|
146 |
+ customarily used for software interchange; or, |
|
147 |
+ |
|
148 |
+ c) Accompany it with the information you received as to the offer |
|
149 |
+ to distribute corresponding source code. (This alternative is |
|
150 |
+ allowed only for noncommercial distribution and only if you |
|
151 |
+ received the program in object code or executable form with such |
|
152 |
+ an offer, in accord with Subsection b above.) |
|
153 |
+ |
|
154 |
+The source code for a work means the preferred form of the work for |
|
155 |
+making modifications to it. For an executable work, complete source |
|
156 |
+code means all the source code for all modules it contains, plus any |
|
157 |
+associated interface definition files, plus the scripts used to |
|
158 |
+control compilation and installation of the executable. However, as a |
|
159 |
+special exception, the source code distributed need not include |
|
160 |
+anything that is normally distributed (in either source or binary |
|
161 |
+form) with the major components (compiler, kernel, and so on) of the |
|
162 |
+operating system on which the executable runs, unless that component |
|
163 |
+itself accompanies the executable. |
|
164 |
+ |
|
165 |
+If distribution of executable or object code is made by offering |
|
166 |
+access to copy from a designated place, then offering equivalent |
|
167 |
+access to copy the source code from the same place counts as |
|
168 |
+distribution of the source code, even though third parties are not |
|
169 |
+compelled to copy the source along with the object code. |
|
170 |
+ |
|
171 |
+ 4. You may not copy, modify, sublicense, or distribute the Program |
|
172 |
+except as expressly provided under this License. Any attempt |
|
173 |
+otherwise to copy, modify, sublicense or distribute the Program is |
|
174 |
+void, and will automatically terminate your rights under this License. |
|
175 |
+However, parties who have received copies, or rights, from you under |
|
176 |
+this License will not have their licenses terminated so long as such |
|
177 |
+parties remain in full compliance. |
|
178 |
+ |
|
179 |
+ 5. You are not required to accept this License, since you have not |
|
180 |
+signed it. However, nothing else grants you permission to modify or |
|
181 |
+distribute the Program or its derivative works. These actions are |
|
182 |
+prohibited by law if you do not accept this License. Therefore, by |
|
183 |
+modifying or distributing the Program (or any work based on the |
|
184 |
+Program), you indicate your acceptance of this License to do so, and |
|
185 |
+all its terms and conditions for copying, distributing or modifying |
|
186 |
+the Program or works based on it. |
|
187 |
+ |
|
188 |
+ 6. Each time you redistribute the Program (or any work based on the |
|
189 |
+Program), the recipient automatically receives a license from the |
|
190 |
+original licensor to copy, distribute or modify the Program subject to |
|
191 |
+these terms and conditions. You may not impose any further |
|
192 |
+restrictions on the recipients' exercise of the rights granted herein. |
|
193 |
+You are not responsible for enforcing compliance by third parties to |
|
194 |
+this License. |
|
195 |
+ |
|
196 |
+ 7. If, as a consequence of a court judgment or allegation of patent |
|
197 |
+infringement or for any other reason (not limited to patent issues), |
|
198 |
+conditions are imposed on you (whether by court order, agreement or |
|
199 |
+otherwise) that contradict the conditions of this License, they do not |
|
200 |
+excuse you from the conditions of this License. If you cannot |
|
201 |
+distribute so as to satisfy simultaneously your obligations under this |
|
202 |
+License and any other pertinent obligations, then as a consequence you |
|
203 |
+may not distribute the Program at all. For example, if a patent |
|
204 |
+license would not permit royalty-free redistribution of the Program by |
|
205 |
+all those who receive copies directly or indirectly through you, then |
|
206 |
+the only way you could satisfy both it and this License would be to |
|
207 |
+refrain entirely from distribution of the Program. |
|
208 |
+ |
|
209 |
+If any portion of this section is held invalid or unenforceable under |
|
210 |
+any particular circumstance, the balance of the section is intended to |
|
211 |
+apply and the section as a whole is intended to apply in other |
|
212 |
+circumstances. |
|
213 |
+ |
|
214 |
+It is not the purpose of this section to induce you to infringe any |
|
215 |
+patents or other property right claims or to contest validity of any |
|
216 |
+such claims; this section has the sole purpose of protecting the |
|
217 |
+integrity of the free software distribution system, which is |
|
218 |
+implemented by public license practices. Many people have made |
|
219 |
+generous contributions to the wide range of software distributed |
|
220 |
+through that system in reliance on consistent application of that |
|
221 |
+system; it is up to the author/donor to decide if he or she is willing |
|
222 |
+to distribute software through any other system and a licensee cannot |
|
223 |
+impose that choice. |
|
224 |
+ |
|
225 |
+This section is intended to make thoroughly clear what is believed to |
|
226 |
+be a consequence of the rest of this License. |
|
227 |
+ |
|
228 |
+ 8. If the distribution and/or use of the Program is restricted in |
|
229 |
+certain countries either by patents or by copyrighted interfaces, the |
|
230 |
+original copyright holder who places the Program under this License |
|
231 |
+may add an explicit geographical distribution limitation excluding |
|
232 |
+those countries, so that distribution is permitted only in or among |
|
233 |
+countries not thus excluded. In such case, this License incorporates |
|
234 |
+the limitation as if written in the body of this License. |
|
235 |
+ |
|
236 |
+ 9. The Free Software Foundation may publish revised and/or new versions |
|
237 |
+of the General Public License from time to time. Such new versions will |
|
238 |
+be similar in spirit to the present version, but may differ in detail to |
|
239 |
+address new problems or concerns. |
|
240 |
+ |
|
241 |
+Each version is given a distinguishing version number. If the Program |
|
242 |
+specifies a version number of this License which applies to it and "any |
|
243 |
+later version", you have the option of following the terms and conditions |
|
244 |
+either of that version or of any later version published by the Free |
|
245 |
+Software Foundation. If the Program does not specify a version number of |
|
246 |
+this License, you may choose any version ever published by the Free Software |
|
247 |
+Foundation. |
|
248 |
+ |
|
249 |
+ 10. If you wish to incorporate parts of the Program into other free |
|
250 |
+programs whose distribution conditions are different, write to the author |
|
251 |
+to ask for permission. For software which is copyrighted by the Free |
|
252 |
+Software Foundation, write to the Free Software Foundation; we sometimes |
|
253 |
+make exceptions for this. Our decision will be guided by the two goals |
|
254 |
+of preserving the free status of all derivatives of our free software and |
|
255 |
+of promoting the sharing and reuse of software generally. |
|
256 |
+ |
|
257 |
+ NO WARRANTY |
|
258 |
+ |
|
259 |
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
|
260 |
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
|
261 |
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
|
262 |
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
|
263 |
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
264 |
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
|
265 |
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
|
266 |
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
|
267 |
+REPAIR OR CORRECTION. |
|
268 |
+ |
|
269 |
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|
270 |
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
|
271 |
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
|
272 |
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
|
273 |
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
|
274 |
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
|
275 |
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
|
276 |
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
|
277 |
+POSSIBILITY OF SUCH DAMAGES. |
|
278 |
+ |
|
279 |
+ END OF TERMS AND CONDITIONS |
|
280 |
+ |
|
281 |
+ How to Apply These Terms to Your New Programs |
|
282 |
+ |
|
283 |
+ If you develop a new program, and you want it to be of the greatest |
|
284 |
+possible use to the public, the best way to achieve this is to make it |
|
285 |
+free software which everyone can redistribute and change under these terms. |
|
286 |
+ |
|
287 |
+ To do so, attach the following notices to the program. It is safest |
|
288 |
+to attach them to the start of each source file to most effectively |
|
289 |
+convey the exclusion of warranty; and each file should have at least |
|
290 |
+the "copyright" line and a pointer to where the full notice is found. |
|
291 |
+ |
|
292 |
+ <one line to give the program's name and a brief idea of what it does.> |
|
293 |
+ Copyright (C) <year> <name of author> |
|
294 |
+ |
|
295 |
+ This program is free software; you can redistribute it and/or modify |
|
296 |
+ it under the terms of the GNU General Public License as published by |
|
297 |
+ the Free Software Foundation; either version 2 of the License, or |
|
298 |
+ (at your option) any later version. |
|
299 |
+ |
|
300 |
+ This program is distributed in the hope that it will be useful, |
|
301 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
302 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
303 |
+ GNU General Public License for more details. |
|
304 |
+ |
|
305 |
+ You should have received a copy of the GNU General Public License |
|
306 |
+ along with this program; if not, write to the Free Software |
|
307 |
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
308 |
+ |
|
309 |
+ |
|
310 |
+Also add information on how to contact you by electronic and paper mail. |
|
311 |
+ |
|
312 |
+If the program is interactive, make it output a short notice like this |
|
313 |
+when it starts in an interactive mode: |
|
314 |
+ |
|
315 |
+ Gnomovision version 69, Copyright (C) year name of author |
|
316 |
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|
317 |
+ This is free software, and you are welcome to redistribute it |
|
318 |
+ under certain conditions; type `show c' for details. |
|
319 |
+ |
|
320 |
+The hypothetical commands `show w' and `show c' should show the appropriate |
|
321 |
+parts of the General Public License. Of course, the commands you use may |
|
322 |
+be called something other than `show w' and `show c'; they could even be |
|
323 |
+mouse-clicks or menu items--whatever suits your program. |
|
324 |
+ |
|
325 |
+You should also get your employer (if you work as a programmer) or your |
|
326 |
+school, if any, to sign a "copyright disclaimer" for the program, if |
|
327 |
+necessary. Here is a sample; alter the names: |
|
328 |
+ |
|
329 |
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
|
330 |
+ `Gnomovision' (which makes passes at compilers) written by James Hacker. |
|
331 |
+ |
|
332 |
+ <signature of Ty Coon>, 1 April 1989 |
|
333 |
+ Ty Coon, President of Vice |
|
334 |
+ |
|
335 |
+This General Public License does not permit incorporating your program into |
|
336 |
+proprietary programs. If your program is a subroutine library, you may |
|
337 |
+consider it more useful to permit linking proprietary applications with the |
|
338 |
+library. If this is what you want to do, use the GNU Library General |
|
339 |
+Public License instead of this License. |
0 | 340 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,202 @@ |
0 |
+H:key.com |
|
1 |
+H:keybank.com |
|
2 |
+H:lloydstsb.co.uk |
|
3 |
+H:maybank2u.com.my |
|
4 |
+H:nafcu.org |
|
5 |
+H:nationwide.co.uk |
|
6 |
+H:servis24.cz |
|
7 |
+H:societegenerale.fr |
|
8 |
+H:southtrust.com |
|
9 |
+H:postfinance.ch |
|
10 |
+H:royalbank.com |
|
11 |
+H:natwest.com |
|
12 |
+H:nbd.ae |
|
13 |
+H:nbd.com |
|
14 |
+H:cic.fr |
|
15 |
+H:comfedbank.com |
|
16 |
+H:commbank.com |
|
17 |
+H:ba-ca.com |
|
18 |
+H:bancaroma.it |
|
19 |
+H:bankofamerica.com |
|
20 |
+H:bankofcastile.com |
|
21 |
+H:bankofscotlandhalifax-online.co.uk |
|
22 |
+H:bankofscotlandhalifax.co.uk |
|
23 |
+H:bankofthewest.com |
|
24 |
+H:barclays.co.uk |
|
25 |
+H:bluemountain.com |
|
26 |
+H:bnpparibas.com |
|
27 |
+H:cahoot.com |
|
28 |
+H:ccbg.com |
|
29 |
+H:ccf.fr |
|
30 |
+H:chase.com |
|
31 |
+H:365online.com |
|
32 |
+H:commerzbank.de |
|
33 |
+H:desjardins.com |
|
34 |
+H:deutsche-bank.de |
|
35 |
+H:e-gold.com |
|
36 |
+H:netbanking.at |
|
37 |
+H:olb2.nationet.com |
|
38 |
+H:paypal.com |
|
39 |
+H:postbank.de |
|
40 |
+H:commbank.com.au |
|
41 |
+H:sparkasse.de |
|
42 |
+H:spk-luebeck.de |
|
43 |
+H:suntrust.com |
|
44 |
+H:usbank.com |
|
45 |
+H:visa.com |
|
46 |
+H:volksbank.de |
|
47 |
+H:wachovia.com |
|
48 |
+H:wamu.com |
|
49 |
+H:wellsfargo.com |
|
50 |
+H:amazon.de |
|
51 |
+H:ebay.de |
|
52 |
+H:egg.com |
|
53 |
+H:etrade.com |
|
54 |
+H:halifax-online.co.uk |
|
55 |
+H:halifax.co.uk |
|
56 |
+H:hsbc.co.uk |
|
57 |
+H:hsbc.fr |
|
58 |
+H:hypovereinsbank.de |
|
59 |
+H:searscard.com |
|
60 |
+H:capitalone.com |
|
61 |
+H:hawaiiusafcu.com |
|
62 |
+H:oibank.com |
|
63 |
+H:smile.co.uk |
|
64 |
+H:sears.com |
|
65 |
+H:moneybookers.com |
|
66 |
+H:cuwestathome.org |
|
67 |
+H:kctcu.org |
|
68 |
+H:bankwithheritage.com |
|
69 |
+H:virginmoney.com |
|
70 |
+H:elevationscu.com |
|
71 |
+H:abbeynational.co.uk |
|
72 |
+H:huntington.com |
|
73 |
+H:coop-bank.com |
|
74 |
+H:lasallebank.com |
|
75 |
+H:coop-bankonline.com |
|
76 |
+H:bankatunited.com |
|
77 |
+H:nwolb.com |
|
78 |
+H:www.stgeorge.com.au |
|
79 |
+H:mbna.co.uk |
|
80 |
+H:citizensbankonline.com |
|
81 |
+H:regions.com |
|
82 |
+H:citibank.de |
|
83 |
+H:lloydstsb.com |
|
84 |
+H:stgeorge.com.au |
|
85 |
+H:citibank.com |
|
86 |
+H:bankofscotland.co.uk |
|
87 |
+H:bancafideuram.it |
|
88 |
+H:national.com.au |
|
89 |
+H:banesto.es |
|
90 |
+H:erstebank.hu |
|
91 |
+H:anz.com |
|
92 |
+H:woolwich.co.uk |
|
93 |
+H:mandtbank.com |
|
94 |
+H:raiffeisen.hu |
|
95 |
+H:cacu.com |
|
96 |
+H:morganstanleycard.co.uk |
|
97 |
+H:gruposantander.es |
|
98 |
+H:bendigobank.com.au |
|
99 |
+H:westpac.com.au |
|
100 |
+H:regionsnet.com |
|
101 |
+H:posteitaliane.it |
|
102 |
+H:postei.it |
|
103 |
+H:rbsdigital.com |
|
104 |
+H:aib.ie |
|
105 |
+H:tcunet.com |
|
106 |
+H:nationalcity.com |
|
107 |
+H:ebay.com:14- |
|
108 |
+H:ebay.com.au:14- |
|
109 |
+H:amazon.com:14- |
|
110 |
+H:ebay.co.uk:14- |
|
111 |
+H:tcfexpress.com |
|
112 |
+H:standardbank.co.za |
|
113 |
+H:anz.com.au |
|
114 |
+H:nordea.se |
|
115 |
+H:bancosantander.es |
|
116 |
+H:nbg.gr |
|
117 |
+H:westernunion.gr |
|
118 |
+H:westernunion.de |
|
119 |
+H:westernunion.fr |
|
120 |
+H:westernunion.es |
|
121 |
+H:westernunion.it |
|
122 |
+H:wachoviabank.com |
|
123 |
+H:arizonafederal.org |
|
124 |
+H:azfcu.org |
|
125 |
+H:bancaintesa.it |
|
126 |
+H:harrisbank.com |
|
127 |
+H:wbsavings.com |
|
128 |
+H:akbank.com |
|
129 |
+H:akbank.com.tr |
|
130 |
+H:midamericabank.com |
|
131 |
+H:cathaybank.com |
|
132 |
+H:co-operativebank.co.uk |
|
133 |
+H:centralbank.net |
|
134 |
+H:secure.skype.com |
|
135 |
+H:rasbank.it |
|
136 |
+H:tdcanadatrust.com |
|
137 |
+H:downeysavings.com |
|
138 |
+H:rbc.com |
|
139 |
+H:ncua.gov |
|
140 |
+H:bancadiroma.it |
|
141 |
+H:sella.it |
|
142 |
+H:banamex.com |
|
143 |
+H:paylinks.cunet.org |
|
144 |
+H:hvb.de |
|
145 |
+H:cscu.cyberbranch.com |
|
146 |
+H:mybusinessbank.co.uk |
|
147 |
+H:poste.it |
|
148 |
+H:westernunion.co.uk |
|
149 |
+H:chasefrauddetector.com |
|
150 |
+H:ybonline.co.uk |
|
151 |
+H:cscu.org |
|
152 |
+H:flagstar.com |
|
153 |
+H:irs.gov |
|
154 |
+H:co-operative.co.uk |
|
155 |
+H:abbey.co.uk |
|
156 |
+H:natwest.co.uk |
|
157 |
+H:capital1.com |
|
158 |
+H:monster.com |
|
159 |
+H:alliance-leicester.co.uk |
|
160 |
+H:gtefcu.org |
|
161 |
+H:lloydstsbbusiness.com |
|
162 |
+H:citizensbankmoneymanagergps.com |
|
163 |
+H:commercebank.com |
|
164 |
+H:ibanking-services.com |
|
165 |
+H:new.egg.com |
|
166 |
+H:firstmeritib.com |
|
167 |
+H:vr-networld.de |
|
168 |
+H:53.com |
|
169 |
+H:hsbc.com |
|
170 |
+H:bancodisicilia.it |
|
171 |
+H:if.com |
|
172 |
+H:abbey.com |
|
173 |
+H:soopercu.org |
|
174 |
+H:halifaxlegalsolutions.co.uk |
|
175 |
+H:hdfcbank.com |
|
176 |
+H:argonnecu.org |
|
177 |
+H:comerica.com |
|
178 |
+H:cajamadrid.es |
|
179 |
+H:anbtx.com |
|
180 |
+H:anbtx.net |
|
181 |
+H:scotiabank.com |
|
182 |
+H:cahoot.co.uk |
|
183 |
+H:postfinance.info |
|
184 |
+H:ibercaja.es |
|
185 |
+H:gesa.com |
|
186 |
+H:susquehanna.net |
|
187 |
+H:sterlingbank.com |
|
188 |
+H:ing-diba.de |
|
189 |
+H:tcfbank.com |
|
190 |
+H:rbs.com |
|
191 |
+H:rbs.de |
|
192 |
+H:cartasi.it |
|
193 |
+H:rbcroyalbank.com |
|
194 |
+H:csas.cz |
|
195 |
+H:adwords.google.com |
|
196 |
+H:centrum24.pl |
|
197 |
+H:uboc.com |
|
198 |
+H:fideuramonline.it |
|
199 |
+H:bnl.it |
|
200 |
+H:mybdo.com |
|
201 |
+H:metrobankdirect.com |
0 | 202 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
0 |
+M:poste.it:posteitaliane.it |
|
1 |
+M:news.apple.co.jp:images.apple.com |
|
2 |
+M:l.usbank-email.com:usbank.com |
|
3 |
+M:mail.ebay.at:dm.ebay.de |
|
4 |
+M:email.etradefinancial.com:etrade.com |
|
5 |
+X:.+\.commerzbank.com([/?].*)?:.+\.commerzbank.de:17- |
|
6 |
+X:.+\.hvb\.de([/?].*)?:.+\.hypovereinsbank\.de:17- |
|
7 |
+M:email.chase.com:www.chasefrauddetector.com |
|
8 |
+M:info.searscard.com:sears.com |
|
9 |
+X:htt[p].//email.\.paypal\.com([/?].*)?:https.//www\.paypal\.com([/?].*):17- |
|
10 |
+X:.+\.amazon\.(at|ca|co\.uk|co\.jp|de|fr)([/?].*)?:.+\.amazon\.com([/?].*)?:17- |
|
11 |
+X:htt[p].//info\.citibank\.com([/?].*)?:https.//offer\.citibank\.com([/?].*)?:17- |
|
12 |
+X:.+\.ebay\.com([/?].*)?:gotoebay\.co\.uk([/?].*)?:17- |
|
13 |
+X:.+\.usbank-email\.com([/?].*)?:.+\.usbank\.com([/?].*)?:17- |
|
14 |
+X:.+\.ebay\.(ca|com)([/?].*)?:ebay\.caorebay\.com([/?].*)?:17- |
|
15 |
+M:www.postfinance.info:www.postfinance.ch |
|
16 |
+X:.+\.paypal\.(de|fr|it)([/?].*)?:.+\.paypal\.com([/?].*)?:17- |
|
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- |
|
18 |
+X:.+\.ebayrtm\.com([/?].*)?:.+\.ebay\.(de|com|co\.uk)([/?].*)?:17- |
|
19 |
+X:.+\.ebaymotors\.com([/?].*)?:.+\.ebay\.com([/?].*)?:17- |
|
20 |
+X:.+adfarm\.mediaplex\.com([/?].*)?:.+\.ebay\.com([/?].*)?:17- |
|
21 |
+X:.+\.etradefinancial\.com([/?].*)?:(.+\.)?etrade\.com([/?].*)?:17- |
|
22 |
+M:www.deliverymail.com:media.monster.com |
|
23 |
+X:.+\.ebay\.com([/?].*)?:.+ebay\.co\.uk([/?].*)?:17- |
|
24 |
+X:.+:.+images\.amazon\.com([/?].*)?:17- |
|
25 |
+X:.+:.+images-eu\.amazon\.com([/?].*)?:17- |
|
26 |
+X:.+:.+rcm\.amazon\.com([/?].*)?:17- |
|
27 |
+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- |
|
28 |
+M:www.paypal.com%a0:www.paypal.com |
|
29 |
+M:www.monster.fr:media.monster.com |
|
30 |
+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- |
0 | 7 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,28 @@ |
0 |
+#!/bin/sh |
|
1 |
+VALGRIND=`which ${VALGRIND-valgrind}` |
|
2 |
+VALGRIND_FLAGS="--trace-children=yes --track-fds=yes --leak-check=full --show-reachable=yes --suppressions=$srcdir/valgrind.supp" |
|
3 |
+test -n "$VALGRIND" || { echo "*** valgrind not found, skipping test"; exit 77; } |
|
4 |
+test -x "$VALGRIND" || { echo "*** valgrind not executable, skipping test"; exit 77; } |
|
5 |
+ |
|
6 |
+echo "Running valgrind" |
|
7 |
+CK_FORK=no ../libtool --mode=execute $VALGRIND $VALGRIND_FLAGS ./check_clamav 2>&1 | cat >valgrind.log |
|
8 |
+if test $? -eq 0; then |
|
9 |
+ if grep "no leaks are possible" valgrind.log >/dev/null; then |
|
10 |
+ echo "Valgrind tests successful" |
|
11 |
+ exit 0; |
|
12 |
+ fi |
|
13 |
+ echo "*** Valgrind test FAILED, memory LEAKS detected ***" |
|
14 |
+else |
|
15 |
+ echo "*** Valgrind test FAILED, memory ERRORS detected ****" |
|
16 |
+fi |
|
17 |
+echo |
|
18 |
+grep "ERROR SUMMARY" valgrind.log |
|
19 |
+echo `grep "Invalid read" valgrind.log| wc -l` "invalid reads" |
|
20 |
+echo `grep "Invalid write" valgrind.log| wc -l` "invalid writes" |
|
21 |
+echo `grep "Invalid free" valgrind.log| wc -l` "invalid frees" |
|
22 |
+echo `grep "uninitialized value" valgrind.log|wc -l` "uses of uninitialized values" |
|
23 |
+grep " lost:" valgrind.log |
|
24 |
+grep "still reachable:" valgrind.log |
|
25 |
+grep "FILE DESCRIPTORS" valgrind.log |
|
26 |
+echo |
|
27 |
+exit 1; |