Browse code

apply patches for the anti-phish code from Edwin

git-svn: trunk@2371

Tomasz Kojm authored on 2006/10/11 08:51:49
Showing 22 changed files
... ...
@@ -1,3 +1,21 @@
1
+Wed Oct 11 01:05:37 CEST 2006 (tk)
2
+----------------------------------
3
+  * libclamav: apply patches for the anti-phish code from Edwin:
4
+    - use different signature types for .pdb and .wdb: 'R' for .pdb (regex
5
+      matching real+displayed URL), 'X' for .wdb (the same as 'R'), 'H' for
6
+      .wdb (matches displayed host), 'M' for .wdb (matches real+displayed host
7
+      with a simple pattern)
8
+    - new signature type 'M' for .wdb (matches real+displayed host with a
9
+      simple pattern)
10
+    - libclamav/regex_list.c: fix incorrect OP_CUSTOMCLASS handling in
11
+      char_insert
12
+    - use pre-generated tables, instead of runtime setup_matcher_engine/_done
13
+      and init_hextable
14
+    - contrib/phishing/test*: add auto-tests for character classes and escaped
15
+      characters
16
+    - add phishcheck struct to cl_engine
17
+    - other cleanups
18
+
1 19
 Tue Oct 10 00:13:59 CEST 2006 (tk)
2 20
 ----------------------------------
3 21
   * shared/cfgparser.c: use OPT_QUOTESTR instead of OPT_STR in all cases
... ...
@@ -1,12 +1,11 @@
1 1
 MAINTAINERCLEANFILES= Makefile.in aclocal.m4 configure config.h.in config.guess config.sub install-sh ltconfig lt-main.sh mdate-sh missing mkinstalldirs  
2 2
 CLEANFILES=phishtest_output.xml
3
-clam_builddir=clam
4
-noinst_SUBDIRS=$(clam_builddir)
3
+clam_builddir=../../../
5 4
 TESTS=check_phishing
6 5
 noinst_PROGRAMS=check_phishing 
7
-
6
+SUBDIRS=$(clam_builddir)
8 7
 EXTRA_DIST=regex_test.txt autogen.sh 
9
-check_phishing_SOURCES= urltest.c urltest.h regex_list_test.c regex_list_test.h runner.c pdomain.c pdomain.h
8
+check_phishing_SOURCES= urltest.c urltest.h regex_list_test.c regex_list_test.h runner.c pdomain.h pdomain.c 
10 9
 check_phishing_INCLUDES= @CHECK_CFLAGS@
11 10
 check_phishing_LDADD= @CHECK_LIBS@ $(clam_builddir)/libclamav/libclamav.la
12 11
 INCLUDES= -I$(top_srcdir) -I$(clam_builddir) -I$(clam_builddir)/shared -I$(clam_builddir)/libclamav
... ...
@@ -50,7 +50,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
50 50
  configure.lineno configure.status.lineno
51 51
 mkinstalldirs = $(install_sh) -d
52 52
 CONFIG_HEADER = test-config.h
53
-CONFIG_CLEAN_FILES = clam
53
+CONFIG_CLEAN_FILES =
54 54
 PROGRAMS = $(noinst_PROGRAMS)
55 55
 am_check_phishing_OBJECTS = urltest.$(OBJEXT) \
56 56
 	regex_list_test.$(OBJEXT) runner.$(OBJEXT) pdomain.$(OBJEXT)
... ...
@@ -69,8 +69,15 @@ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
69 69
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
70 70
 SOURCES = $(check_phishing_SOURCES)
71 71
 DIST_SOURCES = $(check_phishing_SOURCES)
72
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
73
+	html-recursive info-recursive install-data-recursive \
74
+	install-exec-recursive install-info-recursive \
75
+	install-recursive installcheck-recursive installdirs-recursive \
76
+	pdf-recursive ps-recursive uninstall-info-recursive \
77
+	uninstall-recursive
72 78
 ETAGS = etags
73 79
 CTAGS = ctags
80
+DIST_SUBDIRS = $(SUBDIRS)
74 81
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
75 82
 distdir = $(PACKAGE)-$(VERSION)
76 83
 top_distdir = $(distdir)
... ...
@@ -183,21 +190,20 @@ program_transform_name = @program_transform_name@
183 183
 psdir = @psdir@
184 184
 sbindir = @sbindir@
185 185
 sharedstatedir = @sharedstatedir@
186
-subdirs = @subdirs@
187 186
 sysconfdir = @sysconfdir@
188 187
 target_alias = @target_alias@
189 188
 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.h.in config.guess config.sub install-sh ltconfig lt-main.sh mdate-sh missing mkinstalldirs  
190 189
 CLEANFILES = phishtest_output.xml
191
-clam_builddir = clam
192
-noinst_SUBDIRS = $(clam_builddir)
190
+clam_builddir = ../../../
193 191
 TESTS = check_phishing
192
+SUBDIRS = $(clam_builddir)
194 193
 EXTRA_DIST = regex_test.txt autogen.sh 
195
-check_phishing_SOURCES = urltest.c urltest.h regex_list_test.c regex_list_test.h runner.c pdomain.c pdomain.h
194
+check_phishing_SOURCES = urltest.c urltest.h regex_list_test.c regex_list_test.h runner.c pdomain.h pdomain.c 
196 195
 check_phishing_INCLUDES = @CHECK_CFLAGS@
197 196
 check_phishing_LDADD = @CHECK_LIBS@ $(clam_builddir)/libclamav/libclamav.la
198 197
 INCLUDES = -I$(top_srcdir) -I$(clam_builddir) -I$(clam_builddir)/shared -I$(clam_builddir)/libclamav
199 198
 all: test-config.h
200
-	$(MAKE) $(AM_MAKEFLAGS) all-am
199
+	$(MAKE) $(AM_MAKEFLAGS) all-recursive
201 200
 
202 201
 .SUFFIXES:
203 202
 .SUFFIXES: .c .lo .o .obj
... ...
@@ -304,6 +310,77 @@ distclean-libtool:
304 304
 	-rm -f libtool
305 305
 uninstall-info-am:
306 306
 
307
+# This directory's subdirectories are mostly independent; you can cd
308
+# into them and run `make' without going through this Makefile.
309
+# To change the values of `make' variables: instead of editing Makefiles,
310
+# (1) if the variable is set in `config.status', edit `config.status'
311
+#     (which will cause the Makefiles to be regenerated when you run `make');
312
+# (2) otherwise, pass the desired values on the `make' command line.
313
+$(RECURSIVE_TARGETS):
314
+	@failcom='exit 1'; \
315
+	for f in x $$MAKEFLAGS; do \
316
+	  case $$f in \
317
+	    *=* | --[!k]*);; \
318
+	    *k*) failcom='fail=yes';; \
319
+	  esac; \
320
+	done; \
321
+	dot_seen=no; \
322
+	target=`echo $@ | sed s/-recursive//`; \
323
+	list='$(SUBDIRS)'; for subdir in $$list; do \
324
+	  echo "Making $$target in $$subdir"; \
325
+	  if test "$$subdir" = "."; then \
326
+	    dot_seen=yes; \
327
+	    local_target="$$target-am"; \
328
+	  else \
329
+	    local_target="$$target"; \
330
+	  fi; \
331
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
332
+	  || eval $$failcom; \
333
+	done; \
334
+	if test "$$dot_seen" = "no"; then \
335
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
336
+	fi; test -z "$$fail"
337
+
338
+mostlyclean-recursive clean-recursive distclean-recursive \
339
+maintainer-clean-recursive:
340
+	@failcom='exit 1'; \
341
+	for f in x $$MAKEFLAGS; do \
342
+	  case $$f in \
343
+	    *=* | --[!k]*);; \
344
+	    *k*) failcom='fail=yes';; \
345
+	  esac; \
346
+	done; \
347
+	dot_seen=no; \
348
+	case "$@" in \
349
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
350
+	  *) list='$(SUBDIRS)' ;; \
351
+	esac; \
352
+	rev=''; for subdir in $$list; do \
353
+	  if test "$$subdir" = "."; then :; else \
354
+	    rev="$$subdir $$rev"; \
355
+	  fi; \
356
+	done; \
357
+	rev="$$rev ."; \
358
+	target=`echo $@ | sed s/-recursive//`; \
359
+	for subdir in $$rev; do \
360
+	  echo "Making $$target in $$subdir"; \
361
+	  if test "$$subdir" = "."; then \
362
+	    local_target="$$target-am"; \
363
+	  else \
364
+	    local_target="$$target"; \
365
+	  fi; \
366
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
367
+	  || eval $$failcom; \
368
+	done && test -z "$$fail"
369
+tags-recursive:
370
+	list='$(SUBDIRS)'; for subdir in $$list; do \
371
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
372
+	done
373
+ctags-recursive:
374
+	list='$(SUBDIRS)'; for subdir in $$list; do \
375
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
376
+	done
377
+
307 378
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
308 379
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
309 380
 	unique=`for i in $$list; do \
... ...
@@ -314,10 +391,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
314 314
 	mkid -fID $$unique
315 315
 tags: TAGS
316 316
 
317
-TAGS:  $(HEADERS) $(SOURCES) test-config.h.in $(TAGS_DEPENDENCIES) \
317
+TAGS: tags-recursive $(HEADERS) $(SOURCES) test-config.h.in $(TAGS_DEPENDENCIES) \
318 318
 		$(TAGS_FILES) $(LISP)
319 319
 	tags=; \
320 320
 	here=`pwd`; \
321
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
322
+	  include_option=--etags-include; \
323
+	  empty_fix=.; \
324
+	else \
325
+	  include_option=--include; \
326
+	  empty_fix=; \
327
+	fi; \
328
+	list='$(SUBDIRS)'; for subdir in $$list; do \
329
+	  if test "$$subdir" = .; then :; else \
330
+	    test ! -f $$subdir/TAGS || \
331
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
332
+	  fi; \
333
+	done; \
321 334
 	list='$(SOURCES) $(HEADERS) test-config.h.in $(LISP) $(TAGS_FILES)'; \
322 335
 	unique=`for i in $$list; do \
323 336
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
... ...
@@ -330,7 +420,7 @@ TAGS:  $(HEADERS) $(SOURCES) test-config.h.in $(TAGS_DEPENDENCIES) \
330 330
 	    $$tags $$unique; \
331 331
 	fi
332 332
 ctags: CTAGS
333
-CTAGS:  $(HEADERS) $(SOURCES) test-config.h.in $(TAGS_DEPENDENCIES) \
333
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) test-config.h.in $(TAGS_DEPENDENCIES) \
334 334
 		$(TAGS_FILES) $(LISP)
335 335
 	tags=; \
336 336
 	here=`pwd`; \
... ...
@@ -454,6 +544,21 @@ distdir: $(DISTFILES)
454 454
 	    || exit 1; \
455 455
 	  fi; \
456 456
 	done
457
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
458
+	  if test "$$subdir" = .; then :; else \
459
+	    test -d "$(distdir)/$$subdir" \
460
+	    || $(mkdir_p) "$(distdir)/$$subdir" \
461
+	    || exit 1; \
462
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
463
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
464
+	    (cd $$subdir && \
465
+	      $(MAKE) $(AM_MAKEFLAGS) \
466
+	        top_distdir="$$top_distdir" \
467
+	        distdir="$$distdir/$$subdir" \
468
+	        distdir) \
469
+	      || exit 1; \
470
+	  fi; \
471
+	done
457 472
 	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
458 473
 	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
459 474
 	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
... ...
@@ -553,18 +658,19 @@ distcleancheck: distclean
553 553
 	       exit 1; } >&2
554 554
 check-am: all-am
555 555
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
556
-check: check-am
556
+check: check-recursive
557 557
 all-am: Makefile $(PROGRAMS) test-config.h
558
-installdirs:
559
-install: install-am
560
-install-exec: install-exec-am
561
-install-data: install-data-am
562
-uninstall: uninstall-am
558
+installdirs: installdirs-recursive
559
+installdirs-am:
560
+install: install-recursive
561
+install-exec: install-exec-recursive
562
+install-data: install-data-recursive
563
+uninstall: uninstall-recursive
563 564
 
564 565
 install-am: all-am
565 566
 	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
566 567
 
567
-installcheck: installcheck-am
568
+installcheck: installcheck-recursive
568 569
 install-strip:
569 570
 	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
570 571
 	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
... ...
@@ -582,25 +688,25 @@ maintainer-clean-generic:
582 582
 	@echo "This command is intended for maintainers to use"
583 583
 	@echo "it deletes files that may require special tools to rebuild."
584 584
 	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
585
-clean: clean-am
585
+clean: clean-recursive
586 586
 
587 587
 clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
588 588
 	mostlyclean-am
589 589
 
590
-distclean: distclean-am
590
+distclean: distclean-recursive
591 591
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
592 592
 	-rm -rf ./$(DEPDIR)
593 593
 	-rm -f Makefile
594 594
 distclean-am: clean-am distclean-compile distclean-generic \
595 595
 	distclean-hdr distclean-libtool distclean-tags
596 596
 
597
-dvi: dvi-am
597
+dvi: dvi-recursive
598 598
 
599 599
 dvi-am:
600 600
 
601
-html: html-am
601
+html: html-recursive
602 602
 
603
-info: info-am
603
+info: info-recursive
604 604
 
605 605
 info-am:
606 606
 
... ...
@@ -608,47 +714,52 @@ install-data-am:
608 608
 
609 609
 install-exec-am:
610 610
 
611
-install-info: install-info-am
611
+install-info: install-info-recursive
612 612
 
613 613
 install-man:
614 614
 
615 615
 installcheck-am:
616 616
 
617
-maintainer-clean: maintainer-clean-am
617
+maintainer-clean: maintainer-clean-recursive
618 618
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
619 619
 	-rm -rf $(top_srcdir)/autom4te.cache
620 620
 	-rm -rf ./$(DEPDIR)
621 621
 	-rm -f Makefile
622 622
 maintainer-clean-am: distclean-am maintainer-clean-generic
623 623
 
624
-mostlyclean: mostlyclean-am
624
+mostlyclean: mostlyclean-recursive
625 625
 
626 626
 mostlyclean-am: mostlyclean-compile mostlyclean-generic \
627 627
 	mostlyclean-libtool
628 628
 
629
-pdf: pdf-am
629
+pdf: pdf-recursive
630 630
 
631 631
 pdf-am:
632 632
 
633
-ps: ps-am
633
+ps: ps-recursive
634 634
 
635 635
 ps-am:
636 636
 
637 637
 uninstall-am: uninstall-info-am
638 638
 
639
-.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
640
-	clean clean-generic clean-libtool clean-noinstPROGRAMS ctags \
639
+uninstall-info: uninstall-info-recursive
640
+
641
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
642
+	check-TESTS check-am clean clean-generic clean-libtool \
643
+	clean-noinstPROGRAMS clean-recursive ctags ctags-recursive \
641 644
 	dist dist-all dist-bzip2 dist-gzip dist-shar dist-tarZ \
642 645
 	dist-zip distcheck distclean distclean-compile \
643 646
 	distclean-generic distclean-hdr distclean-libtool \
644
-	distclean-tags distcleancheck distdir distuninstallcheck dvi \
645
-	dvi-am html html-am info info-am install install-am \
646
-	install-data install-data-am install-exec install-exec-am \
647
-	install-info install-info-am install-man install-strip \
648
-	installcheck installcheck-am installdirs maintainer-clean \
649
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
650
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
651
-	tags uninstall uninstall-am uninstall-info-am
647
+	distclean-recursive distclean-tags distcleancheck distdir \
648
+	distuninstallcheck dvi dvi-am html html-am info info-am \
649
+	install install-am install-data install-data-am install-exec \
650
+	install-exec-am install-info install-info-am install-man \
651
+	install-strip installcheck installcheck-am installdirs \
652
+	installdirs-am maintainer-clean maintainer-clean-generic \
653
+	maintainer-clean-recursive mostlyclean mostlyclean-compile \
654
+	mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
655
+	pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
656
+	uninstall-info-am
652 657
 
653 658
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
654 659
 # Otherwise a system limit (for SysV at least) may be exceeded.
... ...
@@ -147,7 +147,7 @@ int main ()
147 147
 
148 148
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
149 149
 
150
-# serial 48 AC_PROG_LIBTOOL
150
+# serial 48 Debian 1.5.22-4 AC_PROG_LIBTOOL
151 151
 
152 152
 
153 153
 # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
... ...
@@ -353,14 +353,6 @@ AC_ARG_WITH([pic],
353 353
     [pic_mode=default])
354 354
 test -z "$pic_mode" && pic_mode=default
355 355
 
356
-# Check if we have a version mismatch between libtool.m4 and ltmain.sh.
357
-#
358
-# Note:  This should be in AC_LIBTOOL_SETUP, _after_ $ltmain have been defined.
359
-#        We also should do it _before_ AC_LIBTOOL_LANG_C_CONFIG that actually
360
-#        calls AC_LIBTOOL_CONFIG and creates libtool.
361
-#
362
-_LT_VERSION_CHECK
363
-
364 356
 # Use C for the default configuration in the libtool script
365 357
 tagname=
366 358
 AC_LIBTOOL_LANG_C_CONFIG
... ...
@@ -368,41 +360,6 @@ _LT_AC_TAGCONFIG
368 368
 ])# AC_LIBTOOL_SETUP
369 369
 
370 370
 
371
-# _LT_VERSION_CHECK
372
-# -----------------
373
-AC_DEFUN([_LT_VERSION_CHECK],
374
-[AC_MSG_CHECKING([for correct ltmain.sh version])
375
-if test "x$ltmain" = "x" ; then
376
-  AC_MSG_RESULT(no)
377
-  AC_MSG_ERROR([
378
-
379
-*** @<:@Gentoo@:>@ sanity check failed! ***
380
-*** \$ltmain is not defined, please check the patch for consistency! ***
381
-])
382
-fi
383
-gentoo_lt_version="1.5.22"
384
-gentoo_ltmain_version=`sed -n '/^[[ 	]]*VERSION=/{s/^[[ 	]]*VERSION=//;p;q;}' "$ltmain"`
385
-if test "x$gentoo_lt_version" != "x$gentoo_ltmain_version" ; then
386
-  AC_MSG_RESULT(no)
387
-  AC_MSG_ERROR([
388
-
389
-*** @<:@Gentoo@:>@ sanity check failed! ***
390
-*** libtool.m4 and ltmain.sh have a version mismatch! ***
391
-*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
392
-
393
-Please run:
394
-
395
-  libtoolize --copy --force
396
-
397
-if appropriate, please contact the maintainer of this
398
-package (or your distribution) for help.
399
-])
400
-else
401
-  AC_MSG_RESULT(yes)
402
-fi
403
-])# _LT_VERSION_CHECK
404
-
405
-
406 371
 # _LT_AC_SYS_COMPILER
407 372
 # -------------------
408 373
 AC_DEFUN([_LT_AC_SYS_COMPILER],
... ...
@@ -1533,30 +1490,6 @@ cygwin* | mingw* | pw32*)
1533 1533
     esac
1534 1534
     ;;
1535 1535
 
1536
-  linux*)
1537
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
1538
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
1539
-      supports_anon_versioning=no
1540
-      case `$LD -v 2>/dev/null` in
1541
-        *\ [01].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
1542
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
1543
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
1544
-        *\ 2.11.*) ;; # other 2.11 versions
1545
-        *) supports_anon_versioning=yes ;;
1546
-      esac
1547
-      if test $supports_anon_versioning = yes; then
1548
-        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
1549
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
1550
-$echo "local: *; };" >> $output_objdir/$libname.ver~
1551
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
1552
-      else
1553
-        $archive_expsym_cmds="$archive_cmds"
1554
-      fi
1555
-    else
1556
-      ld_shlibs=no
1557
-    fi
1558
-    ;;
1559
-
1560 1536
   *)
1561 1537
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
1562 1538
     ;;
... ...
@@ -1598,18 +1531,6 @@ freebsd1*)
1598 1598
   dynamic_linker=no
1599 1599
   ;;
1600 1600
 
1601
-kfreebsd*-gnu)
1602
-  version_type=linux
1603
-  need_lib_prefix=no
1604
-  need_version=no
1605
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
1606
-  soname_spec='${libname}${release}${shared_ext}$major'
1607
-  shlibpath_var=LD_LIBRARY_PATH
1608
-  shlibpath_overrides_runpath=no
1609
-  hardcode_into_libs=yes
1610
-  dynamic_linker='GNU ld.so'
1611
-  ;;
1612
-
1613 1601
 freebsd* | dragonfly*)
1614 1602
   # DragonFly does not have aout.  When/if they implement a new
1615 1603
   # versioning mechanism, adjust this.
... ...
@@ -1621,14 +1542,7 @@ freebsd* | dragonfly*)
1621 1621
     *) objformat=elf ;;
1622 1622
     esac
1623 1623
   fi
1624
-  # Handle Gentoo/FreeBSD as it was Linux
1625
-  case $host_vendor in
1626
-    gentoo)
1627
-      version_type=linux ;;
1628
-    *)
1629
-      version_type=freebsd-$objformat ;;
1630
-  esac
1631
-
1624
+  version_type=freebsd-$objformat
1632 1625
   case $version_type in
1633 1626
     freebsd-elf*)
1634 1627
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
... ...
@@ -1639,12 +1553,6 @@ freebsd* | dragonfly*)
1639 1639
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
1640 1640
       need_version=yes
1641 1641
       ;;
1642
-    linux)
1643
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
1644
-      soname_spec='${libname}${release}${shared_ext}$major'
1645
-      need_lib_prefix=no
1646
-      need_version=no
1647
-      ;;
1648 1642
   esac
1649 1643
   shlibpath_var=LD_LIBRARY_PATH
1650 1644
   case $host_os in
... ...
@@ -1778,7 +1686,7 @@ linux*oldld* | linux*aout* | linux*coff*)
1778 1778
   ;;
1779 1779
 
1780 1780
 # This must be Linux ELF.
1781
-linux*)
1781
+linux* | k*bsd*-gnu)
1782 1782
   version_type=linux
1783 1783
   need_lib_prefix=no
1784 1784
   need_version=no
... ...
@@ -1807,7 +1715,7 @@ linux*)
1807 1807
   dynamic_linker='GNU/Linux ld.so'
1808 1808
   ;;
1809 1809
 
1810
-knetbsd*-gnu)
1810
+netbsdelf*-gnu)
1811 1811
   version_type=linux
1812 1812
   need_lib_prefix=no
1813 1813
   need_version=no
... ...
@@ -1816,7 +1724,7 @@ knetbsd*-gnu)
1816 1816
   shlibpath_var=LD_LIBRARY_PATH
1817 1817
   shlibpath_overrides_runpath=no
1818 1818
   hardcode_into_libs=yes
1819
-  dynamic_linker='GNU ld.so'
1819
+  dynamic_linker='NetBSD ld.elf_so'
1820 1820
   ;;
1821 1821
 
1822 1822
 netbsd*)
... ...
@@ -2524,7 +2432,7 @@ darwin* | rhapsody*)
2524 2524
   lt_cv_deplibs_check_method=pass_all
2525 2525
   ;;
2526 2526
 
2527
-freebsd* | kfreebsd*-gnu | dragonfly*)
2527
+freebsd* | dragonfly*)
2528 2528
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
2529 2529
     case $host_cpu in
2530 2530
     i*86 )
... ...
@@ -2578,11 +2486,11 @@ irix5* | irix6* | nonstopux*)
2578 2578
   ;;
2579 2579
 
2580 2580
 # This must be Linux ELF.
2581
-linux*)
2581
+linux* | k*bsd*-gnu)
2582 2582
   lt_cv_deplibs_check_method=pass_all
2583 2583
   ;;
2584 2584
 
2585
-netbsd*)
2585
+netbsd* | netbsdelf*-gnu)
2586 2586
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
2587 2587
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
2588 2588
   else
... ...
@@ -3330,7 +3238,7 @@ case $host_os in
3330 3330
   freebsd-elf*)
3331 3331
     _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
3332 3332
     ;;
3333
-  freebsd* | kfreebsd*-gnu | dragonfly*)
3333
+  freebsd* | dragonfly*)
3334 3334
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
3335 3335
     # conventions
3336 3336
     _LT_AC_TAGVAR(ld_shlibs, $1)=yes
... ...
@@ -3489,7 +3397,7 @@ case $host_os in
3489 3489
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
3490 3490
     _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
3491 3491
     ;;
3492
-  linux*)
3492
+  linux* | k*bsd*-gnu)
3493 3493
     case $cc_basename in
3494 3494
       KCC*)
3495 3495
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
... ...
@@ -3591,7 +3499,7 @@ case $host_os in
3591 3591
 	;;
3592 3592
     esac
3593 3593
     ;;
3594
-  netbsd*)
3594
+  netbsd* | netbsdelf*-gnu)
3595 3595
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
3596 3596
       _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
3597 3597
       wlarc=
... ...
@@ -4856,7 +4764,7 @@ hpux*) # Its linker distinguishes data from code symbols
4856 4856
   lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
4857 4857
   lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
4858 4858
   ;;
4859
-linux*)
4859
+linux* | k*bsd*-gnu)
4860 4860
   if test "$host_cpu" = ia64; then
4861 4861
     symcode='[[ABCDGIRSTW]]'
4862 4862
     lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
... ...
@@ -5129,7 +5037,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5129 5129
 	    ;;
5130 5130
 	esac
5131 5131
 	;;
5132
-      freebsd* | kfreebsd*-gnu | dragonfly*)
5132
+      freebsd* | dragonfly*)
5133 5133
 	# FreeBSD uses GNU C++
5134 5134
 	;;
5135 5135
       hpux9* | hpux10* | hpux11*)
... ...
@@ -5172,7 +5080,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5172 5172
 	    ;;
5173 5173
 	esac
5174 5174
 	;;
5175
-      linux*)
5175
+      linux* | k*bsd*-gnu)
5176 5176
 	case $cc_basename in
5177 5177
 	  KCC*)
5178 5178
 	    # KAI C++ Compiler
... ...
@@ -5215,7 +5123,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5215 5215
 	    ;;
5216 5216
 	esac
5217 5217
 	;;
5218
-      netbsd*)
5218
+      netbsd* | netbsdelf*-gnu)
5219 5219
 	;;
5220 5220
       osf3* | osf4* | osf5*)
5221 5221
 	case $cc_basename in
... ...
@@ -5426,7 +5334,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC])
5426 5426
       _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
5427 5427
       ;;
5428 5428
 
5429
-    linux*)
5429
+    linux* | k*bsd*-gnu)
5430 5430
       case $cc_basename in
5431 5431
       icc* | ecc*)
5432 5432
 	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
... ...
@@ -5567,6 +5475,9 @@ ifelse([$1],[CXX],[
5567 5567
   cygwin* | mingw*)
5568 5568
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
5569 5569
   ;;
5570
+  linux* | k*bsd*-gnu)
5571
+    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
5572
+  ;;
5570 5573
   *)
5571 5574
     _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
5572 5575
   ;;
... ...
@@ -5737,7 +5648,7 @@ EOF
5737 5737
       _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
5738 5738
       ;;
5739 5739
 
5740
-    linux*)
5740
+    linux* | k*bsd*-gnu)
5741 5741
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
5742 5742
 	tmp_addflag=
5743 5743
 	case $cc_basename,$host_cpu in
... ...
@@ -5763,12 +5674,13 @@ EOF
5763 5763
   $echo "local: *; };" >> $output_objdir/$libname.ver~
5764 5764
 	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
5765 5765
 	fi
5766
+	_LT_AC_TAGVAR(link_all_deplibs, $1)=no
5766 5767
       else
5767 5768
 	_LT_AC_TAGVAR(ld_shlibs, $1)=no
5768 5769
       fi
5769 5770
       ;;
5770 5771
 
5771
-    netbsd*)
5772
+    netbsd* | netbsdelf*-gnu)
5772 5773
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
5773 5774
 	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
5774 5775
 	wlarc=
... ...
@@ -6098,7 +6010,7 @@ _LT_EOF
6098 6098
       ;;
6099 6099
 
6100 6100
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
6101
-    freebsd* | kfreebsd*-gnu | dragonfly*)
6101
+    freebsd* | dragonfly*)
6102 6102
       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
6103 6103
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
6104 6104
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
... ...
@@ -6200,7 +6112,7 @@ _LT_EOF
6200 6200
       _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
6201 6201
       ;;
6202 6202
 
6203
-    netbsd*)
6203
+    netbsd* | netbsdelf*-gnu)
6204 6204
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
6205 6205
 	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
6206 6206
       else
... ...
@@ -139,23 +139,6 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
139 139
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
140 140
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
141 141
 
142
-if [ "${UNAME_SYSTEM}" = "Linux" ] ; then
143
-	eval $set_cc_for_build
144
-	cat << EOF > $dummy.c
145
-	#include <features.h>
146
-	#ifdef __UCLIBC__
147
-	# ifdef __UCLIBC_CONFIG_VERSION__
148
-	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
149
-	# else
150
-	LIBC=uclibc
151
-	# endif
152
-	#else
153
-	LIBC=gnu
154
-	#endif
155
-EOF
156
-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
157
-fi
158
-
159 142
 # Note: order is significant - the case branches are not exclusive.
160 143
 
161 144
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
... ...
@@ -846,28 +829,28 @@ EOF
846 846
 	echo ${UNAME_MACHINE}-pc-minix
847 847
 	exit ;;
848 848
     arm*:Linux:*:*)
849
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
849
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
850 850
 	exit ;;
851 851
     avr32*:Linux:*:*)
852
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
852
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
853 853
 	exit ;;
854 854
     cris:Linux:*:*)
855
-	echo cris-axis-linux-${LIBC}
855
+	echo cris-axis-linux-gnu
856 856
 	exit ;;
857 857
     crisv32:Linux:*:*)
858
-	echo crisv32-axis-linux-${LIBC}
858
+	echo crisv32-axis-linux-gnu
859 859
 	exit ;;
860 860
     frv:Linux:*:*)
861
-    	echo frv-unknown-linux-${LIBC}
861
+    	echo frv-unknown-linux-gnu
862 862
 	exit ;;
863 863
     ia64:Linux:*:*)
864
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
864
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
865 865
 	exit ;;
866 866
     m32r*:Linux:*:*)
867
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
867
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
868 868
 	exit ;;
869 869
     m68*:Linux:*:*)
870
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
870
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
871 871
 	exit ;;
872 872
     mips:Linux:*:*)
873 873
 	eval $set_cc_for_build
... ...
@@ -890,7 +873,7 @@ EOF
890 890
 		s: ::g
891 891
 		p
892 892
 	    }'`"
893
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
893
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
894 894
 	;;
895 895
     mips64:Linux:*:*)
896 896
 	eval $set_cc_for_build
... ...
@@ -913,16 +896,16 @@ EOF
913 913
 		s: ::g
914 914
 		p
915 915
 	    }'`"
916
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
916
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
917 917
 	;;
918 918
     or32:Linux:*:*)
919
-	echo or32-unknown-linux-${LIBC}
919
+	echo or32-unknown-linux-gnu
920 920
 	exit ;;
921 921
     ppc:Linux:*:*)
922
-	echo powerpc-unknown-linux-${LIBC}
922
+	echo powerpc-unknown-linux-gnu
923 923
 	exit ;;
924 924
     ppc64:Linux:*:*)
925
-	echo powerpc64-unknown-linux-${LIBC}
925
+	echo powerpc64-unknown-linux-gnu
926 926
 	exit ;;
927 927
     alpha:Linux:*:*)
928 928
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
... ...
@@ -935,37 +918,37 @@ EOF
935 935
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
936 936
         esac
937 937
 	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
938
-	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
939
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
938
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
939
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
940 940
 	exit ;;
941 941
     parisc:Linux:*:* | hppa:Linux:*:*)
942 942
 	# Look for CPU level
943 943
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
944
-	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
945
-	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
946
-	  *)    echo hppa-unknown-linux-${LIBC} ;;
944
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
945
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
946
+	  *)    echo hppa-unknown-linux-gnu ;;
947 947
 	esac
948 948
 	exit ;;
949 949
     parisc64:Linux:*:* | hppa64:Linux:*:*)
950
-	echo hppa64-unknown-linux-${LIBC}
950
+	echo hppa64-unknown-linux-gnu
951 951
 	exit ;;
952 952
     s390:Linux:*:* | s390x:Linux:*:*)
953 953
 	echo ${UNAME_MACHINE}-ibm-linux
954 954
 	exit ;;
955 955
     sh64*:Linux:*:*)
956
-    	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
956
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
957 957
 	exit ;;
958 958
     sh*:Linux:*:*)
959
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
959
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
960 960
 	exit ;;
961 961
     sparc:Linux:*:* | sparc64:Linux:*:*)
962
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
962
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
963 963
 	exit ;;
964 964
     vax:Linux:*:*)
965
-	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
965
+	echo ${UNAME_MACHINE}-dec-linux-gnu
966 966
 	exit ;;
967 967
     x86_64:Linux:*:*)
968
-	echo x86_64-unknown-linux-${LIBC}
968
+	echo x86_64-unknown-linux-gnu
969 969
 	exit ;;
970 970
     i*86:Linux:*:*)
971 971
 	# The BFD linker knows what the default object file format is, so
... ...
@@ -980,22 +963,20 @@ EOF
980 980
 				    p'`
981 981
         case "$ld_supported_targets" in
982 982
 	  elf32-i386)
983
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
983
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
984 984
 		;;
985 985
 	  a.out-i386-linux)
986
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
986
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
987 987
 		exit ;;
988 988
 	  coff-i386)
989
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
989
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
990 990
 		exit ;;
991 991
 	  "")
992 992
 		# Either a pre-BFD a.out linker (linux-gnuoldld) or
993 993
 		# one that does not give us useful --help.
994
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
994
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
995 995
 		exit ;;
996 996
 	esac
997
-	# This should get integrated into the C code below, but now we hack
998
-	if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
999 997
 	# Determine whether the default compiler is a.out or elf
1000 998
 	eval $set_cc_for_build
1001 999
 	sed 's/^	//' << EOF >$dummy.c
... ...
@@ -244,7 +244,7 @@ case $basic_machine in
244 244
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
245 245
 	| bfin \
246 246
 	| c4x | clipper \
247
-	| d10v | d30v | dlx | dsp16xx | dvp \
247
+	| d10v | d30v | dlx | dsp16xx \
248 248
 	| fr30 | frv \
249 249
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
250 250
 	| i370 | i860 | i960 | ia64 \
... ...
@@ -276,7 +276,7 @@ case $basic_machine in
276 276
 	| pdp10 | pdp11 | pj | pjl \
277 277
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
278 278
 	| pyramid \
279
-	| sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
279
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
280 280
 	| sh64 | sh64le \
281 281
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
282 282
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
... ...
@@ -357,7 +357,7 @@ case $basic_machine in
357 357
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
358 358
 	| pyramid-* \
359 359
 	| romp-* | rs6000-* \
360
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
360
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
361 361
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
362 362
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
363 363
 	| sparclite-* \
... ...
@@ -689,24 +689,6 @@ case $basic_machine in
689 689
 		basic_machine=m68k-atari
690 690
 		os=-mint
691 691
 		;;
692
-	mipsEE* | ee | ps2)
693
-		basic_machine=mips64r5900el-scei
694
-		case $os in
695
-		    -linux*)
696
-			;;
697
-		    *)
698
-			os=-elf
699
-			;;
700
-		esac
701
-		;;
702
-	iop)
703
-		basic_machine=mipsel-scei
704
-		os=-irx
705
-		;;
706
-	dvp)
707
-		basic_machine=dvp-scei
708
-		os=-elf
709
-		;;
710 692
 	mips3*-*)
711 693
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
712 694
 		;;
... ...
@@ -1232,7 +1214,7 @@ case $os in
1232 1232
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1233 1233
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1234 1234
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1235
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -irx*)
1235
+	      | -skyos* | -haiku* | -rdos* | -toppers*)
1236 1236
 	# Remember, each alternative MUST END IN *, to match a version number.
1237 1237
 		;;
1238 1238
 	-qnx*)
... ...
@@ -1,6 +1,6 @@
1 1
 #! /bin/sh
2 2
 # Guess values for system-dependent variables and create Makefiles.
3
-# Generated by GNU Autoconf 2.60.
3
+# Generated by GNU Autoconf 2.60a.
4 4
 #
5 5
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
6 6
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
... ...
@@ -719,36 +719,36 @@ ac_unique_file="regex_list_test.c"
719 719
 # Factoring default headers for most tests.
720 720
 ac_includes_default="\
721 721
 #include <stdio.h>
722
-#if HAVE_SYS_TYPES_H
722
+#ifdef HAVE_SYS_TYPES_H
723 723
 # include <sys/types.h>
724 724
 #endif
725
-#if HAVE_SYS_STAT_H
725
+#ifdef HAVE_SYS_STAT_H
726 726
 # include <sys/stat.h>
727 727
 #endif
728
-#if STDC_HEADERS
728
+#ifdef STDC_HEADERS
729 729
 # include <stdlib.h>
730 730
 # include <stddef.h>
731 731
 #else
732
-# if HAVE_STDLIB_H
732
+# ifdef HAVE_STDLIB_H
733 733
 #  include <stdlib.h>
734 734
 # endif
735 735
 #endif
736
-#if HAVE_STRING_H
737
-# if !STDC_HEADERS && HAVE_MEMORY_H
736
+#ifdef HAVE_STRING_H
737
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
738 738
 #  include <memory.h>
739 739
 # endif
740 740
 # include <string.h>
741 741
 #endif
742
-#if HAVE_STRINGS_H
742
+#ifdef HAVE_STRINGS_H
743 743
 # include <strings.h>
744 744
 #endif
745
-#if HAVE_INTTYPES_H
745
+#ifdef HAVE_INTTYPES_H
746 746
 # include <inttypes.h>
747 747
 #endif
748
-#if HAVE_STDINT_H
748
+#ifdef HAVE_STDINT_H
749 749
 # include <stdint.h>
750 750
 #endif
751
-#if HAVE_UNISTD_H
751
+#ifdef HAVE_UNISTD_H
752 752
 # include <unistd.h>
753 753
 #endif"
754 754
 
... ...
@@ -852,7 +852,6 @@ F77
852 852
 FFLAGS
853 853
 ac_ct_F77
854 854
 LIBTOOL
855
-subdirs
856 855
 CHECK_CFLAGS
857 856
 CHECK_LIBS
858 857
 LIBOBJS
... ...
@@ -872,7 +871,7 @@ CCC
872 872
 CXXCPP
873 873
 F77
874 874
 FFLAGS'
875
-ac_subdirs_all='./clam'
875
+
876 876
 
877 877
 # Initialize some variables set by options.
878 878
 ac_init_help=
... ...
@@ -1544,7 +1543,7 @@ test -n "$ac_init_help" && exit $ac_status
1544 1544
 if $ac_init_version; then
1545 1545
   cat <<\_ACEOF
1546 1546
 configure
1547
-generated by GNU Autoconf 2.60
1547
+generated by GNU Autoconf 2.60a
1548 1548
 
1549 1549
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
1550 1550
 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
... ...
@@ -1558,7 +1557,7 @@ This file contains any messages produced by compilers while
1558 1558
 running configure, to aid debugging if configure makes a mistake.
1559 1559
 
1560 1560
 It was created by $as_me, which was
1561
-generated by GNU Autoconf 2.60.  Invocation command line was
1561
+generated by GNU Autoconf 2.60a.  Invocation command line was
1562 1562
 
1563 1563
   $ $0 $@
1564 1564
 
... ...
@@ -2773,7 +2772,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2773 2773
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
2774 2774
 # so that the user can short-circuit this test for compilers unknown to
2775 2775
 # Autoconf.
2776
-for ac_file in $ac_files
2776
+for ac_file in $ac_files ''
2777 2777
 do
2778 2778
   test -f "$ac_file" || continue
2779 2779
   case $ac_file in
... ...
@@ -2801,6 +2800,12 @@ done
2801 2801
 test "$ac_cv_exeext" = no && ac_cv_exeext=
2802 2802
 
2803 2803
 else
2804
+  ac_file=''
2805
+fi
2806
+
2807
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
2808
+echo "${ECHO_T}$ac_file" >&6; }
2809
+if test -z "$ac_file"; then
2804 2810
   echo "$as_me: failed program was:" >&5
2805 2811
 sed 's/^/| /' conftest.$ac_ext >&5
2806 2812
 
... ...
@@ -2812,8 +2817,6 @@ See \`config.log' for more details." >&2;}
2812 2812
 fi
2813 2813
 
2814 2814
 ac_exeext=$ac_cv_exeext
2815
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
2816
-echo "${ECHO_T}$ac_file" >&6; }
2817 2815
 
2818 2816
 # Check that the compiler produces executables we can run.  If not, either
2819 2817
 # the compiler is broken, or we cross compile.
... ...
@@ -4165,7 +4168,7 @@ darwin* | rhapsody*)
4165 4165
   lt_cv_deplibs_check_method=pass_all
4166 4166
   ;;
4167 4167
 
4168
-freebsd* | kfreebsd*-gnu | dragonfly*)
4168
+freebsd* | dragonfly*)
4169 4169
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
4170 4170
     case $host_cpu in
4171 4171
     i*86 )
... ...
@@ -4219,11 +4222,11 @@ irix5* | irix6* | nonstopux*)
4219 4219
   ;;
4220 4220
 
4221 4221
 # This must be Linux ELF.
4222
-linux*)
4222
+linux* | k*bsd*-gnu)
4223 4223
   lt_cv_deplibs_check_method=pass_all
4224 4224
   ;;
4225 4225
 
4226
-netbsd*)
4226
+netbsd* | netbsdelf*-gnu)
4227 4227
   if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
4228 4228
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
4229 4229
   else
... ...
@@ -4340,7 +4343,7 @@ ia64-*-hpux*)
4340 4340
   ;;
4341 4341
 *-*-irix6*)
4342 4342
   # Find out which ABI we are using.
4343
-  echo '#line 4343 "configure"' > conftest.$ac_ext
4343
+  echo '#line 4346 "configure"' > conftest.$ac_ext
4344 4344
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
4345 4345
   (eval $ac_compile) 2>&5
4346 4346
   ac_status=$?
... ...
@@ -4493,7 +4496,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
4493 4493
 	lt_cv_cc_needs_belf=no
4494 4494
 fi
4495 4495
 
4496
-rm -f core conftest.err conftest.$ac_objext \
4496
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
4497 4497
       conftest$ac_exeext conftest.$ac_ext
4498 4498
      ac_ext=c
4499 4499
 ac_cpp='$CPP $CPPFLAGS'
... ...
@@ -6493,7 +6496,7 @@ hpux*) # Its linker distinguishes data from code symbols
6493 6493
   lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
6494 6494
   lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
6495 6495
   ;;
6496
-linux*)
6496
+linux* | k*bsd*-gnu)
6497 6497
   if test "$host_cpu" = ia64; then
6498 6498
     symcode='[ABCDGIRSTW]'
6499 6499
     lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
... ...
@@ -7226,67 +7229,6 @@ fi
7226 7226
 
7227 7227
 test -z "$pic_mode" && pic_mode=default
7228 7228
 
7229
-# Check if we have a version mismatch between libtool.m4 and ltmain.sh.
7230
-#
7231
-# Note:  This should be in AC_LIBTOOL_SETUP, _after_ $ltmain have been defined.
7232
-#        We also should do it _before_ AC_LIBTOOL_LANG_C_CONFIG that actually
7233
-#        calls AC_LIBTOOL_CONFIG and creates libtool.
7234
-#
7235
-{ echo "$as_me:$LINENO: checking for correct ltmain.sh version" >&5
7236
-echo $ECHO_N "checking for correct ltmain.sh version... $ECHO_C" >&6; }
7237
-if test "x$ltmain" = "x" ; then
7238
-  { echo "$as_me:$LINENO: result: no" >&5
7239
-echo "${ECHO_T}no" >&6; }
7240
-  { { echo "$as_me:$LINENO: error:
7241
-
7242
-*** [Gentoo] sanity check failed! ***
7243
-*** \$ltmain is not defined, please check the patch for consistency! ***
7244
-" >&5
7245
-echo "$as_me: error:
7246
-
7247
-*** [Gentoo] sanity check failed! ***
7248
-*** \$ltmain is not defined, please check the patch for consistency! ***
7249
-" >&2;}
7250
-   { (exit 1); exit 1; }; }
7251
-fi
7252
-gentoo_lt_version="1.5.22"
7253
-gentoo_ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' "$ltmain"`
7254
-if test "x$gentoo_lt_version" != "x$gentoo_ltmain_version" ; then
7255
-  { echo "$as_me:$LINENO: result: no" >&5
7256
-echo "${ECHO_T}no" >&6; }
7257
-  { { echo "$as_me:$LINENO: error:
7258
-
7259
-*** [Gentoo] sanity check failed! ***
7260
-*** libtool.m4 and ltmain.sh have a version mismatch! ***
7261
-*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
7262
-
7263
-Please run:
7264
-
7265
-  libtoolize --copy --force
7266
-
7267
-if appropriate, please contact the maintainer of this
7268
-package (or your distribution) for help.
7269
-" >&5
7270
-echo "$as_me: error:
7271
-
7272
-*** [Gentoo] sanity check failed! ***
7273
-*** libtool.m4 and ltmain.sh have a version mismatch! ***
7274
-*** (libtool.m4 = $gentoo_lt_version, ltmain.sh = $gentoo_ltmain_version) ***
7275
-
7276
-Please run:
7277
-
7278
-  libtoolize --copy --force
7279
-
7280
-if appropriate, please contact the maintainer of this
7281
-package (or your distribution) for help.
7282
-" >&2;}
7283
-   { (exit 1); exit 1; }; }
7284
-else
7285
-  { echo "$as_me:$LINENO: result: yes" >&5
7286
-echo "${ECHO_T}yes" >&6; }
7287
-fi
7288
-
7289
-
7290 7229
 # Use C for the default configuration in the libtool script
7291 7230
 tagname=
7292 7231
 lt_save_CC="$CC"
... ...
@@ -7360,11 +7302,11 @@ else
7360 7360
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
7361 7361
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
7362 7362
    -e 's:$: $lt_compiler_flag:'`
7363
-   (eval echo "\"\$as_me:7363: $lt_compile\"" >&5)
7363
+   (eval echo "\"\$as_me:7305: $lt_compile\"" >&5)
7364 7364
    (eval "$lt_compile" 2>conftest.err)
7365 7365
    ac_status=$?
7366 7366
    cat conftest.err >&5
7367
-   echo "$as_me:7367: \$? = $ac_status" >&5
7367
+   echo "$as_me:7309: \$? = $ac_status" >&5
7368 7368
    if (exit $ac_status) && test -s "$ac_outfile"; then
7369 7369
      # The compiler can only warn and ignore the option if not recognized
7370 7370
      # So say no if there are warnings other than the usual output.
... ...
@@ -7522,7 +7464,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
7522 7522
       lt_prog_compiler_static='-Bstatic'
7523 7523
       ;;
7524 7524
 
7525
-    linux*)
7525
+    linux* | k*bsd*-gnu)
7526 7526
       case $cc_basename in
7527 7527
       icc* | ecc*)
7528 7528
 	lt_prog_compiler_wl='-Wl,'
... ...
@@ -7628,11 +7570,11 @@ else
7628 7628
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
7629 7629
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
7630 7630
    -e 's:$: $lt_compiler_flag:'`
7631
-   (eval echo "\"\$as_me:7631: $lt_compile\"" >&5)
7631
+   (eval echo "\"\$as_me:7573: $lt_compile\"" >&5)
7632 7632
    (eval "$lt_compile" 2>conftest.err)
7633 7633
    ac_status=$?
7634 7634
    cat conftest.err >&5
7635
-   echo "$as_me:7635: \$? = $ac_status" >&5
7635
+   echo "$as_me:7577: \$? = $ac_status" >&5
7636 7636
    if (exit $ac_status) && test -s "$ac_outfile"; then
7637 7637
      # The compiler can only warn and ignore the option if not recognized
7638 7638
      # So say no if there are warnings other than the usual output.
... ...
@@ -7732,11 +7674,11 @@ else
7732 7732
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
7733 7733
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
7734 7734
    -e 's:$: $lt_compiler_flag:'`
7735
-   (eval echo "\"\$as_me:7735: $lt_compile\"" >&5)
7735
+   (eval echo "\"\$as_me:7677: $lt_compile\"" >&5)
7736 7736
    (eval "$lt_compile" 2>out/conftest.err)
7737 7737
    ac_status=$?
7738 7738
    cat out/conftest.err >&5
7739
-   echo "$as_me:7739: \$? = $ac_status" >&5
7739
+   echo "$as_me:7681: \$? = $ac_status" >&5
7740 7740
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
7741 7741
    then
7742 7742
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -7961,7 +7903,7 @@ EOF
7961 7961
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
7962 7962
       ;;
7963 7963
 
7964
-    linux*)
7964
+    linux* | k*bsd*-gnu)
7965 7965
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
7966 7966
 	tmp_addflag=
7967 7967
 	case $cc_basename,$host_cpu in
... ...
@@ -7987,12 +7929,13 @@ EOF
7987 7987
   $echo "local: *; };" >> $output_objdir/$libname.ver~
7988 7988
 	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
7989 7989
 	fi
7990
+	link_all_deplibs=no
7990 7991
       else
7991 7992
 	ld_shlibs=no
7992 7993
       fi
7993 7994
       ;;
7994 7995
 
7995
-    netbsd*)
7996
+    netbsd* | netbsdelf*-gnu)
7996 7997
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
7997 7998
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
7998 7999
 	wlarc=
... ...
@@ -8246,7 +8189,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
8246 8246
 
8247 8247
 fi
8248 8248
 
8249
-rm -f core conftest.err conftest.$ac_objext \
8249
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8250 8250
       conftest$ac_exeext conftest.$ac_ext
8251 8251
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
8252 8252
 
... ...
@@ -8321,7 +8264,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
8321 8321
 
8322 8322
 fi
8323 8323
 
8324
-rm -f core conftest.err conftest.$ac_objext \
8324
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8325 8325
       conftest$ac_exeext conftest.$ac_ext
8326 8326
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
8327 8327
 
... ...
@@ -8452,7 +8395,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
8452 8452
       ;;
8453 8453
 
8454 8454
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
8455
-    freebsd* | kfreebsd*-gnu | dragonfly*)
8455
+    freebsd* | dragonfly*)
8456 8456
       archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
8457 8457
       hardcode_libdir_flag_spec='-R$libdir'
8458 8458
       hardcode_direct=yes
... ...
@@ -8554,7 +8497,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
8554 8554
       link_all_deplibs=yes
8555 8555
       ;;
8556 8556
 
8557
-    netbsd*)
8557
+    netbsd* | netbsdelf*-gnu)
8558 8558
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
8559 8559
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
8560 8560
       else
... ...
@@ -9003,30 +8946,6 @@ cygwin* | mingw* | pw32*)
9003 9003
     esac
9004 9004
     ;;
9005 9005
 
9006
-  linux*)
9007
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
9008
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
9009
-      supports_anon_versioning=no
9010
-      case `$LD -v 2>/dev/null` in
9011
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
9012
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
9013
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
9014
-        *\ 2.11.*) ;; # other 2.11 versions
9015
-        *) supports_anon_versioning=yes ;;
9016
-      esac
9017
-      if test $supports_anon_versioning = yes; then
9018
-        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
9019
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
9020
-$echo "local: *; };" >> $output_objdir/$libname.ver~
9021
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
9022
-      else
9023
-        $archive_expsym_cmds="$archive_cmds"
9024
-      fi
9025
-    else
9026
-      ld_shlibs=no
9027
-    fi
9028
-    ;;
9029
-
9030 9006
   *)
9031 9007
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
9032 9008
     ;;
... ...
@@ -9068,18 +8987,6 @@ freebsd1*)
9068 9068
   dynamic_linker=no
9069 9069
   ;;
9070 9070
 
9071
-kfreebsd*-gnu)
9072
-  version_type=linux
9073
-  need_lib_prefix=no
9074
-  need_version=no
9075
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
9076
-  soname_spec='${libname}${release}${shared_ext}$major'
9077
-  shlibpath_var=LD_LIBRARY_PATH
9078
-  shlibpath_overrides_runpath=no
9079
-  hardcode_into_libs=yes
9080
-  dynamic_linker='GNU ld.so'
9081
-  ;;
9082
-
9083 9071
 freebsd* | dragonfly*)
9084 9072
   # DragonFly does not have aout.  When/if they implement a new
9085 9073
   # versioning mechanism, adjust this.
... ...
@@ -9091,14 +8998,7 @@ freebsd* | dragonfly*)
9091 9091
     *) objformat=elf ;;
9092 9092
     esac
9093 9093
   fi
9094
-  # Handle Gentoo/FreeBSD as it was Linux
9095
-  case $host_vendor in
9096
-    gentoo)
9097
-      version_type=linux ;;
9098
-    *)
9099
-      version_type=freebsd-$objformat ;;
9100
-  esac
9101
-
9094
+  version_type=freebsd-$objformat
9102 9095
   case $version_type in
9103 9096
     freebsd-elf*)
9104 9097
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
... ...
@@ -9109,12 +9009,6 @@ freebsd* | dragonfly*)
9109 9109
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
9110 9110
       need_version=yes
9111 9111
       ;;
9112
-    linux)
9113
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
9114
-      soname_spec='${libname}${release}${shared_ext}$major'
9115
-      need_lib_prefix=no
9116
-      need_version=no
9117
-      ;;
9118 9112
   esac
9119 9113
   shlibpath_var=LD_LIBRARY_PATH
9120 9114
   case $host_os in
... ...
@@ -9248,7 +9142,7 @@ linux*oldld* | linux*aout* | linux*coff*)
9248 9248
   ;;
9249 9249
 
9250 9250
 # This must be Linux ELF.
9251
-linux*)
9251
+linux* | k*bsd*-gnu)
9252 9252
   version_type=linux
9253 9253
   need_lib_prefix=no
9254 9254
   need_version=no
... ...
@@ -9277,7 +9171,7 @@ linux*)
9277 9277
   dynamic_linker='GNU/Linux ld.so'
9278 9278
   ;;
9279 9279
 
9280
-knetbsd*-gnu)
9280
+netbsdelf*-gnu)
9281 9281
   version_type=linux
9282 9282
   need_lib_prefix=no
9283 9283
   need_version=no
... ...
@@ -9286,7 +9180,7 @@ knetbsd*-gnu)
9286 9286
   shlibpath_var=LD_LIBRARY_PATH
9287 9287
   shlibpath_overrides_runpath=no
9288 9288
   hardcode_into_libs=yes
9289
-  dynamic_linker='GNU ld.so'
9289
+  dynamic_linker='NetBSD ld.elf_so'
9290 9290
   ;;
9291 9291
 
9292 9292
 netbsd*)
... ...
@@ -9635,7 +9529,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
9635 9635
 	ac_cv_lib_dl_dlopen=no
9636 9636
 fi
9637 9637
 
9638
-rm -f core conftest.err conftest.$ac_objext \
9638
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9639 9639
       conftest$ac_exeext conftest.$ac_ext
9640 9640
 LIBS=$ac_check_lib_save_LIBS
9641 9641
 fi
... ...
@@ -9746,7 +9640,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
9746 9746
 	ac_cv_func_shl_load=no
9747 9747
 fi
9748 9748
 
9749
-rm -f core conftest.err conftest.$ac_objext \
9749
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9750 9750
       conftest$ac_exeext conftest.$ac_ext
9751 9751
 fi
9752 9752
 { echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
... ...
@@ -9825,7 +9719,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
9825 9825
 	ac_cv_lib_dld_shl_load=no
9826 9826
 fi
9827 9827
 
9828
-rm -f core conftest.err conftest.$ac_objext \
9828
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9829 9829
       conftest$ac_exeext conftest.$ac_ext
9830 9830
 LIBS=$ac_check_lib_save_LIBS
9831 9831
 fi
... ...
@@ -9926,7 +9820,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
9926 9926
 	ac_cv_func_dlopen=no
9927 9927
 fi
9928 9928
 
9929
-rm -f core conftest.err conftest.$ac_objext \
9929
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
9930 9930
       conftest$ac_exeext conftest.$ac_ext
9931 9931
 fi
9932 9932
 { echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
... ...
@@ -10005,7 +9899,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
10005 10005
 	ac_cv_lib_dl_dlopen=no
10006 10006
 fi
10007 10007
 
10008
-rm -f core conftest.err conftest.$ac_objext \
10008
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10009 10009
       conftest$ac_exeext conftest.$ac_ext
10010 10010
 LIBS=$ac_check_lib_save_LIBS
10011 10011
 fi
... ...
@@ -10085,7 +9979,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
10085 10085
 	ac_cv_lib_svld_dlopen=no
10086 10086
 fi
10087 10087
 
10088
-rm -f core conftest.err conftest.$ac_objext \
10088
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10089 10089
       conftest$ac_exeext conftest.$ac_ext
10090 10090
 LIBS=$ac_check_lib_save_LIBS
10091 10091
 fi
... ...
@@ -10165,7 +10059,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
10165 10165
 	ac_cv_lib_dld_dld_link=no
10166 10166
 fi
10167 10167
 
10168
-rm -f core conftest.err conftest.$ac_objext \
10168
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
10169 10169
       conftest$ac_exeext conftest.$ac_ext
10170 10170
 LIBS=$ac_check_lib_save_LIBS
10171 10171
 fi
... ...
@@ -10221,7 +10115,7 @@ else
10221 10221
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10222 10222
   lt_status=$lt_dlunknown
10223 10223
   cat > conftest.$ac_ext <<EOF
10224
-#line 10224 "configure"
10224
+#line 10118 "configure"
10225 10225
 #include "confdefs.h"
10226 10226
 
10227 10227
 #if HAVE_DLFCN_H
... ...
@@ -10321,7 +10215,7 @@ else
10321 10321
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
10322 10322
   lt_status=$lt_dlunknown
10323 10323
   cat > conftest.$ac_ext <<EOF
10324
-#line 10324 "configure"
10324
+#line 10218 "configure"
10325 10325
 #include "confdefs.h"
10326 10326
 
10327 10327
 #if HAVE_DLFCN_H
... ...
@@ -11442,7 +11336,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
11442 11442
 
11443 11443
 fi
11444 11444
 
11445
-rm -f core conftest.err conftest.$ac_objext \
11445
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11446 11446
       conftest$ac_exeext conftest.$ac_ext
11447 11447
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11448 11448
 
... ...
@@ -11518,7 +11412,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
11518 11518
 
11519 11519
 fi
11520 11520
 
11521
-rm -f core conftest.err conftest.$ac_objext \
11521
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
11522 11522
       conftest$ac_exeext conftest.$ac_ext
11523 11523
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11524 11524
 
... ...
@@ -11666,7 +11560,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11666 11666
   freebsd-elf*)
11667 11667
     archive_cmds_need_lc_CXX=no
11668 11668
     ;;
11669
-  freebsd* | kfreebsd*-gnu | dragonfly*)
11669
+  freebsd* | dragonfly*)
11670 11670
     # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
11671 11671
     # conventions
11672 11672
     ld_shlibs_CXX=yes
... ...
@@ -11825,7 +11719,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11825 11825
     hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
11826 11826
     hardcode_libdir_separator_CXX=:
11827 11827
     ;;
11828
-  linux*)
11828
+  linux* | k*bsd*-gnu)
11829 11829
     case $cc_basename in
11830 11830
       KCC*)
11831 11831
 	# Kuck and Associates, Inc. (KAI) C++ Compiler
... ...
@@ -11927,7 +11821,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
11927 11927
 	;;
11928 11928
     esac
11929 11929
     ;;
11930
-  netbsd*)
11930
+  netbsd* | netbsdelf*-gnu)
11931 11931
     if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
11932 11932
       archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
11933 11933
       wlarc=
... ...
@@ -12494,7 +12388,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
12494 12494
 	    ;;
12495 12495
 	esac
12496 12496
 	;;
12497
-      freebsd* | kfreebsd*-gnu | dragonfly*)
12497
+      freebsd* | dragonfly*)
12498 12498
 	# FreeBSD uses GNU C++
12499 12499
 	;;
12500 12500
       hpux9* | hpux10* | hpux11*)
... ...
@@ -12537,7 +12431,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
12537 12537
 	    ;;
12538 12538
 	esac
12539 12539
 	;;
12540
-      linux*)
12540
+      linux* | k*bsd*-gnu)
12541 12541
 	case $cc_basename in
12542 12542
 	  KCC*)
12543 12543
 	    # KAI C++ Compiler
... ...
@@ -12580,7 +12474,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
12580 12580
 	    ;;
12581 12581
 	esac
12582 12582
 	;;
12583
-      netbsd*)
12583
+      netbsd* | netbsdelf*-gnu)
12584 12584
 	;;
12585 12585
       osf3* | osf4* | osf5*)
12586 12586
 	case $cc_basename in
... ...
@@ -12689,11 +12583,11 @@ else
12689 12689
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
12690 12690
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
12691 12691
    -e 's:$: $lt_compiler_flag:'`
12692
-   (eval echo "\"\$as_me:12692: $lt_compile\"" >&5)
12692
+   (eval echo "\"\$as_me:12586: $lt_compile\"" >&5)
12693 12693
    (eval "$lt_compile" 2>conftest.err)
12694 12694
    ac_status=$?
12695 12695
    cat conftest.err >&5
12696
-   echo "$as_me:12696: \$? = $ac_status" >&5
12696
+   echo "$as_me:12590: \$? = $ac_status" >&5
12697 12697
    if (exit $ac_status) && test -s "$ac_outfile"; then
12698 12698
      # The compiler can only warn and ignore the option if not recognized
12699 12699
      # So say no if there are warnings other than the usual output.
... ...
@@ -12793,11 +12687,11 @@ else
12793 12793
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
12794 12794
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
12795 12795
    -e 's:$: $lt_compiler_flag:'`
12796
-   (eval echo "\"\$as_me:12796: $lt_compile\"" >&5)
12796
+   (eval echo "\"\$as_me:12690: $lt_compile\"" >&5)
12797 12797
    (eval "$lt_compile" 2>out/conftest.err)
12798 12798
    ac_status=$?
12799 12799
    cat out/conftest.err >&5
12800
-   echo "$as_me:12800: \$? = $ac_status" >&5
12800
+   echo "$as_me:12694: \$? = $ac_status" >&5
12801 12801
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
12802 12802
    then
12803 12803
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -12865,6 +12759,9 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
12865 12865
   cygwin* | mingw*)
12866 12866
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols'
12867 12867
   ;;
12868
+  linux* | k*bsd*-gnu)
12869
+    link_all_deplibs_CXX=no
12870
+  ;;
12868 12871
   *)
12869 12872
     export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
12870 12873
   ;;
... ...
@@ -13103,30 +13000,6 @@ cygwin* | mingw* | pw32*)
13103 13103
     esac
13104 13104
     ;;
13105 13105
 
13106
-  linux*)
13107
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
13108
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
13109
-      supports_anon_versioning=no
13110
-      case `$LD -v 2>/dev/null` in
13111
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
13112
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
13113
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
13114
-        *\ 2.11.*) ;; # other 2.11 versions
13115
-        *) supports_anon_versioning=yes ;;
13116
-      esac
13117
-      if test $supports_anon_versioning = yes; then
13118
-        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
13119
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
13120
-$echo "local: *; };" >> $output_objdir/$libname.ver~
13121
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
13122
-      else
13123
-        $archive_expsym_cmds="$archive_cmds"
13124
-      fi
13125
-    else
13126
-      ld_shlibs=no
13127
-    fi
13128
-    ;;
13129
-
13130 13106
   *)
13131 13107
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
13132 13108
     ;;
... ...
@@ -13168,18 +13041,6 @@ freebsd1*)
13168 13168
   dynamic_linker=no
13169 13169
   ;;
13170 13170
 
13171
-kfreebsd*-gnu)
13172
-  version_type=linux
13173
-  need_lib_prefix=no
13174
-  need_version=no
13175
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
13176
-  soname_spec='${libname}${release}${shared_ext}$major'
13177
-  shlibpath_var=LD_LIBRARY_PATH
13178
-  shlibpath_overrides_runpath=no
13179
-  hardcode_into_libs=yes
13180
-  dynamic_linker='GNU ld.so'
13181
-  ;;
13182
-
13183 13171
 freebsd* | dragonfly*)
13184 13172
   # DragonFly does not have aout.  When/if they implement a new
13185 13173
   # versioning mechanism, adjust this.
... ...
@@ -13191,14 +13052,7 @@ freebsd* | dragonfly*)
13191 13191
     *) objformat=elf ;;
13192 13192
     esac
13193 13193
   fi
13194
-  # Handle Gentoo/FreeBSD as it was Linux
13195
-  case $host_vendor in
13196
-    gentoo)
13197
-      version_type=linux ;;
13198
-    *)
13199
-      version_type=freebsd-$objformat ;;
13200
-  esac
13201
-
13194
+  version_type=freebsd-$objformat
13202 13195
   case $version_type in
13203 13196
     freebsd-elf*)
13204 13197
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
... ...
@@ -13209,12 +13063,6 @@ freebsd* | dragonfly*)
13209 13209
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
13210 13210
       need_version=yes
13211 13211
       ;;
13212
-    linux)
13213
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
13214
-      soname_spec='${libname}${release}${shared_ext}$major'
13215
-      need_lib_prefix=no
13216
-      need_version=no
13217
-      ;;
13218 13212
   esac
13219 13213
   shlibpath_var=LD_LIBRARY_PATH
13220 13214
   case $host_os in
... ...
@@ -13348,7 +13196,7 @@ linux*oldld* | linux*aout* | linux*coff*)
13348 13348
   ;;
13349 13349
 
13350 13350
 # This must be Linux ELF.
13351
-linux*)
13351
+linux* | k*bsd*-gnu)
13352 13352
   version_type=linux
13353 13353
   need_lib_prefix=no
13354 13354
   need_version=no
... ...
@@ -13377,7 +13225,7 @@ linux*)
13377 13377
   dynamic_linker='GNU/Linux ld.so'
13378 13378
   ;;
13379 13379
 
13380
-knetbsd*-gnu)
13380
+netbsdelf*-gnu)
13381 13381
   version_type=linux
13382 13382
   need_lib_prefix=no
13383 13383
   need_version=no
... ...
@@ -13386,7 +13234,7 @@ knetbsd*-gnu)
13386 13386
   shlibpath_var=LD_LIBRARY_PATH
13387 13387
   shlibpath_overrides_runpath=no
13388 13388
   hardcode_into_libs=yes
13389
-  dynamic_linker='GNU ld.so'
13389
+  dynamic_linker='NetBSD ld.elf_so'
13390 13390
   ;;
13391 13391
 
13392 13392
 netbsd*)
... ...
@@ -14294,7 +14142,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
14294 14294
       lt_prog_compiler_static_F77='-Bstatic'
14295 14295
       ;;
14296 14296
 
14297
-    linux*)
14297
+    linux* | k*bsd*-gnu)
14298 14298
       case $cc_basename in
14299 14299
       icc* | ecc*)
14300 14300
 	lt_prog_compiler_wl_F77='-Wl,'
... ...
@@ -14400,11 +14248,11 @@ else
14400 14400
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
14401 14401
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
14402 14402
    -e 's:$: $lt_compiler_flag:'`
14403
-   (eval echo "\"\$as_me:14403: $lt_compile\"" >&5)
14403
+   (eval echo "\"\$as_me:14251: $lt_compile\"" >&5)
14404 14404
    (eval "$lt_compile" 2>conftest.err)
14405 14405
    ac_status=$?
14406 14406
    cat conftest.err >&5
14407
-   echo "$as_me:14407: \$? = $ac_status" >&5
14407
+   echo "$as_me:14255: \$? = $ac_status" >&5
14408 14408
    if (exit $ac_status) && test -s "$ac_outfile"; then
14409 14409
      # The compiler can only warn and ignore the option if not recognized
14410 14410
      # So say no if there are warnings other than the usual output.
... ...
@@ -14504,11 +14352,11 @@ else
14504 14504
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
14505 14505
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
14506 14506
    -e 's:$: $lt_compiler_flag:'`
14507
-   (eval echo "\"\$as_me:14507: $lt_compile\"" >&5)
14507
+   (eval echo "\"\$as_me:14355: $lt_compile\"" >&5)
14508 14508
    (eval "$lt_compile" 2>out/conftest.err)
14509 14509
    ac_status=$?
14510 14510
    cat out/conftest.err >&5
14511
-   echo "$as_me:14511: \$? = $ac_status" >&5
14511
+   echo "$as_me:14359: \$? = $ac_status" >&5
14512 14512
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
14513 14513
    then
14514 14514
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -14733,7 +14581,7 @@ EOF
14733 14733
       archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
14734 14734
       ;;
14735 14735
 
14736
-    linux*)
14736
+    linux* | k*bsd*-gnu)
14737 14737
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
14738 14738
 	tmp_addflag=
14739 14739
 	case $cc_basename,$host_cpu in
... ...
@@ -14759,12 +14607,13 @@ EOF
14759 14759
   $echo "local: *; };" >> $output_objdir/$libname.ver~
14760 14760
 	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
14761 14761
 	fi
14762
+	link_all_deplibs_F77=no
14762 14763
       else
14763 14764
 	ld_shlibs_F77=no
14764 14765
       fi
14765 14766
       ;;
14766 14767
 
14767
-    netbsd*)
14768
+    netbsd* | netbsdelf*-gnu)
14768 14769
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
14769 14770
 	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
14770 14771
 	wlarc=
... ...
@@ -15008,7 +14857,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
15008 15008
 
15009 15009
 fi
15010 15010
 
15011
-rm -f core conftest.err conftest.$ac_objext \
15011
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15012 15012
       conftest$ac_exeext conftest.$ac_ext
15013 15013
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
15014 15014
 
... ...
@@ -15073,7 +14922,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
15073 15073
 
15074 15074
 fi
15075 15075
 
15076
-rm -f core conftest.err conftest.$ac_objext \
15076
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
15077 15077
       conftest$ac_exeext conftest.$ac_ext
15078 15078
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
15079 15079
 
... ...
@@ -15204,7 +15053,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
15204 15204
       ;;
15205 15205
 
15206 15206
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
15207
-    freebsd* | kfreebsd*-gnu | dragonfly*)
15207
+    freebsd* | dragonfly*)
15208 15208
       archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
15209 15209
       hardcode_libdir_flag_spec_F77='-R$libdir'
15210 15210
       hardcode_direct_F77=yes
... ...
@@ -15306,7 +15155,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
15306 15306
       link_all_deplibs_F77=yes
15307 15307
       ;;
15308 15308
 
15309
-    netbsd*)
15309
+    netbsd* | netbsdelf*-gnu)
15310 15310
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
15311 15311
 	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
15312 15312
       else
... ...
@@ -15755,30 +15604,6 @@ cygwin* | mingw* | pw32*)
15755 15755
     esac
15756 15756
     ;;
15757 15757
 
15758
-  linux*)
15759
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
15760
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
15761
-      supports_anon_versioning=no
15762
-      case `$LD -v 2>/dev/null` in
15763
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
15764
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
15765
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
15766
-        *\ 2.11.*) ;; # other 2.11 versions
15767
-        *) supports_anon_versioning=yes ;;
15768
-      esac
15769
-      if test $supports_anon_versioning = yes; then
15770
-        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
15771
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
15772
-$echo "local: *; };" >> $output_objdir/$libname.ver~
15773
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
15774
-      else
15775
-        $archive_expsym_cmds="$archive_cmds"
15776
-      fi
15777
-    else
15778
-      ld_shlibs=no
15779
-    fi
15780
-    ;;
15781
-
15782 15758
   *)
15783 15759
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
15784 15760
     ;;
... ...
@@ -15820,18 +15645,6 @@ freebsd1*)
15820 15820
   dynamic_linker=no
15821 15821
   ;;
15822 15822
 
15823
-kfreebsd*-gnu)
15824
-  version_type=linux
15825
-  need_lib_prefix=no
15826
-  need_version=no
15827
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
15828
-  soname_spec='${libname}${release}${shared_ext}$major'
15829
-  shlibpath_var=LD_LIBRARY_PATH
15830
-  shlibpath_overrides_runpath=no
15831
-  hardcode_into_libs=yes
15832
-  dynamic_linker='GNU ld.so'
15833
-  ;;
15834
-
15835 15823
 freebsd* | dragonfly*)
15836 15824
   # DragonFly does not have aout.  When/if they implement a new
15837 15825
   # versioning mechanism, adjust this.
... ...
@@ -15843,14 +15656,7 @@ freebsd* | dragonfly*)
15843 15843
     *) objformat=elf ;;
15844 15844
     esac
15845 15845
   fi
15846
-  # Handle Gentoo/FreeBSD as it was Linux
15847
-  case $host_vendor in
15848
-    gentoo)
15849
-      version_type=linux ;;
15850
-    *)
15851
-      version_type=freebsd-$objformat ;;
15852
-  esac
15853
-
15846
+  version_type=freebsd-$objformat
15854 15847
   case $version_type in
15855 15848
     freebsd-elf*)
15856 15849
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
... ...
@@ -15861,12 +15667,6 @@ freebsd* | dragonfly*)
15861 15861
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
15862 15862
       need_version=yes
15863 15863
       ;;
15864
-    linux)
15865
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
15866
-      soname_spec='${libname}${release}${shared_ext}$major'
15867
-      need_lib_prefix=no
15868
-      need_version=no
15869
-      ;;
15870 15864
   esac
15871 15865
   shlibpath_var=LD_LIBRARY_PATH
15872 15866
   case $host_os in
... ...
@@ -16000,7 +15800,7 @@ linux*oldld* | linux*aout* | linux*coff*)
16000 16000
   ;;
16001 16001
 
16002 16002
 # This must be Linux ELF.
16003
-linux*)
16003
+linux* | k*bsd*-gnu)
16004 16004
   version_type=linux
16005 16005
   need_lib_prefix=no
16006 16006
   need_version=no
... ...
@@ -16029,7 +15829,7 @@ linux*)
16029 16029
   dynamic_linker='GNU/Linux ld.so'
16030 16030
   ;;
16031 16031
 
16032
-knetbsd*-gnu)
16032
+netbsdelf*-gnu)
16033 16033
   version_type=linux
16034 16034
   need_lib_prefix=no
16035 16035
   need_version=no
... ...
@@ -16038,7 +15838,7 @@ knetbsd*-gnu)
16038 16038
   shlibpath_var=LD_LIBRARY_PATH
16039 16039
   shlibpath_overrides_runpath=no
16040 16040
   hardcode_into_libs=yes
16041
-  dynamic_linker='GNU ld.so'
16041
+  dynamic_linker='NetBSD ld.elf_so'
16042 16042
   ;;
16043 16043
 
16044 16044
 netbsd*)
... ...
@@ -16771,11 +16571,11 @@ else
16771 16771
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
16772 16772
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
16773 16773
    -e 's:$: $lt_compiler_flag:'`
16774
-   (eval echo "\"\$as_me:16774: $lt_compile\"" >&5)
16774
+   (eval echo "\"\$as_me:16574: $lt_compile\"" >&5)
16775 16775
    (eval "$lt_compile" 2>conftest.err)
16776 16776
    ac_status=$?
16777 16777
    cat conftest.err >&5
16778
-   echo "$as_me:16778: \$? = $ac_status" >&5
16778
+   echo "$as_me:16578: \$? = $ac_status" >&5
16779 16779
    if (exit $ac_status) && test -s "$ac_outfile"; then
16780 16780
      # The compiler can only warn and ignore the option if not recognized
16781 16781
      # So say no if there are warnings other than the usual output.
... ...
@@ -16933,7 +16733,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
16933 16933
       lt_prog_compiler_static_GCJ='-Bstatic'
16934 16934
       ;;
16935 16935
 
16936
-    linux*)
16936
+    linux* | k*bsd*-gnu)
16937 16937
       case $cc_basename in
16938 16938
       icc* | ecc*)
16939 16939
 	lt_prog_compiler_wl_GCJ='-Wl,'
... ...
@@ -17039,11 +16839,11 @@ else
17039 17039
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
17040 17040
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17041 17041
    -e 's:$: $lt_compiler_flag:'`
17042
-   (eval echo "\"\$as_me:17042: $lt_compile\"" >&5)
17042
+   (eval echo "\"\$as_me:16842: $lt_compile\"" >&5)
17043 17043
    (eval "$lt_compile" 2>conftest.err)
17044 17044
    ac_status=$?
17045 17045
    cat conftest.err >&5
17046
-   echo "$as_me:17046: \$? = $ac_status" >&5
17046
+   echo "$as_me:16846: \$? = $ac_status" >&5
17047 17047
    if (exit $ac_status) && test -s "$ac_outfile"; then
17048 17048
      # The compiler can only warn and ignore the option if not recognized
17049 17049
      # So say no if there are warnings other than the usual output.
... ...
@@ -17143,11 +16943,11 @@ else
17143 17143
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
17144 17144
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
17145 17145
    -e 's:$: $lt_compiler_flag:'`
17146
-   (eval echo "\"\$as_me:17146: $lt_compile\"" >&5)
17146
+   (eval echo "\"\$as_me:16946: $lt_compile\"" >&5)
17147 17147
    (eval "$lt_compile" 2>out/conftest.err)
17148 17148
    ac_status=$?
17149 17149
    cat out/conftest.err >&5
17150
-   echo "$as_me:17150: \$? = $ac_status" >&5
17150
+   echo "$as_me:16950: \$? = $ac_status" >&5
17151 17151
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
17152 17152
    then
17153 17153
      # The compiler can only warn and ignore the option if not recognized
... ...
@@ -17372,7 +17172,7 @@ EOF
17372 17372
       archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
17373 17373
       ;;
17374 17374
 
17375
-    linux*)
17375
+    linux* | k*bsd*-gnu)
17376 17376
       if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
17377 17377
 	tmp_addflag=
17378 17378
 	case $cc_basename,$host_cpu in
... ...
@@ -17398,12 +17198,13 @@ EOF
17398 17398
   $echo "local: *; };" >> $output_objdir/$libname.ver~
17399 17399
 	  $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
17400 17400
 	fi
17401
+	link_all_deplibs_GCJ=no
17401 17402
       else
17402 17403
 	ld_shlibs_GCJ=no
17403 17404
       fi
17404 17405
       ;;
17405 17406
 
17406
-    netbsd*)
17407
+    netbsd* | netbsdelf*-gnu)
17407 17408
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
17408 17409
 	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
17409 17410
 	wlarc=
... ...
@@ -17657,7 +17458,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
17657 17657
 
17658 17658
 fi
17659 17659
 
17660
-rm -f core conftest.err conftest.$ac_objext \
17660
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17661 17661
       conftest$ac_exeext conftest.$ac_ext
17662 17662
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
17663 17663
 
... ...
@@ -17732,7 +17533,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
17732 17732
 
17733 17733
 fi
17734 17734
 
17735
-rm -f core conftest.err conftest.$ac_objext \
17735
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
17736 17736
       conftest$ac_exeext conftest.$ac_ext
17737 17737
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
17738 17738
 
... ...
@@ -17863,7 +17664,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
17863 17863
       ;;
17864 17864
 
17865 17865
     # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
17866
-    freebsd* | kfreebsd*-gnu | dragonfly*)
17866
+    freebsd* | dragonfly*)
17867 17867
       archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
17868 17868
       hardcode_libdir_flag_spec_GCJ='-R$libdir'
17869 17869
       hardcode_direct_GCJ=yes
... ...
@@ -17965,7 +17766,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
17965 17965
       link_all_deplibs_GCJ=yes
17966 17966
       ;;
17967 17967
 
17968
-    netbsd*)
17968
+    netbsd* | netbsdelf*-gnu)
17969 17969
       if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
17970 17970
 	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
17971 17971
       else
... ...
@@ -18414,30 +18215,6 @@ cygwin* | mingw* | pw32*)
18414 18414
     esac
18415 18415
     ;;
18416 18416
 
18417
-  linux*)
18418
-    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
18419
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
18420
-      supports_anon_versioning=no
18421
-      case `$LD -v 2>/dev/null` in
18422
-        *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
18423
-        *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
18424
-        *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
18425
-        *\ 2.11.*) ;; # other 2.11 versions
18426
-        *) supports_anon_versioning=yes ;;
18427
-      esac
18428
-      if test $supports_anon_versioning = yes; then
18429
-        archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
18430
-cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
18431
-$echo "local: *; };" >> $output_objdir/$libname.ver~
18432
-        $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
18433
-      else
18434
-        $archive_expsym_cmds="$archive_cmds"
18435
-      fi
18436
-    else
18437
-      ld_shlibs=no
18438
-    fi
18439
-    ;;
18440
-
18441 18417
   *)
18442 18418
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
18443 18419
     ;;
... ...
@@ -18479,18 +18256,6 @@ freebsd1*)
18479 18479
   dynamic_linker=no
18480 18480
   ;;
18481 18481
 
18482
-kfreebsd*-gnu)
18483
-  version_type=linux
18484
-  need_lib_prefix=no
18485
-  need_version=no
18486
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
18487
-  soname_spec='${libname}${release}${shared_ext}$major'
18488
-  shlibpath_var=LD_LIBRARY_PATH
18489
-  shlibpath_overrides_runpath=no
18490
-  hardcode_into_libs=yes
18491
-  dynamic_linker='GNU ld.so'
18492
-  ;;
18493
-
18494 18482
 freebsd* | dragonfly*)
18495 18483
   # DragonFly does not have aout.  When/if they implement a new
18496 18484
   # versioning mechanism, adjust this.
... ...
@@ -18502,14 +18267,7 @@ freebsd* | dragonfly*)
18502 18502
     *) objformat=elf ;;
18503 18503
     esac
18504 18504
   fi
18505
-  # Handle Gentoo/FreeBSD as it was Linux
18506
-  case $host_vendor in
18507
-    gentoo)
18508
-      version_type=linux ;;
18509
-    *)
18510
-      version_type=freebsd-$objformat ;;
18511
-  esac
18512
-
18505
+  version_type=freebsd-$objformat
18513 18506
   case $version_type in
18514 18507
     freebsd-elf*)
18515 18508
       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
... ...
@@ -18520,12 +18278,6 @@ freebsd* | dragonfly*)
18520 18520
       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
18521 18521
       need_version=yes
18522 18522
       ;;
18523
-    linux)
18524
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
18525
-      soname_spec='${libname}${release}${shared_ext}$major'
18526
-      need_lib_prefix=no
18527
-      need_version=no
18528
-      ;;
18529 18523
   esac
18530 18524
   shlibpath_var=LD_LIBRARY_PATH
18531 18525
   case $host_os in
... ...
@@ -18659,7 +18411,7 @@ linux*oldld* | linux*aout* | linux*coff*)
18659 18659
   ;;
18660 18660
 
18661 18661
 # This must be Linux ELF.
18662
-linux*)
18662
+linux* | k*bsd*-gnu)
18663 18663
   version_type=linux
18664 18664
   need_lib_prefix=no
18665 18665
   need_version=no
... ...
@@ -18688,7 +18440,7 @@ linux*)
18688 18688
   dynamic_linker='GNU/Linux ld.so'
18689 18689
   ;;
18690 18690
 
18691
-knetbsd*-gnu)
18691
+netbsdelf*-gnu)
18692 18692
   version_type=linux
18693 18693
   need_lib_prefix=no
18694 18694
   need_version=no
... ...
@@ -18697,7 +18449,7 @@ knetbsd*-gnu)
18697 18697
   shlibpath_var=LD_LIBRARY_PATH
18698 18698
   shlibpath_overrides_runpath=no
18699 18699
   hardcode_into_libs=yes
18700
-  dynamic_linker='GNU ld.so'
18700
+  dynamic_linker='NetBSD ld.elf_so'
18701 18701
   ;;
18702 18702
 
18703 18703
 netbsd*)
... ...
@@ -19905,12 +19657,6 @@ echo "${ECHO_T}no" >&6; }
19905 19905
 fi
19906 19906
 
19907 19907
 
19908
-if test ! -d "clam"; then
19909
-	ac_config_links="$ac_config_links clam:$srcdir/clam"
19910
-
19911
-fi
19912
-subdirs="$subdirs ./clam"
19913
-
19914 19908
 # Checks for libraries.
19915 19909
 
19916 19910
 
... ...
@@ -20129,7 +19875,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
20129 20129
         echo "*** the exact error that occured."
20130 20130
 fi
20131 20131
 
20132
-rm -f core conftest.err conftest.$ac_objext \
20132
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
20133 20133
       conftest$ac_exeext conftest.$ac_ext
20134 20134
 
20135 20135
         CFLAGS="$ac_save_CFLAGS"
... ...
@@ -20529,10 +20275,10 @@ main ()
20529 20529
 #ifndef __cplusplus
20530 20530
   /* Ultrix mips cc rejects this.  */
20531 20531
   typedef int charset[2];
20532
-  const charset x;
20532
+  const charset cs;
20533 20533
   /* SunOS 4.1.1 cc rejects this.  */
20534
-  char const *const *ccp;
20535
-  char **p;
20534
+  char const *const *pcpcc;
20535
+  char **ppc;
20536 20536
   /* NEC SVR4.0.2 mips cc rejects this.  */
20537 20537
   struct point {int x, y;};
20538 20538
   static struct point const zero = {0,0};
... ...
@@ -20541,11 +20287,11 @@ main ()
20541 20541
      an arm of an if-expression whose if-part is not a constant
20542 20542
      expression */
20543 20543
   const char *g = "string";
20544
-  ccp = &g + (g ? g-g : 0);
20544
+  pcpcc = &g + (g ? g-g : 0);
20545 20545
   /* HPUX 7.0 cc rejects these. */
20546
-  ++ccp;
20547
-  p = (char**) ccp;
20548
-  ccp = (char const *const *) p;
20546
+  ++pcpcc;
20547
+  ppc = (char**) pcpcc;
20548
+  pcpcc = (char const *const *) ppc;
20549 20549
   { /* SCO 3.2v4 cc rejects this.  */
20550 20550
     char *t;
20551 20551
     char const *s = 0 ? (char *) 0 : (char const *) 0;
... ...
@@ -20572,7 +20318,7 @@ main ()
20572 20572
     const int foo = 10;
20573 20573
     if (!foo) return 0;
20574 20574
   }
20575
-  return !x[0] && !zero.x;
20575
+  return !cs[0] && !zero.x;
20576 20576
 #endif
20577 20577
 
20578 20578
   ;
... ...
@@ -20637,7 +20383,7 @@ fi
20637 20637
 # Checks for library functions.
20638 20638
 
20639 20639
 cat >>confdefs.h <<_ACEOF
20640
-#define REGEXTEST_FILE "$srcdir/regex_test.txt"
20640
+#define REGEXTEST_FILE "$srcdir/regex_test.pdb"
20641 20641
 _ACEOF
20642 20642
 
20643 20643
 ac_config_files="$ac_config_files Makefile"
... ...
@@ -21047,7 +20793,7 @@ exec 6>&1
21047 21047
 # values after options handling.
21048 21048
 ac_log="
21049 21049
 This file was extended by $as_me, which was
21050
-generated by GNU Autoconf 2.60.  Invocation command line was
21050
+generated by GNU Autoconf 2.60a.  Invocation command line was
21051 21051
 
21052 21052
   CONFIG_FILES    = $CONFIG_FILES
21053 21053
   CONFIG_HEADERS  = $CONFIG_HEADERS
... ...
@@ -21064,7 +20810,6 @@ cat >>$CONFIG_STATUS <<_ACEOF
21064 21064
 # Files that config.status was made for.
21065 21065
 config_files="$ac_config_files"
21066 21066
 config_headers="$ac_config_headers"
21067
-config_links="$ac_config_links"
21068 21067
 config_commands="$ac_config_commands"
21069 21068
 
21070 21069
 _ACEOF
... ...
@@ -21077,7 +20822,7 @@ current configuration.
21077 21077
 Usage: $0 [OPTIONS] [FILE]...
21078 21078
 
21079 21079
   -h, --help       print this help, then exit
21080
-  -V, --version    print version number, then exit
21080
+  -V, --version    print version number and configuration settings, then exit
21081 21081
   -q, --quiet      do not print progress messages
21082 21082
   -d, --debug      don't remove temporary files
21083 21083
       --recheck    update $as_me by reconfiguring in the same conditions
... ...
@@ -21092,9 +20837,6 @@ $config_files
21092 21092
 Configuration headers:
21093 21093
 $config_headers
21094 21094
 
21095
-Configuration links:
21096
-$config_links
21097
-
21098 21095
 Configuration commands:
21099 21096
 $config_commands
21100 21097
 
... ...
@@ -21104,7 +20846,7 @@ _ACEOF
21104 21104
 cat >>$CONFIG_STATUS <<_ACEOF
21105 21105
 ac_cs_version="\\
21106 21106
 config.status
21107
-configured by $0, generated by GNU Autoconf 2.60,
21107
+configured by $0, generated by GNU Autoconf 2.60a,
21108 21108
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
21109 21109
 
21110 21110
 Copyright (C) 2006 Free Software Foundation, Inc.
... ...
@@ -21218,7 +20960,6 @@ do
21218 21218
   case $ac_config_target in
21219 21219
     "test-config.h") CONFIG_HEADERS="$CONFIG_HEADERS test-config.h" ;;
21220 21220
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
21221
-    "clam") CONFIG_LINKS="$CONFIG_LINKS clam:$srcdir/clam" ;;
21222 21221
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
21223 21222
 
21224 21223
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
... ...
@@ -21235,7 +20976,6 @@ done
21235 21235
 if $ac_need_defaults; then
21236 21236
   test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
21237 21237
   test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
21238
-  test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links
21239 21238
   test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
21240 21239
 fi
21241 21240
 
... ...
@@ -21424,14 +21164,13 @@ for ac_last_try in false false false false false :; do
21424 21424
 FFLAGS!$FFLAGS$ac_delim
21425 21425
 ac_ct_F77!$ac_ct_F77$ac_delim
21426 21426
 LIBTOOL!$LIBTOOL$ac_delim
21427
-subdirs!$subdirs$ac_delim
21428 21427
 CHECK_CFLAGS!$CHECK_CFLAGS$ac_delim
21429 21428
 CHECK_LIBS!$CHECK_LIBS$ac_delim
21430 21429
 LIBOBJS!$LIBOBJS$ac_delim
21431 21430
 LTLIBOBJS!$LTLIBOBJS$ac_delim
21432 21431
 _ACEOF
21433 21432
 
21434
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 8; then
21433
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 7; then
21435 21434
     break
21436 21435
   elif $ac_last_try; then
21437 21436
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
... ...
@@ -21488,7 +21227,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF
21488 21488
 fi # test -n "$CONFIG_FILES"
21489 21489
 
21490 21490
 
21491
-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS  :L $CONFIG_LINKS  :C $CONFIG_COMMANDS
21491
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
21492 21492
 do
21493 21493
   case $ac_tag in
21494 21494
   :[FHLC]) ac_mode=$ac_tag; continue;;
... ...
@@ -21859,33 +21598,7 @@ echo X$ac_file |
21859 21859
 	  }
21860 21860
 	  s/.*/./; q'`/stamp-h$_am_stamp_count
21861 21861
  ;;
21862
-  :L)
21863
-  #
21864
-  # CONFIG_LINK
21865
-  #
21866
-
21867
-  { echo "$as_me:$LINENO: linking $srcdir/$ac_source to $ac_file" >&5
21868
-echo "$as_me: linking $srcdir/$ac_source to $ac_file" >&6;}
21869 21862
 
21870
-  if test ! -r "$srcdir/$ac_source"; then
21871
-    { { echo "$as_me:$LINENO: error: $srcdir/$ac_source: file not found" >&5
21872
-echo "$as_me: error: $srcdir/$ac_source: file not found" >&2;}
21873
-   { (exit 1); exit 1; }; }
21874
-  fi
21875
-  rm -f "$ac_file"
21876
-
21877
-  # Try a relative symlink, then a hard link, then a copy.
21878
-  case $srcdir in
21879
-  [\\/$]* | ?:[\\/]* ) ac_rel_source=$srcdir/$ac_source ;;
21880
-      *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;;
21881
-  esac
21882
-  ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
21883
-    ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null ||
21884
-    cp -p "$srcdir/$ac_source" "$ac_file" ||
21885
-    { { echo "$as_me:$LINENO: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&5
21886
-echo "$as_me: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&2;}
21887
-   { (exit 1); exit 1; }; }
21888
- ;;
21889 21863
   :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
21890 21864
 echo "$as_me: executing $ac_file commands" >&6;}
21891 21865
  ;;
... ...
@@ -22048,178 +21761,3 @@ if test "$no_create" != yes; then
22048 22048
   $ac_cs_success || { (exit 1); exit 1; }
22049 22049
 fi
22050 22050
 
22051
-#
22052
-# CONFIG_SUBDIRS section.
22053
-#
22054
-if test "$no_recursion" != yes; then
22055
-
22056
-  # Remove --cache-file and --srcdir arguments so they do not pile up.
22057
-  ac_sub_configure_args=
22058
-  ac_prev=
22059
-  eval "set x $ac_configure_args"
22060
-  shift
22061
-  for ac_arg
22062
-  do
22063
-    if test -n "$ac_prev"; then
22064
-      ac_prev=
22065
-      continue
22066
-    fi
22067
-    case $ac_arg in
22068
-    -cache-file | --cache-file | --cache-fil | --cache-fi \
22069
-    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
22070
-      ac_prev=cache_file ;;
22071
-    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
22072
-    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
22073
-    | --c=*)
22074
-      ;;
22075
-    --config-cache | -C)
22076
-      ;;
22077
-    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
22078
-      ac_prev=srcdir ;;
22079
-    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
22080
-      ;;
22081
-    -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
22082
-      ac_prev=prefix ;;
22083
-    -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
22084
-      ;;
22085
-    *)
22086
-      case $ac_arg in
22087
-      *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
22088
-      esac
22089
-      ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
22090
-    esac
22091
-  done
22092
-
22093
-  # Always prepend --prefix to ensure using the same prefix
22094
-  # in subdir configurations.
22095
-  ac_arg="--prefix=$prefix"
22096
-  case $ac_arg in
22097
-  *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
22098
-  esac
22099
-  ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
22100
-
22101
-  ac_popdir=`pwd`
22102
-  for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
22103
-
22104
-    # Do not complain, so a configure script can configure whichever
22105
-    # parts of a large source tree are present.
22106
-    test -d "$srcdir/$ac_dir" || continue
22107
-
22108
-    ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
22109
-    echo "$as_me:$LINENO: $ac_msg" >&5
22110
-    echo "$ac_msg" >&6
22111
-    { as_dir="$ac_dir"
22112
-  case $as_dir in #(
22113
-  -*) as_dir=./$as_dir;;
22114
-  esac
22115
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
22116
-    as_dirs=
22117
-    while :; do
22118
-      case $as_dir in #(
22119
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
22120
-      *) as_qdir=$as_dir;;
22121
-      esac
22122
-      as_dirs="'$as_qdir' $as_dirs"
22123
-      as_dir=`$as_dirname -- "$as_dir" ||
22124
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
22125
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
22126
-	 X"$as_dir" : 'X\(//\)$' \| \
22127
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
22128
-echo X"$as_dir" |
22129
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
22130
-	    s//\1/
22131
-	    q
22132
-	  }
22133
-	  /^X\(\/\/\)[^/].*/{
22134
-	    s//\1/
22135
-	    q
22136
-	  }
22137
-	  /^X\(\/\/\)$/{
22138
-	    s//\1/
22139
-	    q
22140
-	  }
22141
-	  /^X\(\/\).*/{
22142
-	    s//\1/
22143
-	    q
22144
-	  }
22145
-	  s/.*/./; q'`
22146
-      test -d "$as_dir" && break
22147
-    done
22148
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
22149
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
22150
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
22151
-   { (exit 1); exit 1; }; }; }
22152
-    ac_builddir=.
22153
-
22154
-case "$ac_dir" in
22155
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
22156
-*)
22157
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
22158
-  # A ".." for each directory in $ac_dir_suffix.
22159
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
22160
-  case $ac_top_builddir_sub in
22161
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
22162
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
22163
-  esac ;;
22164
-esac
22165
-ac_abs_top_builddir=$ac_pwd
22166
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
22167
-# for backward compatibility:
22168
-ac_top_builddir=$ac_top_build_prefix
22169
-
22170
-case $srcdir in
22171
-  .)  # We are building in place.
22172
-    ac_srcdir=.
22173
-    ac_top_srcdir=$ac_top_builddir_sub
22174
-    ac_abs_top_srcdir=$ac_pwd ;;
22175
-  [\\/]* | ?:[\\/]* )  # Absolute name.
22176
-    ac_srcdir=$srcdir$ac_dir_suffix;
22177
-    ac_top_srcdir=$srcdir
22178
-    ac_abs_top_srcdir=$srcdir ;;
22179
-  *) # Relative name.
22180
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
22181
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
22182
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
22183
-esac
22184
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
22185
-
22186
-
22187
-    cd "$ac_dir"
22188
-
22189
-    # Check for guested configure; otherwise get Cygnus style configure.
22190
-    if test -f "$ac_srcdir/configure.gnu"; then
22191
-      ac_sub_configure=$ac_srcdir/configure.gnu
22192
-    elif test -f "$ac_srcdir/configure"; then
22193
-      ac_sub_configure=$ac_srcdir/configure
22194
-    elif test -f "$ac_srcdir/configure.in"; then
22195
-      # This should be Cygnus configure.
22196
-      ac_sub_configure=$ac_aux_dir/configure
22197
-    else
22198
-      { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
22199
-echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
22200
-      ac_sub_configure=
22201
-    fi
22202
-
22203
-    # The recursion is here.
22204
-    if test -n "$ac_sub_configure"; then
22205
-      # Make the cache file name correct relative to the subdirectory.
22206
-      case $cache_file in
22207
-      [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
22208
-      *) # Relative name.
22209
-	ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
22210
-      esac
22211
-
22212
-      { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
22213
-echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
22214
-      # The eval makes quoting arguments work.
22215
-      eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
22216
-	   --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
22217
-	{ { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
22218
-echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
22219
-   { (exit 1); exit 1; }; }
22220
-    fi
22221
-
22222
-    cd "$ac_popdir"
22223
-  done
22224
-fi
22225
-
... ...
@@ -2,7 +2,7 @@
2 2
 # Process this file with autoconf to produce a configure script.
3 3
 
4 4
 AC_PREREQ(2.60)
5
-AC_INIT()
5
+AC_INIT
6 6
 AC_CONFIG_SRCDIR([regex_list_test.c])
7 7
 AC_CONFIG_HEADER([test-config.h])
8 8
 AM_INIT_AUTOMAKE(phishtest,"`date +%Y%m%d`")
... ...
@@ -13,10 +13,6 @@ AC_PROG_LN_S
13 13
 AC_PROG_LIBTOOL
14 14
 AC_PROG_MAKE_SET
15 15
 
16
-if test ! -d "clam"; then
17
-	AC_CONFIG_LINKS([clam:$srcdir/clam])
18
-fi
19
-AC_CONFIG_SUBDIRS([./clam])
20 16
 # Checks for libraries.
21 17
 AM_PATH_CHECK()
22 18
 # Checks for header files.
... ...
@@ -27,6 +23,6 @@ AC_CHECK_HEADERS([stdlib.h])
27 27
 AC_C_CONST
28 28
 
29 29
 # Checks for library functions.
30
-AC_DEFINE_UNQUOTED(REGEXTEST_FILE,"$srcdir/regex_test.txt",[location of test file])
30
+AC_DEFINE_UNQUOTED(REGEXTEST_FILE,"$srcdir/regex_test.pdb",[location of test file])
31 31
 AC_CONFIG_FILES([Makefile])
32 32
 AC_OUTPUT
... ...
@@ -33,9 +33,6 @@ basename="s,^.*/,,g"
33 33
 # function.
34 34
 progpath="$0"
35 35
 
36
-# define SED for historic ltconfig's generated by Libtool 1.3
37
-test -z "$SED" && SED=sed
38
-
39 36
 # The name of this program:
40 37
 progname=`echo "$progpath" | $SED $basename`
41 38
 modename="$progname"
... ...
@@ -46,7 +43,7 @@ EXIT_FAILURE=1
46 46
 
47 47
 PROGRAM=ltmain.sh
48 48
 PACKAGE=libtool
49
-VERSION=1.5.22
49
+VERSION="1.5.22 Debian 1.5.22-4"
50 50
 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
51 51
 
52 52
 # See if we are running on zsh, and set the options which allow our
... ...
@@ -54,13 +51,6 @@ TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
54 54
 if test -n "${ZSH_VERSION+set}" ; then
55 55
   setopt NO_GLOB_SUBST
56 56
 fi
57
-# Same for EGREP, and just to be sure, do LTCC as well
58
-if test "X$EGREP" = X ; then
59
-    EGREP=egrep
60
-fi
61
-if test "X$LTCC" = X ; then
62
-    LTCC=${CC-gcc}
63
-fi
64 57
 
65 58
 # Check that we have a working $echo.
66 59
 if test "X$1" = X--no-reexec; then
... ...
@@ -147,30 +137,6 @@ preserve_args=
147 147
 lo2o="s/\\.lo\$/.${objext}/"
148 148
 o2lo="s/\\.${objext}\$/.lo/"
149 149
 
150
-if test -z "$max_cmd_len"; then
151
-  i=0
152
-  testring="ABCD"
153
-  new_result=
154
-  
155
-  # If test is not a shell built-in, we'll probably end up computing a
156
-  # maximum length that is only half of the actual maximum length, but
157
-  # we can't tell.
158
-  while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
159
-             = "XX$testring") >/dev/null 2>&1 &&
160
-          new_result=`expr "X$testring" : ".*" 2>&1` &&
161
-          max_cmd_len="$new_result" &&
162
-          test "$i" != 17 # 1/2 MB should be enough
163
-  do
164
-    i=`expr $i + 1`
165
-    testring="$testring$testring"
166
-  done
167
-  testring=
168
-  # Add a significant safety factor because C++ compilers can tack on massive
169
-  # amounts of additional arguments before passing them to the linker.
170
-  # It appears as though 1/2 is a usable value.
171
-  max_cmd_len=`expr $max_cmd_len \/ 2`
172
-fi
173
-
174 150
 #####################################
175 151
 # Shell function definitions:
176 152
 # This seems to be the best place for them
... ...
@@ -291,21 +257,7 @@ func_infer_tag ()
291 291
 	    esac
292 292
 	    CC_quoted="$CC_quoted $arg"
293 293
 	  done
294
-	    # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
295
-	    trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
296
-	    # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
297
-	    extendcc=${host}-${CC}
298
-	    # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc  
299
-	    # (Gentoo-specific hack because we always export $CHOST)
300
-	    mungedcc=${CHOST-${host}}-${trimedcc}
301 294
 	    case "$@ " in
302
-	      "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
303
-	      "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
304
-	      tagname=CC
305
-	      break ;;
306
-	      "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
307
-	      "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
308
-	      "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
309 295
 	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
310 296
 	      # The compiler in the base compile command matches
311 297
 	      # the one in the tagged configuration.
... ...
@@ -899,7 +851,7 @@ if test -z "$show_help"; then
899 899
     # Lock this critical section if it is needed
900 900
     # We use this script file to make the link, it avoids creating a new file
901 901
     if test "$need_locks" = yes; then
902
-      until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
902
+      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
903 903
 	$show "Waiting for $lockfile to be removed"
904 904
 	sleep 2
905 905
       done
... ...
@@ -2130,7 +2082,10 @@ EOF
2130 2130
 	case $pass in
2131 2131
 	dlopen) libs="$dlfiles" ;;
2132 2132
 	dlpreopen) libs="$dlprefiles" ;;
2133
-	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2133
+	link)
2134
+	  libs="$deplibs %DEPLIBS%"
2135
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
2136
+	  ;;
2134 2137
 	esac
2135 2138
       fi
2136 2139
       if test "$pass" = dlopen; then
... ...
@@ -3249,6 +3204,11 @@ EOF
3249 3249
 	    age="$number_minor"
3250 3250
 	    revision="$number_minor"
3251 3251
 	    ;;
3252
+	  *)
3253
+	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
3254
+	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3255
+	    exit $EXIT_FAILURE
3256
+	    ;;
3252 3257
 	  esac
3253 3258
 	  ;;
3254 3259
 	no)
... ...
@@ -3690,13 +3650,6 @@ EOF
3690 3690
 			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3691 3691
 			esac
3692 3692
 		      done
3693
-		      # It is ok to link against an archive when
3694
-		      # building a shared library.
3695
-		      if $AR -t $potlib > /dev/null 2>&1; then
3696
-		        newdeplibs="$newdeplibs $a_deplib"
3697
-		        a_deplib=""
3698
-		        break 2
3699
-		      fi
3700 3693
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3701 3694
 			 | ${SED} 10q \
3702 3695
 			 | $EGREP "$file_magic_regex" > /dev/null; then
... ...
@@ -5434,11 +5387,6 @@ else
5434 5434
 	$echo >> $output "\
5435 5435
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
5436 5436
       # Run the actual program with our arguments.
5437
-
5438
-      # Make sure env LD_LIBRARY_PATH does not mess us up
5439
-      if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5440
-        export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5441
-      fi
5442 5437
 "
5443 5438
 	case $host in
5444 5439
 	# Backslashes separate directories on plain windows
... ...
@@ -5666,53 +5614,9 @@ fi\
5666 5666
 		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5667 5667
 		  exit $EXIT_FAILURE
5668 5668
 		fi
5669
-		if test "X$EGREP" = X ; then
5670
-			EGREP=egrep
5671
-		fi
5672
-		# We do not want portage's install root ($D) present.  Check only for
5673
-		# this if the .la is being installed.
5674
-		if test "$installed" = yes && test "$D"; then
5675
-		  eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5676
-		else
5677
-		  mynewdependency_lib="$libdir/$name"
5678
-		fi
5679
-		# Do not add duplicates
5680
-		if test "$mynewdependency_lib"; then
5681
-		  my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5682
-		  if test -z "$my_little_ninja_foo_1"; then
5683
-		    newdependency_libs="$newdependency_libs $mynewdependency_lib"
5684
-		  fi
5685
-		fi
5686
-		;;
5687
-		  *)
5688
-		if test "$installed" = yes; then
5689
-		  # Rather use S=WORKDIR if our version of portage supports it.
5690
-		  # This is because some ebuild (gcc) do not use $S as buildroot.
5691
-		  if test "$PWORKDIR"; then
5692
-		    S="$PWORKDIR"
5693
-		  fi
5694
-		  # We do not want portage's build root ($S) present.
5695
-		  my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5696
-		  # We do not want portage's install root ($D) present.
5697
-		  my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5698
-		  if test -n "$my_little_ninja_foo_2" && test "$S"; then
5699
-		    mynewdependency_lib=""
5700
-		  elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5701
-		    eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5702
-		  else
5703
-		    mynewdependency_lib="$deplib"
5704
-		  fi
5705
-		else
5706
-		  mynewdependency_lib="$deplib"
5707
-		fi
5708
-		# Do not add duplicates
5709
-		if test "$mynewdependency_lib"; then
5710
-		  my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5711
-		  if test -z "$my_little_ninja_foo_4"; then
5712
-			newdependency_libs="$newdependency_libs $mynewdependency_lib"
5713
-		  fi
5714
-		fi
5669
+		newdependency_libs="$newdependency_libs $libdir/$name"
5715 5670
 		;;
5671
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
5716 5672
 	      esac
5717 5673
 	    done
5718 5674
 	    dependency_libs="$newdependency_libs"
... ...
@@ -5764,10 +5668,6 @@ fi\
5764 5764
 	  case $host,$output,$installed,$module,$dlname in
5765 5765
 	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5766 5766
 	  esac
5767
-	  # Do not add duplicates
5768
-	  if test "$installed" = yes && test "$D"; then
5769
-	    install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5770
-	  fi
5771 5767
 	  $echo > $output "\
5772 5768
 # $outputname - a libtool library file
5773 5769
 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
... ...
@@ -24,6 +24,8 @@
24 24
 #include <stdio.h>
25 25
 #include <check.h>
26 26
 #include <test-config.h>
27
+#include <clamav.h>
28
+#include <clamav-config.h>
27 29
 #include "pdomain.h"
28 30
 #include <phish_domaincheck_db.h>
29 31
 #define FULLFLAG 0xFFFF
... ...
@@ -51,20 +53,23 @@ static struct regex_list_test {
51 51
 };
52 52
 /*static int regex_list_tests_cnt = sizeof(regex_list_tests)/sizeof(regex_list_tests[0]);*/
53 53
 static int regex_list_tests_i=-1;
54
+static struct cl_engine* engine;
54 55
 
55 56
 static void regex_list_tests_setup(void)
56 57
 {
57
-	FILE* f = fopen(REGEXTEST_FILE,"r");
58
-	fail_unless(f!=NULL);
59
-	cli_loadpdb(f,0);
60
-	fclose(f);
61
-	fail_unless(is_domainlist_ok());
58
+	int rc;
59
+	unsigned int signo;
60
+	engine=NULL;
61
+	rc = cl_loaddb(REGEXTEST_FILE,&engine,&signo);
62
+	fail_unless(rc==0,cl_strerror(rc));
63
+	fail_unless(is_domainlist_ok(engine));
62 64
 	regex_list_tests_i=0;
63 65
 }
64 66
 
65 67
 static void regex_list_tests_teardown(void)
66 68
 {
67
-	domainlist_done();
69
+	cl_free(engine);
70
+	engine=NULL;
68 71
 }
69 72
 
70 73
 
... ...
@@ -72,8 +77,8 @@ static int regex_list_test_function(const char* input1,const char* input2,const
72 72
 {
73 73
 	unsigned short flags=FULLFLAG;
74 74
 	int rc;
75
-	fail_unless(is_domainlist_ok());
76
-	rc = domainlist_match(input1,input2,0,&flags);
75
+	fail_unless(is_domainlist_ok(engine));
76
+	rc = domainlist_match(engine,input1,input2,0,&flags);
77 77
 	fail_unless(flags == flag_expected);
78 78
 	return rc;
79 79
 }
... ...
@@ -24,6 +24,7 @@
24 24
 #include <stdio.h>
25 25
 #include <check.h>
26 26
 #include <test-config.h>
27
+#include <clamav-config.h>
27 28
 #include "regex_list_test.h"
28 29
 #include <regex_list.h>
29 30
 static struct regex_list_test {
... ...
@@ -44,7 +45,23 @@ static struct regex_list_test {
44 44
 	{"http://ae.f.net","jj",1},
45 45
 	{"http://cb.f.com","jj",0},
46 46
 	{"http://abcf","jj",0},
47
-	{"virus.zip","viiirii.zip",0}
47
+	{"virus.zip","viiirii.zip",0},
48
+	{"http://testalnum_m","jj",0},
49
+	{"http://testalnum0m","jj",1},
50
+	{"http://testalnumAm","jj",1},
51
+	{"http://testalnumzm","jj",1},
52
+	{"http://testdig9m","jj",1},
53
+	{"http://testdigam","jj",0},	
54
+	{"http://testdigAm","jj",0},
55
+	{"http://testpAm","jj",0},
56
+	{"http://testp m","jj",0},
57
+	{"http://testpzm","jj",0},
58
+	{"http://testpZm","jj",0},
59
+	{"http://testp,m","jj",1},
60
+	{"http://testpzm","jj",0},	
61
+	/*TODO: alpha, graph, space, blank, lower, upper, cntrl, print, xdigit */
62
+	{"http://testing\tme","jj",1},
63
+	{"http://testing\\tme","jj",0}
48 64
 };
49 65
 /*static int regex_list_tests_cnt = sizeof(regex_list_tests)/sizeof(regex_list_tests[0]);*/
50 66
 static int regex_list_tests_i=-1;
... ...
@@ -24,7 +24,6 @@
24 24
 #include <check.h>
25 25
 #include "urltest.h"
26 26
 #include "regex_list_test.h"
27
-#include "pdomain.h"
28 27
 
29 28
 static Suite* create_suite(void)
30 29
 {
... ...
@@ -34,19 +34,21 @@ static struct url_test {
34 34
 /*static int url_tests_cnt = sizeof(url_tests)/sizeof(url_tests[0]);*/
35 35
 static int url_tests_i=-1;
36 36
 
37
+struct cl_engine engine;
37 38
 static void url_tests_setup(void)
38 39
 {
39
-		url_tests_i=0;
40
+	phishing_init(&engine);
41
+	url_tests_i=0;
40 42
 }
41 43
 
42 44
 static void url_tests_teardown(void)
43 45
 {
44
-	phishing_done();
46
+	phishing_done(&engine);
45 47
 }
46 48
 
47 49
 static int url_test_function(const char* input)
48 50
 {
49
-	return isURL(input);
51
+	return isURL(engine.phishcheck,input);
50 52
 }
51 53
 
52 54
 START_TEST(url_test_create)
... ...
@@ -184,6 +184,7 @@ struct cl_engine {
184 184
     /* Phishing .pdb and .wdb databases*/
185 185
     void *whitelist_matcher;
186 186
     void *domainlist_matcher;
187
+    void *phishcheck;
187 188
 };
188 189
 
189 190
 struct cl_limits {
... ...
@@ -997,8 +997,11 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
997 997
 #ifdef CL_EXPERIMENTAL
998 998
 					} else if (strcmp(tag,"form") == 0 && hrefs->scanContents) {
999 999
 						const unsigned char* arg_action_value = html_tag_arg_value(&tag_args,"action");
1000
-						if (arg_action_value)
1000
+						if (arg_action_value) {
1001
+							if(in_form_action) 
1002
+								free(in_form_action);							
1001 1003
 							in_form_action = strdup(arg_action_value);
1004
+						}
1002 1005
 #endif
1003 1006
 					} else if (strcmp(tag, "img") == 0) {
1004 1007
 						arg_value = html_tag_arg_value(&tag_args, "src");
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: phish_domaincheck_db.c,v $
22
+ *  Revision 1.5  2006/10/10 23:51:49  tkojm
23
+ *  apply patches for the anti-phish code from Edwin
24
+ *
22 25
  *  Revision 1.4  2006/10/07 13:55:01  tkojm
23 26
  *  fix handlers
24 27
  *
... ...
@@ -48,7 +51,6 @@
48 48
  *
49 49
  */
50 50
 
51
-
52 51
 #if HAVE_CONFIG_H
53 52
 #include "clamav-config.h"
54 53
 #endif
... ...
@@ -68,7 +70,6 @@
68 68
 #include <stdio.h>
69 69
 #include <stdlib.h>
70 70
 #include <errno.h>
71
-#include <assert.h>
72 71
 #include <string.h>
73 72
 #ifdef	HAVE_STRINGS_H
74 73
 #include <strings.h>
... ...
@@ -100,7 +101,7 @@
100 100
 int domainlist_match(const struct cl_engine* engine,const char* real_url,const char* display_url,int hostOnly,unsigned short* flags)
101 101
 {
102 102
 	const char* info;
103
-	int rc = engine->domainlist_matcher ? regex_list_match(engine->domainlist_matcher,real_url,display_url,hostOnly,&info) : 0;
103
+	int rc = engine->domainlist_matcher ? regex_list_match(engine->domainlist_matcher,real_url,display_url,hostOnly,&info,0) : 0;
104 104
 	if(rc && info && info[0]) {/*match successfull, and has custom flags*/
105 105
 		if(strlen(info)==3 && isxdigit(info[0]) && isxdigit(info[1]) && isxdigit(info[2])) {
106 106
 			unsigned short notwantedflags=0;
... ...
@@ -121,7 +122,7 @@ int init_domainlist(struct cl_engine* engine)
121 121
 		if(!engine->domainlist_matcher)
122 122
 			return CL_EMEM;
123 123
 		return init_regex_list(engine->domainlist_matcher);
124
-}
124
+	}
125 125
 	else
126 126
 		return CL_ENULLARG;
127 127
 }
... ...
@@ -131,7 +132,6 @@ int is_domainlist_ok(const struct cl_engine* engine)
131 131
 	return (engine && engine->domainlist_matcher) ? is_regex_ok(engine->domainlist_matcher) : 1;
132 132
 }
133 133
 
134
-
135 134
 void domainlist_cleanup(const struct cl_engine* engine)
136 135
 {
137 136
 	if(engine && engine->domainlist_matcher) {
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: phish_whitelist.c,v $
22
+ *  Revision 1.6  2006/10/10 23:51:49  tkojm
23
+ *  apply patches for the anti-phish code from Edwin
24
+ *
22 25
  *  Revision 1.5  2006/10/07 13:55:01  tkojm
23 26
  *  fix handlers
24 27
  *
... ...
@@ -70,7 +73,6 @@
70 70
 #include <stdio.h>
71 71
 #include <stdlib.h>
72 72
 #include <errno.h>
73
-#include <assert.h>
74 73
 #include <string.h>
75 74
 #ifdef	HAVE_STRINGS_H
76 75
 #include <strings.h>
... ...
@@ -102,7 +104,7 @@
102 102
 int whitelist_match(const struct cl_engine* engine,const char* real_url,const char* display_url,int hostOnly)
103 103
 {
104 104
 	const char* info;/*unused*/
105
-	return	engine->whitelist_matcher ? regex_list_match(engine->whitelist_matcher,real_url,display_url,hostOnly,&info) : 0;
105
+	return	engine->whitelist_matcher ? regex_list_match(engine->whitelist_matcher,real_url,display_url,hostOnly,&info,1) : 0;
106 106
 }
107 107
 
108 108
 int init_whitelist(struct cl_engine* engine)
... ...
@@ -112,7 +114,7 @@ int init_whitelist(struct cl_engine* engine)
112 112
 		if(!engine->whitelist_matcher)
113 113
 			return CL_EMEM;
114 114
 		return	init_regex_list(engine->whitelist_matcher);
115
-}
115
+	}
116 116
 	else
117 117
 		return CL_ENULLARG;
118 118
 }
... ...
@@ -122,7 +124,6 @@ int is_whitelist_ok(const struct cl_engine* engine)
122 122
 	return (engine && engine->whitelist_matcher) ? is_regex_ok(engine->whitelist_matcher) : 1;
123 123
 }
124 124
 
125
-
126 125
 void whitelist_cleanup(const struct cl_engine* engine)
127 126
 {
128 127
 	if(engine && engine->whitelist_matcher) {
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: phishcheck.c,v $
22
+ *  Revision 1.13  2006/10/10 23:51:49  tkojm
23
+ *  apply patches for the anti-phish code from Edwin
24
+ *
22 25
  *  Revision 1.12  2006/10/08 18:55:15  tkojm
23 26
  *  fix crash in phishing code on database reload (Edvin Torok)
24 27
  *
... ...
@@ -128,7 +131,6 @@ case CL_PHISH_HOST_NOT_LISTED:
128 128
 #include <stdio.h>
129 129
 #include <stdlib.h>
130 130
 #include <errno.h>
131
-#include <assert.h>
132 131
 #include <string.h>
133 132
 #ifdef	HAVE_STRINGS_H
134 133
 #include <strings.h>
... ...
@@ -164,6 +166,7 @@ case CL_PHISH_HOST_NOT_LISTED:
164 164
 #include "phishcheck.h"
165 165
 #include "phish_whitelist.h"
166 166
 #include "phish_domaincheck_db.h"
167
+#include "regex_list.h"
167 168
 #include "iana_tld.h"
168 169
 
169 170
 #define DOMAIN_REAL 1
... ...
@@ -178,7 +181,6 @@ case CL_PHISH_HOST_NOT_LISTED:
178 178
 #define PHISHY_CLOAKED_NULL	16
179 179
 #define PHISHY_HEX_URL		32
180 180
 
181
-
182 181
 /*
183 182
 * Phishing design documentation,
184 183
 (initially written at http://wiki.clamav.net/index.php/phishing_design as discussed with aCaB)
... ...
@@ -254,11 +256,105 @@ if not -> clean
254 254
 For the Whitelist(.wdb)/Domainlist(.pdb) format see regex_list.c (search for Flags)
255 255
  *
256 256
  */
257
+
258
+/* Constant strings and tables */ 
257 259
 static char empty_string[]="";
260
+static const char tld_regex[] = "^"iana_tld"$";
261
+static const char cctld_regex[] = "^"iana_cctld"$";
262
+static const char dotnet[] = ".net";
263
+static const char adonet[] = "ado.net";
264
+static const char aspnet[] = "asp.net";
265
+static const char lt[]="&lt;";
266
+static const char gt[]="&gt;";
267
+static const size_t dotnet_len = sizeof(dotnet)-1;
268
+static const size_t adonet_len = sizeof(adonet)-1;
269
+static const size_t aspnet_len = sizeof(aspnet)-1;
270
+static const size_t lt_len = sizeof(lt)-1;
271
+static const size_t gt_len = sizeof(gt)-1;
272
+
273
+/*static const char* url_regex="^ *([[:alnum:]%_-]+:(//)?)?([[:alnum:]%_-]@)*[[:alnum:]%_-]+\\.([[:alnum:]%_-]+\\.)*[[:alnum:]_%-]+(/[[:alnum:];:@$=?&/.,%_-]+) *$";*/
274
+/* for urls, including mailto: urls, and (broken) http:www... style urls*/
275
+/* refer to: http://www.w3.org/Addressing/URL/5_URI_BNF.html
276
+ * Modifications: don't allow empty domains/subdomains, such as www..com <- that is no url
277
+ * So the 'safe' char class has been split up
278
+ * */
279
+/* character classes */
280
+#define URI_alpha	"a-zA-Z"
281
+#define URI_digit	"0-9"
282
+#define URI_safe_nodot  "-$_@&"
283
+#define URI_safe	"-$_@.&"
284
+#define URI_extra	"!*\"'(),"
285
+#define URI_reserved    "=;/#?: "
286
+#define URI_national    "{}|[]\\^~"
287
+#define URI_punctuation "<>"
288
+
289
+#define URI_hex		 "[0-9a-fA-f]"
290
+#define URI_escape      "%"URI_hex"{2}"
291
+#define URI_xalpha "([" URI_safe URI_alpha URI_digit  URI_extra "]|"URI_escape")" /* URI_safe has to be first, because it contains - */
292
+#define URI_xalpha_nodot "([" URI_safe_nodot URI_alpha URI_digit URI_extra "]|"URI_escape")"
258 293
 
294
+#define URI_xalphas URI_xalpha"+"
295
+#define URI_xalphas_nodot URI_xalpha_nodot"*"
296
+
297
+#define URI_ialpha  "["URI_alpha"]"URI_xalphas_nodot""
298
+#define URI_xpalpha URI_xalpha"|\\+"
299
+#define URI_xpalpha_nodot URI_xalpha_nodot"|\\+"
300
+#define URI_xpalphas "("URI_xpalpha")+"
301
+#define URI_xpalphas_nodot "("URI_xpalpha_nodot")+"
302
+
303
+#define URI_scheme URI_ialpha
304
+#define URI_tld iana_tld
305
+#define URI_path1 URI_xpalphas_nodot"\\.("URI_xpalphas_nodot"\\.)*"
306
+#define URI_path2 URI_tld
307
+#define URI_path3 "(/("URI_xpalphas"/?)*)?"
308
+
309
+#define URI_search "("URI_xalphas"\\+)*"
310
+#define URI_fragmentid URI_xalphas
311
+
312
+#define URI_IP_digits "["URI_digit"]{1,3}"
313
+#define URI_numeric_path URI_IP_digits"(\\."URI_IP_digits"){3}(:"URI_xpalphas_nodot")?(/("URI_xpalphas"/?)*)?"
314
+#define URI_numeric_URI "("URI_scheme":(//)?)?"URI_numeric_path"(\\?" URI_search")?"
315
+#define URI_numeric_fragmentaddress URI_numeric_URI"(#"URI_fragmentid")?"
316
+
317
+#define URI_URI1 "("URI_scheme":(//)?)?"URI_path1
318
+#define URI_URI2 URI_path2
319
+#define URI_URI3 URI_path3"(\\?" URI_search")?"
320
+
321
+#define URI_fragmentaddress1 URI_URI1
322
+#define URI_fragmentaddress2 URI_URI2
323
+#define URI_fragmentaddress3 URI_URI3"(#"URI_fragmentid")?"
324
+
325
+#define URI_CHECK_PROTOCOLS "(http|https|ftp)://.+"
326
+
327
+/*Warning: take care when modifying this regex, it has been tweaked, and tuned, just don't break it please.
328
+ * there is fragmentaddress1, and 2  to work around the ISO limitation of 509 bytes max length for string constants*/
329
+static const char numeric_url_regex[] = "^ *"URI_numeric_fragmentaddress" *$";
330
+
331
+/* generated by contrib/phishing/generate_tables.c */
332
+static const short int hextable[256] = {
333
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
334
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
335
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
336
+       0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
337
+       0x0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
338
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
339
+       0x0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
340
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
341
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
342
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
343
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
344
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
345
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
346
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
347
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
348
+       0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
349
+};
350
+
351
+/* Prototypes*/
259 352
 static	inline	void string_init_c(struct string* dest,char* data);
260 353
 static	void	string_assign_null(struct string* dest);
261 354
 static	char	*rfind(char *start, char c, size_t len);
355
+static inline char hex2int(const unsigned char* src);
262 356
 
263 357
 void url_check_init(struct url_check* urls)
264 358
 {
... ...
@@ -356,42 +452,36 @@ void free_if_needed(struct url_check* url)
356 356
 	string_free(&url->displayLink);
357 357
 }
358 358
 
359
-
360
-static int build_regex(regex_t** preg,const char* regex,int nosub)
359
+static int build_regex(regex_t* preg,const char* regex,int nosub)
361 360
 {
362 361
 	int rc;
363
-	*preg = cli_malloc(sizeof(**preg));
364 362
 	cli_dbgmsg("Compiling regex:%s\n",regex);
365
-	rc = regcomp(*preg,regex,REG_EXTENDED|REG_ICASE|(nosub ? REG_NOSUB :0));
363
+	rc = regcomp(preg,regex,REG_EXTENDED|REG_ICASE|(nosub ? REG_NOSUB :0));
366 364
 	if(rc) {
367 365
 	
368 366
 #ifdef	C_WINDOWS
369 367
 		cli_errmsg("Error in compiling regex, disabling phishing checks\n");
370 368
 #else
371
-		size_t buflen =	regerror(rc,*preg,NULL,0);
369
+		size_t buflen =	regerror(rc,preg,NULL,0);
372 370
 		char *errbuf = cli_malloc(buflen);
373 371
 		
374 372
 		if(errbuf) {
375
-			regerror(rc,*preg,errbuf,buflen);
373
+			regerror(rc,preg,errbuf,buflen);
376 374
 			cli_errmsg("Error in compiling regex:%s\nDisabling phishing checks\n",errbuf);
377 375
 			free(errbuf);
378 376
 		} else
379 377
 			cli_errmsg("Error in compiling regex, disabling phishing checks\n");
380 378
 #endif
381
-		free(*preg);
382
-		*preg=NULL;
383
-		phish_disable("problem in compiling regex");
384 379
 		return 1;
385 380
 	}
386 381
 	return 0;
387 382
 }
388 383
 
389
-
390 384
 /*static regex_t* host_preg = NULL;
391 385
 static const char* host_regex="cid:.+|mailto:(.+)|([[:alpha:]]+://)?(([^:/?]+@)+([^:/?]+)([:/?].+)?|([^@:/?]+)([:/?].+)?)"; <- this is slower than the function below
392 386
 */
393 387
 /* allocates memory */
394
-void get_host(struct string* dest,const char* URL,int isReal,int* phishy)
388
+void get_host(const struct phishcheck* s,struct string* dest,const char* URL,int isReal,int* phishy)
395 389
 {
396 390
 	const char mailto[] = "mailto:";
397 391
 	int ismailto = 0;
... ...
@@ -446,7 +536,7 @@ void get_host(struct string* dest,const char* URL,int isReal,int* phishy)
446 446
 
447 447
 			if(realhost) {
448 448
 				const char* tld = strrchr(realhost,'.');
449
-				if(tld && isTLD(tld,tld-realhost-1))
449
+				if(tld && isTLD(s,tld,tld-realhost-1))
450 450
 					*phishy |= PHISHY_USERNAME_IN_URL;/* if the url contains a username that is there just to fool people,
451 451
 					like http://www.ebay.com@somevilplace.someevildomain.com/ */
452 452
 				start=realhost+1;/*skip the username*/
... ...
@@ -466,20 +556,12 @@ void get_host(struct string* dest,const char* URL,int isReal,int* phishy)
466 466
 	string_assign_dup(dest,start,end);
467 467
 }
468 468
 
469
-static regex_t* preg = NULL;
470
-static regex_t* preg_tld = NULL;
471
-static regex_t* preg_cctld = NULL;
472
-static regex_t* preg_numeric = NULL;
473
-
474
-static const char tld_regex[] = "^"iana_tld"$";
475
-static const char cctld_regex[] = "^"iana_cctld"$";
476
-
477
-int isCountryCode(const char* str)
469
+int isCountryCode(const struct phishcheck* s,const char* str)
478 470
 {
479
-	return str ? !regexec(preg_cctld,str,0,NULL,0) : 0;
471
+	return str ? !regexec(&s->preg_cctld,str,0,NULL,0) : 0;
480 472
 }
481 473
 
482
-int isTLD(const char* str,int len)
474
+int isTLD(const struct phishcheck* pchk,const char* str,int len)
483 475
 {
484 476
 	if (!str)
485 477
 		return 0;
... ...
@@ -488,7 +570,7 @@ int isTLD(const char* str,int len)
488 488
 		int rc;
489 489
 		strncpy(s,str,len);
490 490
 		s[len]='\0';
491
-		rc = !regexec(preg_tld,s,0,NULL,0);
491
+		rc = !regexec(&pchk->preg_tld,s,0,NULL,0);
492 492
 		free(s);
493 493
 		return rc;
494 494
 	}
... ...
@@ -510,7 +592,7 @@ rfind(char *start, char c, size_t len)
510 510
 	return (p < start) ? NULL : p;
511 511
 }
512 512
 
513
-void get_domain(struct string* dest,struct string* host)
513
+void get_domain(const struct phishcheck* pchk,struct string* dest,struct string* host)
514 514
 {
515 515
 	char* domain;
516 516
 	char* tld = strrchr(host->data,'.');
... ...
@@ -519,7 +601,7 @@ void get_domain(struct string* dest,struct string* host)
519 519
 		string_assign(dest,host);
520 520
 		return;
521 521
 	}
522
-	if(isCountryCode(tld+1)) {
522
+	if(isCountryCode(pchk,tld+1)) {
523 523
 		const char* countrycode=tld+1;
524 524
 		tld = rfind(host->data,'.',tld-host->data-1);
525 525
 		if(!tld) {
... ...
@@ -527,7 +609,7 @@ void get_domain(struct string* dest,struct string* host)
527 527
 			string_assign(dest,host);
528 528
 			return;
529 529
 		}
530
-		if(!isTLD(tld+1,countrycode-tld-1)) {
530
+		if(!isTLD(pchk,tld+1,countrycode-tld-1)) {
531 531
 			string_assign_ref(dest,host,tld+1);
532 532
 			return;/*it was a name like: subdomain.domain.uk, return domain.uk*/
533 533
 		}
... ...
@@ -599,10 +681,6 @@ int isSSL(const char* URL)
599 599
 	return URL ? !strncmp(https,URL,sizeof(https)-1) : 0;
600 600
 }
601 601
 
602
-
603
-
604
-static inline char hex2int(const unsigned char* src);
605
-
606 602
 /* deletes @what from the string @begin.
607 603
  * @what_len: length of @what, excluding the terminating \0 */
608 604
 static void
... ...
@@ -611,7 +689,7 @@ str_hex_to_char(char **begin, const char **end)
611 611
 	char *sbegin = *begin;
612 612
 	const char *str_end = *end;
613 613
 
614
-	assert(str_end>sbegin);
614
+	massert(str_end>sbegin);
615 615
 
616 616
 	if(strlen(sbegin) <= 2)
617 617
 		return;
... ...
@@ -650,7 +728,7 @@ str_strip(char **begin, const char **end, const char *what, size_t what_len)
650 650
 	if(begin == NULL)
651 651
 		return;
652 652
 
653
-	assert(str_end > sbegin);
653
+	massert(str_end > sbegin);
654 654
 
655 655
 	/*if(str_end < (sbegin + what_len))
656 656
 		return;*/
... ...
@@ -690,16 +768,6 @@ str_strip(char **begin, const char **end, const char *what, size_t what_len)
690 690
 	*end = str_end;
691 691
 }
692 692
 
693
-static const char dotnet[] = ".net";
694
-static const char adonet[] = "ado.net";
695
-static const char aspnet[] = "asp.net";
696
-static const char lt[]="&lt;";
697
-static const char gt[]="&gt;";
698
-static const size_t dotnet_len = sizeof(dotnet)-1;
699
-static const size_t adonet_len = sizeof(adonet)-1;
700
-static const size_t aspnet_len = sizeof(aspnet)-1;
701
-static const size_t lt_len = sizeof(lt)-1;
702
-static const size_t gt_len = sizeof(gt)-1;
703 693
 
704 694
 /* replace every occurence of @c in @str with @r*/
705 695
 static inline void str_replace(char* str,const char* end,char c,char r)
... ...
@@ -823,30 +891,11 @@ void get_redirected_URL(struct string* URL)
823 823
 	returns redirected URL*/
824 824
 }
825 825
 
826
-
827 826
 /* ---- runtime disable ------*/
828
-static int phish_disabled = 0;
829
-static pthread_mutex_t phish_disabled_lock = PTHREAD_MUTEX_INITIALIZER;
830
-
831
-void phish_disable(const char* reason)
827
+void phish_disable(struct cl_engine* engine, const char* reason)
832 828
 {
833 829
 	cli_warnmsg("Disabling phishing checks, reason:%s\n",reason);
834
-	pthread_mutex_lock(&phish_disabled_lock);
835
-		phish_disabled = 1;
836
-	pthread_mutex_unlock(&phish_disabled_lock);
837
-}
838
-
839
-static inline int is_phish_disabled(const struct cl_engine* engine)
840
-{
841
-	int rc;
842
-	if (!is_whitelist_ok(engine)) 
843
-		phish_disable("whitelist is not ok");
844
-	if (!is_domainlist_ok(engine))
845
-		phish_disable("domainlist is not ok");
846
-	pthread_mutex_lock(&phish_disabled_lock);
847
-	rc = phish_disabled;
848
-	pthread_mutex_unlock(&phish_disabled_lock);
849
-	return rc;
830
+	phishing_done(engine);/* sets is_disabled, and frees allocated mem for phishcheck */
850 831
 }
851 832
 /* -------end runtime disable---------*/
852 833
 
... ...
@@ -857,8 +906,9 @@ int phishingScan(message* m,const char* dir,cli_ctx* ctx,tag_arguments_t* hrefs)
857 857
 	const size_t href_text_len = sizeof(href_text);
858 858
 	const size_t src_text_len = sizeof(src_text);
859 859
 	int i;
860
-	if(is_phish_disabled(ctx->engine))
861
-		return 0;
860
+	struct phishcheck* pchk = (struct phishcheck*) ctx->engine->phishcheck;
861
+	if(!pchk || pchk->is_disabled)
862
+		return CL_CLEAN;
862 863
 
863 864
 	*ctx->virname=NULL;
864 865
 	for(i=0;i<hrefs->count;i++)
... ...
@@ -876,8 +926,8 @@ int phishingScan(message* m,const char* dir,cli_ctx* ctx,tag_arguments_t* hrefs)
876 876
 				blobClose(hrefs->contents[i]);
877 877
 			}*/
878 878
 			string_init_c(&urls.displayLink,(char*)blobGetData(hrefs->contents[i]));
879
-			assert(!urls.displayLink.data[blobGetDataSize(hrefs->contents[i])-1]);
880
-/*			assert(strlen(urls.displayLink.data) < blobGetDataSize(hrefs->contents[i]));*/
879
+			massert(!urls.displayLink.data[blobGetDataSize(hrefs->contents[i])-1]);
880
+/*			massert(strlen(urls.displayLink.data) < blobGetDataSize(hrefs->contents[i]));*/
881 881
 			urls.realLink.refcount=-1;
882 882
 			urls.displayLink.refcount=-1;/*don't free these, caller will free*/
883 883
 			if(strcmp((char*)hrefs->tag[i],"href")) {
... ...
@@ -888,8 +938,8 @@ int phishingScan(message* m,const char* dir,cli_ctx* ctx,tag_arguments_t* hrefs)
888 888
 			}
889 889
 
890 890
 			rc = phishingCheck(ctx->engine,&urls);
891
-			if(is_phish_disabled(ctx->engine))
892
-				return 0;
891
+			if(pchk->is_disabled)
892
+				return CL_CLEAN;
893 893
 			free_if_needed(&urls);
894 894
 			cli_dbgmsg("Phishing scan result:%s\n",phishing_ret_toString(rc));
895 895
 			switch(rc)/*TODO: support flags from ctx->options,*/
... ...
@@ -936,7 +986,7 @@ int phishingScan(message* m,const char* dir,cli_ctx* ctx,tag_arguments_t* hrefs)
936 936
 		else
937 937
 			if(strcmp((char*)hrefs->tag[i],"href"))
938 938
 					cli_dbgmsg("PH:href with no contents?\n");
939
-	return 0;/*texturlfound?CL_VIRUS:0;*/
939
+	return CL_CLEAN;/*texturlfound?CL_VIRUS:0;*/
940 940
 }
941 941
 
942 942
 static char* str_compose(const char* a,const char* b,const char* c)
... ...
@@ -953,148 +1003,108 @@ static char* str_compose(const char* a,const char* b,const char* c)
953 953
 	return concated;
954 954
 }
955 955
 
956
-/*static const char* url_regex="^ *([[:alnum:]%_-]+:(//)?)?([[:alnum:]%_-]@)*[[:alnum:]%_-]+\\.([[:alnum:]%_-]+\\.)*[[:alnum:]_%-]+(/[[:alnum:];:@$=?&/.,%_-]+) *$";*/
957
-/* for urls, including mailto: urls, and (broken) http:www... style urls*/
958
-/* refer to: http://www.w3.org/Addressing/URL/5_URI_BNF.html
959
- * Modifications: don't allow empty domains/subdomains, such as www..com <- that is no url
960
- * So the 'safe' char class has been split up
961
- * */
962
-/* character classes */
963
-#define URI_alpha	"a-zA-Z"
964
-#define URI_digit	"0-9"
965
-#define URI_safe_nodot  "-$_@&"
966
-#define URI_safe	"-$_@.&"
967
-#define URI_extra	"!*\"'(),"
968
-#define URI_reserved    "=;/#?: "
969
-#define URI_national    "{}|[]\\^~"
970
-#define URI_punctuation "<>"
971
-
972
-#define URI_hex		 "[0-9a-fA-f]"
973
-#define URI_escape      "%"URI_hex"{2}"
974
-#define URI_xalpha "([" URI_safe URI_alpha URI_digit  URI_extra "]|"URI_escape")" /* URI_safe has to be first, because it contains - */
975
-#define URI_xalpha_nodot "([" URI_safe_nodot URI_alpha URI_digit URI_extra "]|"URI_escape")"
976
-
977
-#define URI_xalphas URI_xalpha"+"
978
-#define URI_xalphas_nodot URI_xalpha_nodot"*"
979
-
980
-#define URI_ialpha  "["URI_alpha"]"URI_xalphas_nodot""
981
-#define URI_xpalpha URI_xalpha"|\\+"
982
-#define URI_xpalpha_nodot URI_xalpha_nodot"|\\+"
983
-#define URI_xpalphas "("URI_xpalpha")+"
984
-#define URI_xpalphas_nodot "("URI_xpalpha_nodot")+"
985
-
986
-#define URI_scheme URI_ialpha
987
-#define URI_tld iana_tld
988
-#define URI_path1 URI_xpalphas_nodot"\\.("URI_xpalphas_nodot"\\.)*"
989
-#define URI_path2 URI_tld
990
-#define URI_path3 "(/("URI_xpalphas"/?)*)?"
991
-
992
-#define URI_search "("URI_xalphas"\\+)*"
993
-#define URI_fragmentid URI_xalphas
994
-
995
-#define URI_IP_digits "["URI_digit"]{1,3}"
996
-#define URI_numeric_path URI_IP_digits"(\\."URI_IP_digits"){3}(:"URI_xpalphas_nodot")?(/("URI_xpalphas"/?)*)?"
997
-#define URI_numeric_URI "("URI_scheme":(//)?)?"URI_numeric_path"(\\?" URI_search")?"
998
-#define URI_numeric_fragmentaddress URI_numeric_URI"(#"URI_fragmentid")?"
999
-
1000
-#define URI_URI1 "("URI_scheme":(//)?)?"URI_path1
1001
-#define URI_URI2 URI_path2
1002
-#define URI_URI3 URI_path3"(\\?" URI_search")?"
1003
-
1004
-#define URI_fragmentaddress1 URI_URI1
1005
-#define URI_fragmentaddress2 URI_URI2
1006
-#define URI_fragmentaddress3 URI_URI3"(#"URI_fragmentid")?"
1007
-
1008
-#define URI_CHECK_PROTOCOLS "(http|https|ftp)://.+"
1009
-
1010
-/*Warning: take care when modifying this regex, it has been tweaked, and tuned, just don't break it please.
1011
- * there is fragmentaddress1, and 2  to work around the ISO limitation of 509 bytes max length for string constants*/
1012
-static const char numeric_url_regex[] = "^ *"URI_numeric_fragmentaddress" *$";
1013
-static char* url_regex = NULL;
1014
-
1015
-static int hexinited=0;
1016
-static short int hextable[256];
1017
-
1018 956
 static inline char hex2int(const unsigned char* src)
1019 957
 {
1020
-	assert(hexinited);
1021 958
 	return hextable[src[0]]<<4 | hextable[src[1]];
1022 959
 }
1023 960
 
1024
-static void free_regex(regex_t** p)
961
+static void free_regex(regex_t* p)
1025 962
 {
1026 963
 	if(p) {
1027
-		if(*p) {
1028
-			regfree(*p);
1029
-			free(*p);
1030
-			*p=NULL;
1031
-		}
964
+		regfree(p);
1032 965
 	}
1033 966
 }
1034
-/* --------non-thread-safe functions--------*/
1035
-static void init_hextable(void)
1036
-{
1037
-	unsigned char c;
1038
-	memset(hextable,0,256);
1039
-	for(c='0';c<='9';c++)
1040
-		hextable[c] = c-'0';
1041
-	for(c='a';c<='z';c++)
1042
-		hextable[c] = 10+c-'a';
1043
-	for(c='A';c<='Z';c++)
1044
-		hextable[c] = 10+c-'A';
1045
-	hexinited=1;
1046
-}
1047 967
 
1048
-int phishing_init(engine)
968
+int phishing_init(struct cl_engine* engine)
1049 969
 {
970
+	struct phishcheck* pchk;
971
+	if(!engine->phishcheck) {
972
+		pchk = engine->phishcheck = cli_malloc(sizeof(struct phishcheck));
973
+		if(!pchk)
974
+			return CL_EMEM;
975
+		pchk->is_disabled = 1;
976
+	}
977
+	else {
978
+		pchk = engine->phishcheck;
979
+		if(!pchk->is_disabled) {
980
+			/* already initialized */
981
+			return CL_SUCCESS;
982
+		}
983
+	}
984
+
1050 985
 	cli_dbgmsg("Initializing phishcheck module\n");
1051
-	setup_matcher_engine();
1052
-	if(build_regex(&preg_cctld,cctld_regex,1))
1053
-		return -1;
1054
-	if(build_regex(&preg_tld,tld_regex,1))
1055
-		return -1;	
1056
-	url_regex = str_compose("^ *("URI_fragmentaddress1,URI_fragmentaddress2,URI_fragmentaddress3"|"URI_CHECK_PROTOCOLS") *$");
1057
-	if(build_regex(&preg,url_regex,1))
1058
-		return -1;
1059
-	if(build_regex(&preg_numeric,numeric_url_regex,1))
1060
-		return -1;
1061
-	init_hextable();
986
+
987
+	if(build_regex(&pchk->preg_cctld,cctld_regex,1)) {
988
+		free(pchk);
989
+		engine->phishcheck = NULL;
990
+		return CL_EFORMAT;
991
+	}
992
+	if(build_regex(&pchk->preg_tld,tld_regex,1)) {
993
+		free_regex(&pchk->preg_cctld);
994
+		free(pchk);
995
+		engine->phishcheck = NULL;
996
+		return CL_EFORMAT;	
997
+	}
998
+	pchk->url_regex = str_compose("^ *("URI_fragmentaddress1,URI_fragmentaddress2,URI_fragmentaddress3"|"URI_CHECK_PROTOCOLS") *$");
999
+	if(build_regex(&pchk->preg,pchk->url_regex,1)) {
1000
+		free_regex(&pchk->preg_cctld);
1001
+		free_regex(&pchk->preg_tld);
1002
+		free(pchk->url_regex);
1003
+		free(pchk);
1004
+		engine->phishcheck = NULL;
1005
+		return CL_EFORMAT;
1006
+	}
1007
+	if(build_regex(&pchk->preg_numeric,numeric_url_regex,1)) {
1008
+		free_regex(&pchk->preg_cctld);
1009
+		free_regex(&pchk->preg_tld);
1010
+		free_regex(&pchk->preg);
1011
+		free(pchk->url_regex);
1012
+		free(pchk);
1013
+		engine->phishcheck = NULL;
1014
+		return CL_EFORMAT;
1015
+	}
1016
+	pchk->is_disabled = 0;
1062 1017
 	cli_dbgmsg("Phishcheck module initialized\n");
1063
-	return 0;
1018
+	return CL_SUCCESS;
1064 1019
 }
1065 1020
 
1066
-
1067 1021
 void phishing_done(struct cl_engine* engine)
1068 1022
 {
1023
+	struct phishcheck* pchk = engine->phishcheck;
1069 1024
 	cli_dbgmsg("Cleaning up phishcheck\n");
1070
-	free_regex(&preg);
1071
-	free_regex(&preg_cctld);
1072
-	free_regex(&preg_tld);
1073
-	free_regex(&preg_numeric);
1074
-	if(url_regex) {
1075
-		free(url_regex);
1076
-		url_regex = NULL;
1025
+	if(pchk && !pchk->is_disabled) {
1026
+		free_regex(&pchk->preg);
1027
+		free_regex(&pchk->preg_cctld);
1028
+		free_regex(&pchk->preg_tld);
1029
+		free_regex(&pchk->preg_numeric);
1030
+		if(pchk->url_regex) {
1031
+			free(pchk->url_regex);
1032
+			pchk->url_regex = NULL;
1033
+		}
1034
+		pchk->is_disabled = 1;
1077 1035
 	}
1078
-
1079 1036
 	whitelist_done(engine);
1080 1037
 	domainlist_done(engine);
1081
-	matcher_engine_done();
1038
+	if(pchk) {
1039
+		cli_dbgmsg("Freeing phishcheck struct\n");
1040
+		free(pchk);
1041
+		engine->phishcheck = NULL;
1042
+	}		
1082 1043
 	cli_dbgmsg("Phishcheck cleaned up\n");
1083 1044
 }
1084 1045
 
1085
-/* ---------------end of non-thread-safe function-----------*/
1086 1046
 /*
1087 1047
  * Only those URLs are identified as URLs for which phishing detection can be performed.
1088 1048
  * This means that no attempt is made to properly recognize 'cid:' URLs
1089 1049
  */
1090
-int isURL(const char* URL)
1050
+int isURL(const struct phishcheck* pchk,const char* URL)
1091 1051
 {
1092
-	return URL ? !regexec(preg,URL,0,NULL,0) : 0;
1052
+	return URL ? !regexec(&pchk->preg,URL,0,NULL,0) : 0;
1093 1053
 }
1094 1054
 
1095
-int isNumericURL(const char* URL)
1055
+int isNumericURL(const struct phishcheck* pchk,const char* URL)
1096 1056
 {
1097
-	return URL ? !regexec(preg_numeric,URL,0,NULL,0) : 0;
1057
+	return URL ? !regexec(&pchk->preg_numeric,URL,0,NULL,0) : 0;
1098 1058
 }
1099 1059
 
1100 1060
 /* Cleans up @urls
... ...
@@ -1113,11 +1123,10 @@ enum phish_status cleanupURLs(struct url_check* urls)
1113 1113
 	return CL_PHISH_NODECISION;
1114 1114
 }
1115 1115
 
1116
-
1117
-enum phish_status url_get_host(struct url_check* url,struct url_check* host_url,int isReal,int* phishy)
1116
+enum phish_status url_get_host(const struct phishcheck* pchk, struct url_check* url,struct url_check* host_url,int isReal,int* phishy)
1118 1117
 {
1119 1118
 	struct string* host = isReal ? &host_url->realLink : &host_url->displayLink;
1120
-	get_host(host,isReal ? url->realLink.data : url->displayLink.data, isReal,phishy);
1119
+	get_host(pchk, host, isReal ? url->realLink.data : url->displayLink.data, isReal, phishy);
1121 1120
 	if(!host->data)
1122 1121
 		return CL_PHISH_CLEANUP_OK;
1123 1122
 	if(*phishy&REAL_IS_MAILTO)
... ...
@@ -1140,12 +1149,11 @@ enum phish_status url_get_host(struct url_check* url,struct url_check* host_url,
1140 1140
 	return CL_PHISH_NODECISION;
1141 1141
 }
1142 1142
 
1143
-
1144
-void url_get_domain(struct url_check* url,struct url_check* domains)
1143
+void url_get_domain(const struct phishcheck* pchk, struct url_check* url,struct url_check* domains)
1145 1144
 {
1146
-	get_domain(&domains->realLink, &url->realLink);
1147
-	get_domain(&domains->displayLink, &url->displayLink);
1148
-	domains->flags	     = url->flags;
1145
+	get_domain(pchk, &domains->realLink, &url->realLink);
1146
+	get_domain(pchk, &domains->displayLink, &url->displayLink);
1147
+	domains->flags = url->flags;
1149 1148
 }
1150 1149
 
1151 1150
 enum phish_status phishy_map(int phishy,enum phish_status fallback)
... ...
@@ -1172,8 +1180,6 @@ int isEncoded(const char* url)
1172 1172
 	return (cnt-1 >strlen(url)*7/10);/*more than 70% made up of &#;*/
1173 1173
 }
1174 1174
 
1175
-
1176
-
1177 1175
 int whitelist_check(const struct cl_engine* engine,struct url_check* urls,int hostOnly)
1178 1176
 {
1179 1177
 	return whitelist_match(engine,urls->realLink.data,urls->displayLink.data,hostOnly);
... ...
@@ -1187,6 +1193,7 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
1187 1187
 	const size_t cid_len = sizeof(cid)-1;
1188 1188
 	enum phish_status rc=CL_PHISH_NODECISION;
1189 1189
 	int phishy=0;
1190
+	const struct phishcheck* pchk = (const struct phishcheck*) engine->phishcheck;
1190 1191
 
1191 1192
 	if(!urls->realLink.data)
1192 1193
 		return CL_PHISH_CLEAN;
... ...
@@ -1198,7 +1205,7 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
1198 1198
 		return CL_PHISH_CLEAN;/* displayed and real URL are identical -> clean */
1199 1199
 
1200 1200
 	if((rc = cleanupURLs(urls))) {
1201
-		assert(!isPhishing(rc));/* not allowed to decide this is phishing */
1201
+		massert(!isPhishing(rc));/* not allowed to decide this is phishing */
1202 1202
 		return rc;/* URLs identical after cleanup */
1203 1203
 	}
1204 1204
 
... ...
@@ -1214,16 +1221,12 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
1214 1214
 
1215 1215
 	url_check_init(&host_url);
1216 1216
 
1217
-	if((rc = url_get_host(urls,&host_url,DOMAIN_DISPLAY,&phishy))) {
1217
+	if((rc = url_get_host(pchk, urls,&host_url,DOMAIN_DISPLAY,&phishy))) {
1218 1218
 		free_if_needed(&host_url);
1219
-		assert(!isPhishing(rc));
1219
+		massert(!isPhishing(rc));
1220 1220
 		return rc;
1221 1221
 	}
1222 1222
 
1223
-	if(whitelist_check(engine,&host_url,1)) {
1224
-		free_if_needed(&host_url);
1225
-		return CL_PHISH_HOST_WHITELISTED;
1226
-	}
1227 1223
 
1228 1224
 	if(urls->flags&DOMAINLIST_REQUIRED) {
1229 1225
 		if(!(phishy&DOMAIN_LISTED)) {
... ...
@@ -1260,7 +1263,7 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
1260 1260
 		return CL_PHISH_SSL_SPOOF;
1261 1261
 	}
1262 1262
 
1263
-	if((rc = url_get_host(urls,&host_url,DOMAIN_REAL,&phishy)))
1263
+	if((rc = url_get_host(pchk, urls,&host_url,DOMAIN_REAL,&phishy)))
1264 1264
 	{
1265 1265
 		free_if_needed(&host_url);
1266 1266
 		return rc;
... ...
@@ -1271,8 +1274,13 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
1271 1271
 		return CL_PHISH_CLEAN_CID;
1272 1272
 	}
1273 1273
 
1274
-	if(!isURL(urls->displayLink.data) &&
1275
-			( (phishy&PHISHY_NUMERIC_IP && !isNumericURL(urls->displayLink.data)) ||
1274
+	if(whitelist_check(engine,&host_url,1)) {
1275
+		free_if_needed(&host_url);
1276
+		return CL_PHISH_HOST_WHITELISTED;
1277
+	}
1278
+
1279
+	if(!isURL(pchk, urls->displayLink.data) &&
1280
+			( (phishy&PHISHY_NUMERIC_IP && !isNumericURL(pchk, urls->displayLink.data)) ||
1276 1281
 			  !(phishy&PHISHY_NUMERIC_IP))) {
1277 1282
 		free_if_needed(&host_url);
1278 1283
 		return CL_PHISH_TEXTURL;
... ...
@@ -1288,7 +1296,7 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
1288 1288
 		if(urls->flags&DOMAIN_SUFFICIENT) {
1289 1289
 			struct url_check domain_url;
1290 1290
 			url_check_init(&domain_url);
1291
-			url_get_domain(&host_url,&domain_url);
1291
+			url_get_domain(pchk, &host_url,&domain_url);
1292 1292
 			if(!strcmp(domain_url.realLink.data,domain_url.displayLink.data)) {
1293 1293
 				free_if_needed(&host_url);
1294 1294
 				free_if_needed(&domain_url);
... ...
@@ -22,6 +22,9 @@
22 22
 #ifndef _PHISH_CHECK_H
23 23
 #define _PHISH_CHECK_H
24 24
 
25
+#ifdef	HAVE_REGEX_H
26
+#include <regex.h>
27
+#endif
25 28
 
26 29
 #define CL_PHISH_BASE 100
27 30
 enum phish_status {CL_PHISH_NODECISION=0,CL_PHISH_CLEAN=CL_PHISH_BASE, CL_PHISH_CLEANUP_OK,CL_PHISH_HOST_OK, CL_PHISH_DOMAIN_OK,
... ...
@@ -54,6 +57,15 @@ struct string {
54 54
 	char* data;
55 55
 };
56 56
 
57
+struct phishcheck {
58
+	regex_t preg;
59
+	regex_t preg_tld;
60
+	regex_t preg_cctld;
61
+	regex_t preg_numeric;
62
+	char*    url_regex;
63
+	int      is_disabled;
64
+};
65
+
57 66
 struct url_check {
58 67
 	struct string realLink;
59 68
 	struct string displayLink;
... ...
@@ -65,34 +77,33 @@ enum phish_status phishingCheck(const struct cl_engine* engine,struct url_check*
65 65
 
66 66
 int whitelist_check(const struct cl_engine* engine,struct url_check* urls,int hostOnly);
67 67
 void url_check_init(struct url_check* urls);
68
-void get_host(struct string* dest,const char* URL,int isReal,int* phishy);
69 68
 void string_free(struct string* str);
70 69
 void string_assign(struct string* dest,struct string* src);
71 70
 void string_assign_c(struct string* dest,char* data);
72 71
 void string_assign_dup(struct string* dest,const char* start,const char* end);
73 72
 void string_assign_ref(struct string* dest,struct string* ref,char* data);
74 73
 void free_if_needed(struct url_check* url);
75
-void get_host(struct string* dest,const char* URL,int isReal,int* phishy);
76
-int isCountryCode(const char* str);
77
-int isTLD(const char* str,int len);
78
-void get_domain(struct string* dest,struct string* host);
74
+void get_host(const struct phishcheck* pchk,struct string* dest,const char* URL,int isReal,int* phishy);
75
+int isCountryCode(const struct phishcheck* s,const char* str);
76
+int isTLD(const struct phishcheck* s,const char* str,int len);
77
+void get_domain(const struct phishcheck* pchk,struct string* dest,struct string* host);
79 78
 int ip_reverse(struct url_check* urls,int isReal);
80 79
 void reverse_lookup(struct url_check* url,int isReal);
81 80
 int isNumeric(const char* host);
82 81
 int isSSL(const char* URL);
83 82
 void cleanupURL(struct string* URL,int isReal);
84 83
 void get_redirected_URL(struct string* URL);
85
-int isURL(const char* URL);
84
+int isURL(const struct phishcheck* pchk,const char* URL);
86 85
 enum phish_status cleanupURLs(struct url_check* urls);
87
-int isNumericURL(const char* URL);
88
-enum phish_status url_get_host(struct url_check* url,struct url_check* host_url,int isReal,int* phishy);
89
-void url_get_domain(struct url_check* url,struct url_check* domains);
86
+int isNumericURL(const struct phishcheck* pchk, const char* URL);
87
+enum phish_status url_get_host(const struct phishcheck* pchk, struct url_check* url,struct url_check* host_url,int isReal,int* phishy);
88
+void url_get_domain(const struct phishcheck* pchk, struct url_check* url,struct url_check* domains);
90 89
 enum phish_status phishy_map(int phishy,enum phish_status fallback);
91 90
 int isEncoded(const char* url);
92 91
 
93
-void phish_disable(const char* reason);
92
+void phish_disable(struct cl_engine* engine,const char* reason);
94 93
 /* Global, non-thread-safe functions, call only once! */
95
-void phishint_init(struct cl_engine* engine);
94
+int phishing_init(struct cl_engine* engine);
96 95
 void phishing_done(struct cl_engine* engine);
97 96
 /* end of non-thread-safe functions */
98 97
 
... ...
@@ -55,7 +55,6 @@
55 55
 #include "regex_list.h"
56 56
 #endif
57 57
 
58
-
59 58
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
60 59
 #include <limits.h>
61 60
 #include <stddef.h>
... ...
@@ -497,11 +496,12 @@ static int cli_initengine(struct cl_engine **engine, unsigned int options)
497 497
 	    cli_errmsg("Can't allocate memory for roots!\n");
498 498
 	    return CL_EMEM;
499 499
 	}
500
+    }
501
+
500 502
 #ifdef CL_EXPERIMENTAL
501
-	if(rc =phishing_init(*engine))
502
-		return rc;
503
+    if(rc = phishing_init(*engine))
504
+	return rc;
503 505
 #endif
504
-    }
505 506
 
506 507
     return CL_SUCCESS;
507 508
 }
... ...
@@ -608,43 +608,61 @@ static int cli_loaddb(FILE *fd, struct cl_engine **engine, unsigned int *signo,
608 608
 }
609 609
 
610 610
 #ifdef CL_EXPERIMENTAL
611
-static int cli_loadwdb(struct cl_engine** engine,FILE* fd,unsigned int options)
611
+static int cli_loadwdb(FILE *fd, struct cl_engine **engine, unsigned int options)
612 612
 {
613 613
 	int ret = 0;
614 614
 
615
-	if((ret = cli_initengine(engine, options))) {
616
-		cl_free(*engine);
617
-		return ret;
615
+
616
+    if((ret = cli_initengine(engine, options))) {
617
+	cl_free(*engine);
618
+	return ret;
619
+    }
620
+
621
+    if(!(*engine)->whitelist_matcher) {
622
+	if(ret = init_whitelist(*engine)) {
623
+	    phishing_done(*engine);
624
+	    cl_free(*engine);
625
+	    return ret;
618 626
 	}
627
+    }
619 628
 
620
-	if(!(*engine)->whitelist_matcher)
621
-		if(ret = init_whitelist(*engine)) {
622
-	            whitelist_done(*engine);
623
-		    cl_free(*engine);
624
-		    return ret;
625
-		}
629
+    if((ret = load_regex_matcher((*engine)->whitelist_matcher, fd, options, 1))) {
630
+	phishing_done(*engine);
631
+	cl_free(*engine);
632
+	return ret;
633
+    }
626 634
 
627
-	return load_regex_matcher((*engine)->whitelist_matcher,fd,options);
635
+    return CL_SUCCESS;
628 636
 }
629 637
 
630
-static int cli_loadpdb(struct cl_engine** engine,FILE* fd,unsigned int options)
638
+static int cli_loadpdb(FILE *fd, struct cl_engine **engine, unsigned int options)
631 639
 {
632 640
 	int ret = 0;
633 641
 
634
-	if((ret = cli_initengine(engine, options))) {
635
-		cl_free(*engine);
636
-		return ret;
642
+
643
+    if((ret = cli_initengine(engine, options))) {
644
+	cl_free(*engine);
645
+	return ret;
646
+    }
647
+
648
+    if(!(*engine)->domainlist_matcher) {
649
+	if(ret = init_domainlist(*engine)) {
650
+	    phishing_done(*engine);
651
+	    cl_free(*engine);
652
+	    return ret;
637 653
 	}
654
+    }
638 655
 
639
-	if(!(*engine)->domainlist_matcher)
640
-		if(ret = init_domainlist(*engine)) {
641
-	            domainlist_done(*engine);
642
-		    cl_free(*engine);
643
-		    return ret;
644
-		}
645
-	return load_regex_matcher((*engine)->domainlist_matcher,fd,options);
656
+    if((ret = load_regex_matcher((*engine)->domainlist_matcher, fd, options, 0))) {
657
+	phishing_done(*engine);
658
+	cl_free(*engine);
659
+	return ret;
660
+    }
661
+
662
+    return CL_SUCCESS;
646 663
 }
647 664
 #endif
665
+
648 666
 static int cli_loadndb(FILE *fd, struct cl_engine **engine, unsigned int *signo, unsigned short sdb, unsigned int options)
649 667
 {
650 668
 	char buffer[FILEBUFF], *sig, *virname, *offset, *pt;
... ...
@@ -1170,12 +1188,12 @@ static int cli_load(const char *filename, struct cl_engine **engine, unsigned in
1170 1170
 #ifdef CL_EXPERIMENTAL
1171 1171
     } else if(cli_strbcasestr(filename, ".wdb")) {
1172 1172
 	if(!(options & CL_SCAN_NOPHISHING))
1173
-	    ret = cli_loadwdb(engine, fd, options);
1173
+	    ret = cli_loadwdb(fd, engine, options);
1174 1174
 	else
1175 1175
 	    skipped = 1;
1176 1176
     } else if(cli_strbcasestr(filename, ".pdb")) {
1177 1177
 	if(!(options & CL_SCAN_NOPHISHING))
1178
-	    ret = cli_loadpdb(engine, fd, options);
1178
+	    ret = cli_loadpdb(fd, engine, options);
1179 1179
 	else
1180 1180
 	    skipped = 1;
1181 1181
 #endif
... ...
@@ -1601,7 +1619,7 @@ void cl_free(struct cl_engine *engine)
1601 1601
     }
1602 1602
 
1603 1603
 #ifdef CL_EXPERIMENTAL
1604
-   phishing_done(engine);
1604
+    phishing_done(engine);
1605 1605
 #endif
1606 1606
     free(engine);
1607 1607
 }
... ...
@@ -19,6 +19,9 @@
19 19
  *  MA 02110-1301, USA.
20 20
  *
21 21
  *  $Log: regex_list.c,v $
22
+ *  Revision 1.9  2006/10/10 23:51:49  tkojm
23
+ *  apply patches for the anti-phish code from Edwin
24
+ *
22 25
  *  Revision 1.8  2006/10/08 18:55:15  tkojm
23 26
  *  fix crash in phishing code on database reload (Edvin Torok)
24 27
  *
... ...
@@ -117,7 +120,6 @@
117 117
 #include <stdio.h>
118 118
 #include <stdlib.h>
119 119
 #include <errno.h>
120
-#include <assert.h>
121 120
 #include <string.h>
122 121
 #ifdef	HAVE_STRINGS_H
123 122
 #include <strings.h>
... ...
@@ -148,7 +150,7 @@
148 148
 
149 149
 /*Tree*/
150 150
 enum token_op_t {OP_CHAR,OP_STDCLASS,OP_CUSTOMCLASS,OP_DOT,OP_LEAF,OP_ROOT,OP_PARCLOSE};
151
-typedef char* char_bitmap_p;
151
+typedef unsigned char* char_bitmap_p;
152 152
 /*
153 153
  *
154 154
  * OP_CHAR: 1 character, c = character
... ...
@@ -159,11 +161,11 @@ typedef char* char_bitmap_p;
159 159
  * OP_LEAF: this is a leaf node, reinterpret structure
160 160
  */
161 161
 struct tree_node {
162
-	enum token_op_t op;
162
+	struct tree_node* next;/* next regex/complex sibling, or parent, if no more siblings , can't be NULL except for root node*/
163 163
 	unsigned char c;
164
+	enum token_op_t op;
164 165
 	char alternatives;/* number of (non-regex) children of node, i.e. sizeof(children)*/
165 166
 	char listend;/* no more siblings, next pointer is pointer to parent*/
166
-	struct tree_node* next;/* next regex/complex sibling, or parent, if no more siblings , can't be NULL except for root node*/
167 167
 	union {
168 168
 		struct tree_node** children;/* alternatives nr. of children, followed by (a null pointer terminated) regex leaf node pointers) */
169 169
 		char_bitmap_p* bitmap;
... ...
@@ -177,79 +179,124 @@ struct leaf_info {
177 177
 };
178 178
 
179 179
 /* Character classes */
180
-enum wctype_t {ALNUM,DIGIT,PUNCT,ALPHA,GRAPH,SPACE,BLANK,LOWER,UPPER,CNTRL,PRINT,XDIGIT};
181
-static struct std_classmap {
182
-		const char* classname;
183
-		const enum wctype_t type;
184
-} std_class[] = {
185
-	{"[:alnum:]",ALNUM},
186
-	{"[:digit:]",DIGIT},
187
-	{"[:punct:]",PUNCT},
188
-	{"[:alpha:]",ALPHA},
189
-	{"[:graph:]",GRAPH},
190
-	{"[:space:]",SPACE},
191
-	{"[:blank:]",BLANK},
192
-	{"[:lower:]",LOWER}, 
193
-	{"[:upper:]",UPPER},
194
-	{"[:cntrl:]",CNTRL},
195
-	{"[:print:]",PRINT},
196
-	{"[:xdigit:]",XDIGIT}
180
+static const char* std_class[] = {
181
+	"[:alnum:]",
182
+	"[:digit:]",
183
+	"[:punct:]",
184
+	"[:alpha:]",
185
+	"[:graph:]",
186
+	"[:space:]",
187
+	"[:blank:]",
188
+	"[:lower:]", 
189
+	"[:upper:]",
190
+	"[:cntrl:]",
191
+	"[:print:]",
192
+	"[:xdigit:]"
193
+	/* don't change the order of these strings, unless you change them in generate_tables.c too, and regenerate the tables*/
197 194
 };
198 195
 
199
-static int cli_iswctype(const char c,const enum wctype_t type);
200 196
 
201
-/* -------------- NON_THREAD_SAFE BEGIN --------------*/
202
-/* Global variables and functions accessing them, not thread-safe!
203
- * they should be called on application startup/shutdown once! */
204
-static const size_t std_class_cnt =  sizeof(std_class)/sizeof(std_class[0]);
205 197
 #define STD_CLASS_CNT sizeof(std_class)/sizeof(std_class[0])
206
-typedef char char_bitmap_t[32];
207
-static char_bitmap_p char_class_bitmap[STD_CLASS_CNT];
208
-static unsigned short int char_class[256];
209
-static int engine_ok = 0;
210 198
 
211
-void setup_matcher_engine(void)
212
-{
213
-	/*Set up std character classes*/
214
-	size_t i;
215
-	size_t j;
216
-	memset(char_class,0,256);
217
-	for(i=0;i<std_class_cnt;i++) {
218
-		enum wctype_t type = std_class[i].type;
219
-		char_class_bitmap[i]=cli_calloc(256>>3,1);
220
-		for(j=0;j<256;j++)
221
-			if(cli_iswctype(j,type)) {
222
-				char_class[j] |= 1<<i;
223
-				char_class_bitmap[i][j>>3] |= 1<<(j&0x07);
224
-			}
225
-	}	
226
-	engine_ok  = 1;
227
-}
199
+/* generated by contrib/phishing/generate_tables.c */
200
+static const unsigned char char_class_bitmap[STD_CLASS_CNT][32] = {
201
+        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 
202
+         0xfe, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07, 
203
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
204
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
205
+
206
+        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 
207
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
208
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
209
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
210
+
211
+        {0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0xfc, 
212
+         0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x78, 
213
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
214
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
215
+
216
+        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
217
+         0xfe, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07, 
218
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
219
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
220
+
221
+        {0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 
222
+         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 
223
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
224
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
225
+
226
+        {0x00, 0x3e, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
227
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
228
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
229
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
230
+
231
+        {0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
232
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
233
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
234
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
235
+
236
+        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
237
+         0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x07, 
238
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
239
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
240
+
241
+        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
242
+         0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 
243
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
244
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
245
+
246
+        {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 
247
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 
248
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
249
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
250
+
251
+        {0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 
252
+         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 
253
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
254
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
255
+
256
+        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 
257
+         0x7e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 
258
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
259
+         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
260
+};
228 261
 
229
-void matcher_engine_done(void)
230
-{
231
-	size_t i;
232
-	for(i=0;i<std_class_cnt;i++) {
233
-		if(char_class_bitmap[i]) {
234
-			free(char_class_bitmap[i]);
235
-			char_class_bitmap[i] = NULL;
236
-		}
237
-	}
238
-	engine_ok = 0;
239
-}
262
+static const unsigned short int char_class[256] = {
263
+        0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x260, 0x220, 0x220, 0x220, 0x220, 0x200, 0x200, 
264
+        0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 
265
+        0x460, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 
266
+        0xc13, 0xc13, 0xc13, 0xc13, 0xc13, 0xc13, 0xc13, 0xc13, 0xc13, 0xc13, 0x414, 0x414, 0x414, 0x414, 0x414, 0x414, 
267
+        0x414, 0xd19, 0xd19, 0xd19, 0xd19, 0xd19, 0xd19, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 
268
+        0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x519, 0x414, 0x414, 0x414, 0x414, 0x414, 
269
+        0x414, 0xc99, 0xc99, 0xc99, 0xc99, 0xc99, 0xc99, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 
270
+        0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x499, 0x414, 0x414, 0x414, 0x414, 0x200, 
271
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
272
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
273
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
274
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
275
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
276
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
277
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 
278
+        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000
279
+};
240 280
 
281
+static const size_t std_class_cnt =  sizeof(std_class)/sizeof(std_class[0]);
241 282
 
242
-/* -------------- NON_THREAD_SAFE END --------------*/
243 283
 /* Prototypes */
244 284
 static int add_pattern(struct regex_matcher* matcher,const unsigned char* pat,const char* info);
245 285
 static int match_node(struct tree_node* node,const unsigned char* c,size_t len,const char** info);
246 286
 static void destroy_tree(struct regex_matcher* matcher);
287
+static struct tree_node* tree_root_alloc(void);
288
+static int build_regex_list(struct regex_matcher* matcher);
289
+static void stack_destroy(struct node_stack* stack);
247 290
 
291
+#ifndef NDEBUG
292
+void dump_tree(struct tree_node* root);
293
+#endif
248 294
 
249 295
 #define MATCH_SUCCESS 0 
250 296
 #define MATCH_FAILED  -1
251 297
 
252
-
253 298
 /*
254 299
  * Call this function when an unrecoverable error has occured, (instead of exit).
255 300
  */
... ...
@@ -265,6 +312,7 @@ static void fatal_error(struct regex_matcher* matcher)
265 265
  * @real_url - href target
266 266
  * @display_url - <a> tag contents
267 267
  * @hostOnly - if you want to match only the host part
268
+ * @is_whitelist - is this a lookup in whitelist?
268 269
  *
269 270
  * @return - CL_SUCCESS - url doesn't match
270 271
  *         - CL_VIRUS - url matches list
... ...
@@ -272,20 +320,19 @@ static void fatal_error(struct regex_matcher* matcher)
272 272
  * Do not send NULL pointers to this function!!
273 273
  *
274 274
  */
275
-int regex_list_match(struct regex_matcher* matcher,const char* real_url,const char* display_url,int hostOnly,const char** info)
275
+int regex_list_match(struct regex_matcher* matcher,const char* real_url,const char* display_url,int hostOnly,const char** info,int is_whitelist)
276 276
 {
277
-	assert(matcher);
278
-	assert(real_url);
279
-	assert(display_url);
280
-	assert(info);
281
-	assert(engine_ok);
277
+	massert(matcher);
278
+	massert(real_url);
279
+	massert(display_url);
280
+	massert(info);
282 281
 	if(!matcher->list_inited)
283 282
 		return 0;
284
-	assert(matcher->list_built);
283
+	massert(matcher->list_built);
285 284
 	{
286 285
 		size_t real_len    = strlen(real_url);
287 286
 		size_t display_len = strlen(display_url);
288
-		size_t buffer_len  = real_len + display_len + 1;
287
+		size_t buffer_len  = hostOnly ? real_len : real_len + display_len + 1;
289 288
 		char*  buffer = cli_malloc(buffer_len+1);
290 289
 		int partcnt,rc;
291 290
 		unsigned long int partoff;
... ...
@@ -294,8 +341,8 @@ int regex_list_match(struct regex_matcher* matcher,const char* real_url,const ch
294 294
 			return CL_EMEM;
295 295
 
296 296
 		strncpy(buffer,real_url,real_len);
297
-		buffer[real_len]=hostOnly ? '\0' : ' ';
298
-		if(!hostOnly) {
297
+		buffer[real_len]= (!is_whitelist && hostOnly) ? '\0' : ' ';
298
+		if(!hostOnly || is_whitelist) {
299 299
 			strncpy(buffer+real_len+1,display_url,display_len);
300 300
 			buffer[buffer_len]=0;
301 301
 		}
... ...
@@ -311,16 +358,13 @@ int regex_list_match(struct regex_matcher* matcher,const char* real_url,const ch
311 311
 	}
312 312
 }
313 313
 
314
-static struct tree_node* tree_root_alloc(void);
315
-
316
-
317 314
 /* node stack */
318 315
 #define NODE_STACK_INITIAL 1024
319 316
 #define NODE_STACK_GROW    4096
320 317
 /* Initialize @stack */
321 318
 static int stack_init(struct node_stack* stack)
322 319
 {
323
-	assert(stack);
320
+	massert(stack);
324 321
 
325 322
 	stack->cnt = 0;
326 323
 	stack->capacity = NODE_STACK_INITIAL;
... ...
@@ -334,7 +378,7 @@ static int stack_init(struct node_stack* stack)
334 334
 /* Reset @stack pointer, but don't realloc */
335 335
 static void stack_reset(struct node_stack* stack)
336 336
 {
337
-	assert(stack);
337
+	massert(stack);
338 338
 
339 339
 	stack->cnt = 0;
340 340
 }
... ...
@@ -342,8 +386,8 @@ static void stack_reset(struct node_stack* stack)
342 342
 /* Push @node on @stack, growing it if necessarry */
343 343
 static inline int stack_push(struct node_stack* stack,struct tree_node* node)
344 344
 {
345
-	assert(stack);
346
-	assert(stack->data);
345
+	massert(stack);
346
+	massert(stack->data);
347 347
 
348 348
 	if(stack->cnt == stack->capacity) {
349 349
 		stack->capacity += NODE_STACK_GROW;
... ...
@@ -358,9 +402,9 @@ static inline int stack_push(struct node_stack* stack,struct tree_node* node)
358 358
 /* Pops node from @stack, doesn't realloc */
359 359
 static inline struct tree_node* stack_pop(struct node_stack* stack)
360 360
 {
361
-	assert(stack);
362
-	assert(stack->data);
363
-	assert(stack->cnt);/*don't pop from empty stack */
361
+	massert(stack);
362
+	massert(stack->data);
363
+	massert(stack->cnt);/*don't pop from empty stack */
364 364
 
365 365
 	return stack->cnt ? stack->data[--stack->cnt] : NULL;
366 366
 }
... ...
@@ -370,7 +414,14 @@ static inline struct tree_node* stack_pop(struct node_stack* stack)
370 370
 /* Initializes @matcher, allocating necesarry substructures */
371 371
 int init_regex_list(struct regex_matcher* matcher)
372 372
 {
373
-	assert(matcher);
373
+	/*
374
+	if(!engine_ok) {
375
+		cli_dbgmsg("Matcher engine not initialized\n");
376
+		return CL_ENULLARG;
377
+	}
378
+	*/
379
+
380
+	massert(matcher);
374 381
 	matcher->list_inited = 0;
375 382
 	matcher->root_hosts = (struct cli_matcher*) cli_calloc(1,sizeof(*matcher->root_hosts));
376 383
 	if(!matcher->root_hosts)
... ...
@@ -420,14 +471,14 @@ int init_regex_list(struct regex_matcher* matcher)
420 420
  * although the name might be confusing, @pattern is not a regex!*/
421 421
 static int add_regex_list_element(struct cli_matcher* root,const char* pattern,char* info)
422 422
 {
423
-       int ret,i;
423
+       int ret;
424 424
        struct cli_ac_patt *new = cli_calloc(1,sizeof(*new));
425
-       size_t len;
425
+       size_t len,i;
426 426
 
427 427
        if(!new)
428 428
 	       return CL_EMEM;
429
-       assert(root);
430
-       assert(pattern);
429
+       massert(root);
430
+       massert(pattern);
431 431
 
432 432
        len = strlen(pattern);
433 433
        new->type = 0;
... ...
@@ -450,7 +501,7 @@ static int add_regex_list_element(struct cli_matcher* root,const char* pattern,c
450 450
        for(i=0;i<len;i++)
451 451
 	       new->pattern[i]=pattern[i];/*new->pattern is short int* */
452 452
 
453
-       new->virname = info;
453
+       new->virname = strdup(info);
454 454
        if((ret = cli_ac_addpatt(root,new))) {
455 455
 	       free(new->virname);
456 456
                free(new->pattern);
... ...
@@ -460,39 +511,33 @@ static int add_regex_list_element(struct cli_matcher* root,const char* pattern,c
460 460
        return CL_SUCCESS;
461 461
 }
462 462
 
463
-
464
-#ifndef NDEBUG
465
-void dump_tree(struct tree_node* root);
466
-#endif
467
-
468
-static int build_regex_list(struct regex_matcher* matcher);
469 463
 /* Load patterns/regexes from file */
470
-int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options)
464
+int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist)
471 465
 {
472 466
 	int rc,line=0;
473 467
 	char buffer[FILEBUFF];
474 468
 
475
-	assert(matcher);
476
-	assert(fd);
469
+	massert(matcher);
470
+	massert(fd);
477 471
 
478 472
 	if(matcher->list_inited==-1)
479
-		return -1;
473
+		return CL_EMALFDB; /* already failed to load */
480 474
 	if(matcher->list_loaded) {
481 475
 		cli_warnmsg("Regex list has already been loaded, ignoring further requests for load\n");
482
-		return -1;/*TODO: better return code*/
476
+		return CL_SUCCESS;
483 477
 	}
484 478
 	if(!fd) {
485 479
 		cli_errmsg("Unable to load regex list (null file)\n");
486
-		return -1;/*TODO: return appropiate return code*/
480
+		return CL_EIO;
487 481
 	}
488 482
 
489 483
 	cli_dbgmsg("Loading regex_list\n");
490 484
 	if(!matcher->list_inited) {
491
-		init_regex_list(matcher);
485
+		rc = init_regex_list(matcher);
492 486
 		if (!matcher->list_inited) {
493 487
 			cli_errmsg("Regex list failed to initialize!\n");
494 488
 			fatal_error(matcher);
495
-			return -1;
489
+			return rc;
496 490
 		}
497 491
 		/*atexit(regex_list_done); TODO: destroy this in manager.c */
498 492
 	}
... ...
@@ -523,19 +568,25 @@ int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int optio
523 523
 			return CL_EMALFDB;
524 524
 		}
525 525
 		pattern[0]='\0';
526
-		flags=strdup(buffer+1);
526
+		flags = buffer+1;
527 527
 		pattern++;
528
-		if(buffer[0] == 'R') {
528
+		if((buffer[0] == 'R' && !is_whitelist) || (buffer[0] == 'X' && !is_whitelist)) {/*regex*/
529 529
 			if(( rc = add_pattern(matcher,(const unsigned char*)pattern,flags) ))
530 530
 				return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB;
531 531
 		}
532
-		else if(buffer[0] == 'H') {
532
+		else if(buffer[0] == 'H' && !is_whitelist) {/*matches displayed host*/
533
+			if(( rc = add_regex_list_element(matcher->root_hosts,pattern,flags) ))
534
+				return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB;
535
+		} 
536
+		else if(buffer[0] == 'M' && is_whitelist) {/*matches real host <-> displayed host */							
533 537
 			if(( rc = add_regex_list_element(matcher->root_hosts,pattern,flags) ))
534 538
 				return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB;
535 539
 		}
536 540
 		else {
541
+			return CL_EMALFDB;
542
+			/* this is useless, we have host, and regex matches
537 543
 			if(( rc = add_regex_list_element(matcher->root_urls,pattern,flags) ))
538
-				return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB;
544
+				return rc==CL_EMEM ? CL_EMEM : CL_EMALFDB;*/
539 545
 		}
540 546
 	}
541 547
 	matcher->list_loaded = 1;
... ...
@@ -556,8 +607,8 @@ int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int optio
556 556
 /*
557 557
 static void tree_node_merge_nonbin(struct tree_node* into,const struct tree_node* node)
558 558
 {
559
-	assert(into);
560
-	assert(node);
559
+	massert(into);
560
+	massert(node);
561 561
 
562 562
 	if(node->alternatives){
563 563
 		if(node->u.children[0]->next == node) {
... ...
@@ -610,11 +661,11 @@ static struct tree_node ** tree_node_get_children(const struct tree_node* node)
610 610
 static void regex_list_dobuild(struct tree_node* called_from,struct tree_node* node)
611 611
 {
612 612
 	struct tree_node **children;
613
-	assert(node);
613
+	massert(node);
614 614
 
615 615
 	children = tree_node_get_children(node);
616 616
 	if(node->op!=OP_ROOT)
617
-		assert(called_from);
617
+		massert(called_from);
618 618
 	if(node->op==OP_TMP_PARCLOSE) {
619 619
 		const size_t array_size = (node->alternatives +(called_from->op==OP_CUSTOMCLASS ? 1:0))*sizeof(*called_from->u.children);
620 620
 		if(node->c)
... ...
@@ -624,9 +675,9 @@ static void regex_list_dobuild(struct tree_node* called_from,struct tree_node* n
624 624
 		* copy children to called_from from this node
625 625
 		 * called_from should have 0 alternatives, and a link to this node via ->u.children[0]
626 626
 		 * *
627
-		assert(called_from->alternatives == 0);
628
-		assert(called_from->u.children);
629
-		assert(called_from->u.children[0] == node);
627
+		massert(called_from->alternatives == 0);
628
+		massert(called_from->u.children);
629
+		massert(called_from->u.children[0] == node);
630 630
 		called_from->u.children = cli_realloc(called_from->u.children,array_size);
631 631
 		called_from->u.children = node->u.children;
632 632
 		called_from->alternatives = node->alternatives;
... ...
@@ -634,7 +685,7 @@ static void regex_list_dobuild(struct tree_node* called_from,struct tree_node* n
634 634
 			* fix parent pointers *
635 635
 			int i;TODO: do a deep copy of children here
636 636
 			struct tree_node **from_children = tree_node_get_children(called_from);
637
-                        assert(from_children);
637
+                        massert(from_children);
638 638
 			for(i=0;i < called_from->alternatives;i++) {
639 639
 				struct tree_node* p;
640 640
 				for(p=from_children[i];p->next != node; p = p->next);
... ...
@@ -648,7 +699,7 @@ static void regex_list_dobuild(struct tree_node* called_from,struct tree_node* n
648 648
 	else if (node->alternatives) {
649 649
 		int i;
650 650
 		struct tree_node* p;
651
-		assert(children);
651
+		massert(children);
652 652
 		p = children[0]->op==OP_LEAF ? NULL : children[0]->next;
653 653
 		for(i=0;i<node->alternatives;i++)
654 654
 			regex_list_dobuild(node,children[i]);
... ...
@@ -666,6 +717,7 @@ static void regex_list_dobuild(struct tree_node* called_from,struct tree_node* n
666 666
 	*free(node);*
667 667
 }
668 668
 */
669
+
669 670
 /* Build the matcher list */
670 671
 static int build_regex_list(struct regex_matcher* matcher)
671 672
 {
... ...
@@ -681,12 +733,10 @@ static int build_regex_list(struct regex_matcher* matcher)
681 681
 	return CL_SUCCESS;
682 682
 }
683 683
 
684
-
685
-static void stack_destroy(struct node_stack* stack);
686 684
 /* Done with this matcher, free resources */
687 685
 void regex_list_done(struct regex_matcher* matcher)
688 686
 {
689
-	assert(matcher);
687
+	massert(matcher);
690 688
 
691 689
 	regex_list_cleanup(matcher);
692 690
 	if(matcher->list_loaded) {
... ...
@@ -710,74 +760,40 @@ void regex_list_done(struct regex_matcher* matcher)
710 710
 }
711 711
 
712 712
 /* Tree matcher algorithm */
713
-
714
-static int cli_iswctype(const char c,const enum wctype_t type)
715
-{
716
-	switch(type) {
717
-		case ALNUM:
718
-			return isalnum(c);
719
-		case DIGIT:
720
-			return isdigit(c);
721
-		case PUNCT:
722
-			return ispunct(c);
723
-		case ALPHA:
724
-			return isalpha(c);
725
-		case GRAPH:
726
-			return isgraph(c);
727
-		case SPACE:
728
-			return isspace(c);
729
-		case BLANK:
730
-			return c=='\t' || c==' ';
731
-		case LOWER:
732
-			return islower(c);
733
-		case UPPER:
734
-			return isupper(c);
735
-		case CNTRL:
736
-			return iscntrl(c);
737
-		case PRINT:
738
-			return isprint(c);
739
-		case XDIGIT:
740
-			return isxdigit(c);
741
-		default: {
742
-				 cli_warnmsg("Unknown char class in iswctype\n");
743
-	 			 return 0;
744
-			 }
745
-	}
746
-}
747
-
748
-
749
-
750 713
 struct token_t
751 714
 {
752
-	size_t len;
753
-	char   type;
754 715
 	union {
755
-		unsigned char* start;
756
-		char_bitmap_p        bitmap;
716
+		const unsigned char* start;
717
+		char_bitmap_p  bitmap;
718
+		unsigned char  c;
757 719
 	} u;
720
+	size_t len;
721
+	char   type;
758 722
 };
759 723
 
760 724
 enum {TOKEN_CHAR,TOKEN_DOT,TOKEN_PAR_OPEN,TOKEN_PAR_CLOSE,TOKEN_BRACKET,TOKEN_ALT,TOKEN_REGEX,TOKEN_DONE};
761 725
 
762 726
 static const unsigned char* getNextToken(const unsigned char* pat,struct token_t* token)
763 727
 {
764
-	assert(pat);
765
-	assert(token);
728
+	massert(pat);
729
+	massert(token);
766 730
 
767 731
 	switch(*pat) {
768 732
 		case '\\':
769 733
 			token->type=TOKEN_CHAR;
770
-			token->u.start = ++pat;
771
-			if(islower(*token->u.start)) {
734
+			token->u.c = *(++pat);
735
+			if(islower(token->u.c)) {
772 736
 				/* handle \n, \t, etc. */
773 737
 				char fmt[3] = {'\\', '\0', '\0'};
774 738
 				char c;
775 739
 
776
-				fmt[1] = *token->u.start;
777
-				if(snprintf(&c,1,fmt)!=1)
740
+				fmt[1] = token->u.c;
741
+				if(snprintf(&c,1,fmt)!=1) {
778 742
 					token->type=TOKEN_REGEX;
743
+					token->u.start = pat;
744
+				}
779 745
 				else
780
-					*token->u.start=c;
746
+					token->u.c=c;
781 747
 			}
782 748
 			token->len = 1;
783 749
 			break;
... ...
@@ -790,7 +806,7 @@ static const unsigned char* getNextToken(const unsigned char* pat,struct token_t
790 790
 		case '{':
791 791
 		case '}':
792 792
 			token->type=TOKEN_REGEX;
793
-/*			assert(0 && "find_regex_start should have forbidden us from finding regex special chars");*/
793
+/*			massert(0 && "find_regex_start should have forbidden us from finding regex special chars");*/
794 794
 			break;
795 795
 		case '[':
796 796
 			{
... ...
@@ -814,7 +830,7 @@ static const unsigned char* getNextToken(const unsigned char* pat,struct token_t
814 814
 					/* it is a range*/
815 815
 					unsigned char range_end;
816 816
 					unsigned int c;
817
-					assert(range_start);
817
+					massert(range_start);
818 818
 					pat++;
819 819
 					if (pat[0]=='[')
820 820
 						if (pat[1]=='.') {
... ...
@@ -852,7 +868,7 @@ static const unsigned char* getNextToken(const unsigned char* pat,struct token_t
852 852
 
853 853
 							len = end-pat;
854 854
 							for(i=0;i<std_class_cnt;i++)
855
-								if(!strncmp((const char*)pat,std_class[i].classname,len)) {
855
+								if(!strncmp((const char*)pat,std_class[i],len)) {
856 856
 									found=i;
857 857
 									break;
858 858
 								}
... ...
@@ -882,7 +898,7 @@ static const unsigned char* getNextToken(const unsigned char* pat,struct token_t
882 882
 			break;
883 883
 			}
884 884
 		case ']':
885
-			assert(0 && "Encountered ] without matching [");
885
+			massert(0 && "Encountered ] without matching [");
886 886
 			/* bad state */
887 887
 			break;
888 888
 		case '.':
... ...
@@ -896,7 +912,7 @@ static const unsigned char* getNextToken(const unsigned char* pat,struct token_t
896 896
 			break;
897 897
 		default:
898 898
 			token->type=TOKEN_CHAR;
899
-			token->u.start = pat;
899
+			token->u.c = *pat;
900 900
 			token->len=1;
901 901
 			break;
902 902
 	}
... ...
@@ -920,7 +936,7 @@ static const unsigned char* find_regex_start(const unsigned char* pat)
920 920
 	char lasttype = -1;
921 921
 	if(!altpositions)
922 922
 		return NULL;
923
-	assert(pat);
923
+	massert(pat);
924 924
 
925 925
 	/* Try to parse pattern till special regex chars are encountered, that the tree-matcher doesn't handle, like: +,*,{}.
926 926
 	 * The tricky part is that once we encounter these, the previous 'atom' has to be passed on to the regex matcher, so we have to
... ...
@@ -954,7 +970,7 @@ static const unsigned char* find_regex_start(const unsigned char* pat)
954 954
 			} else if (lasttype==TOKEN_PAR_CLOSE) {
955 955
 				/* remove last stored position from stack, succesfully this last group */
956 956
 				altpositions_cnt--;
957
-				assert(altpositions_cnt>0);
957
+				massert(altpositions_cnt>0);
958 958
 			}
959 959
 		}
960 960
 		else {
... ...
@@ -990,19 +1006,20 @@ static struct tree_node* tree_root_alloc(void)
990 990
 	}
991 991
 	return root;
992 992
 }
993
+
993 994
 static inline struct tree_node* tree_node_char_binsearch(const struct tree_node* node,const char csearch,int* left)
994 995
 {
995 996
 	int right;
996 997
 	struct tree_node **children;
997
-	assert(node);
998
-	assert(left);
998
+	massert(node);
999
+	massert(left);
999 1000
 
1000 1001
 	children = tree_node_get_children(node);
1001 1002
 	right = node->alternatives-1;
1002 1003
 	*left = 0;
1003 1004
 	if(!node->alternatives)
1004 1005
 		return NULL;
1005
-	assert(children);
1006
+	massert(children);
1006 1007
 	while(*left<=right) {
1007 1008
 		int mid  = *left+(right-*left)/2;
1008 1009
 		if(children[mid]->c == csearch)
... ...
@@ -1018,7 +1035,7 @@ static inline struct tree_node* tree_node_char_binsearch(const struct tree_node*
1018 1018
 static inline struct tree_node* tree_get_next(struct tree_node* node)
1019 1019
 {
1020 1020
 	struct tree_node** children;
1021
-	assert(node);
1021
+	massert(node);
1022 1022
 	children = tree_node_get_children(node);
1023 1023
 
1024 1024
 	if(!node->alternatives && children && children[0])
... ...
@@ -1031,7 +1048,7 @@ static inline struct tree_node* tree_get_next(struct tree_node* node)
1031 1031
 
1032 1032
 static inline size_t tree_node_get_array_size(const struct tree_node* node)
1033 1033
 {
1034
-	assert(node);
1034
+	massert(node);
1035 1035
 	/* if op is CUSTOMCLASS, then first pointer is pointer to bitmap, so array size is +1 */
1036 1036
 	return (node->alternatives + (node->op==OP_CUSTOMCLASS ? 1 : 0)) * sizeof(node->u.children[0]);
1037 1037
 }
... ...
@@ -1039,11 +1056,14 @@ static inline size_t tree_node_get_array_size(const struct tree_node* node)
1039 1039
 static inline struct tree_node* tree_node_char_insert(struct tree_node* node,const char c,int left)
1040 1040
 {
1041 1041
 	struct tree_node* new, *alt = tree_get_next(node);
1042
+	struct tree_node **children;
1042 1043
 	node->alternatives++;
1043 1044
 	node->u.children = cli_realloc(node->u.children,tree_node_get_array_size(node));
1044 1045
 	if(!node->u.children)
1045 1046
 		return NULL;
1046 1047
 
1048
+	children = node->op==OP_CUSTOMCLASS ? node->u.children+1 : node->u.children;
1049
+
1047 1050
 	new = tree_node_alloc(alt , node == alt );
1048 1051
 	if(new) {
1049 1052
 		new->op=OP_CHAR;
... ...
@@ -1051,8 +1071,8 @@ static inline struct tree_node* tree_node_char_insert(struct tree_node* node,con
1051 1051
 	}
1052 1052
 
1053 1053
 	if(node->alternatives-left-1>0)
1054
-			memmove(&node->u.children[left+1],&node->u.children[left],(node->alternatives-left-1)*sizeof(node->u.children[0]));
1055
-	node->u.children[left] = new;	
1054
+			memmove(&children[left+1],&children[left],(node->alternatives-left-1)*sizeof(node->u.children[0]));
1055
+	children[left] = new;	
1056 1056
 
1057 1057
 	return new;
1058 1058
 }
... ...
@@ -1060,12 +1080,12 @@ static inline struct tree_node* tree_node_char_insert(struct tree_node* node,con
1060 1060
 static inline void tree_node_insert_nonbin(struct tree_node* node, struct tree_node* new)
1061 1061
 {
1062 1062
 	struct tree_node **children;
1063
-	assert(node);
1064
-	assert(new);
1063
+	massert(node);
1064
+	massert(new);
1065 1065
 
1066 1066
 	children = tree_node_get_children(node);
1067 1067
 	if(node->alternatives) {
1068
-		assert(children);
1068
+		massert(children);
1069 1069
 	       	if(children[0]->next == node) {
1070 1070
 			int i;
1071 1071
 			new->listend = 1;
... ...
@@ -1077,7 +1097,7 @@ static inline void tree_node_insert_nonbin(struct tree_node* node, struct tree_n
1077 1077
 		else {
1078 1078
 			struct tree_node* p;
1079 1079
 			for(p = children[0]->next ; p->next != node ; p = p->next)
1080
-				assert(!p->listend);
1080
+				massert(!p->listend);
1081 1081
 			new->listend = 1;
1082 1082
 			p->listend = 0;
1083 1083
 			p->next = new;
... ...
@@ -1105,7 +1125,7 @@ static inline void tree_node_insert_nonbin(struct tree_node* node, struct tree_n
1105 1105
 static inline unsigned char char_getclass(const unsigned char* bitmap)
1106 1106
 {
1107 1107
 	size_t i;
1108
-	assert(bitmap);
1108
+	massert(bitmap);
1109 1109
 
1110 1110
 	for(i=0;i<std_class_cnt;i++)
1111 1111
 		if(!memcmp(bitmap,char_class_bitmap[i],256>>3))
... ...
@@ -1115,18 +1135,17 @@ static inline unsigned char char_getclass(const unsigned char* bitmap)
1115 1115
 
1116 1116
 static void stack_destroy(struct node_stack* stack)
1117 1117
 {
1118
-	assert(stack);
1118
+	massert(stack);
1119 1119
 	if(stack->data)
1120 1120
 		free(stack->data);
1121 1121
 	stack->data = NULL;
1122 1122
 	stack->capacity = 0;
1123 1123
 }
1124 1124
 
1125
-
1126 1125
 /* call this after whitelist load is complete, and the tree is no longer going to be modified */
1127 1126
 void regex_list_cleanup(struct regex_matcher* matcher)
1128 1127
 {
1129
-	assert(matcher);
1128
+	massert(matcher);
1130 1129
 
1131 1130
 	stack_destroy(&matcher->node_stack);
1132 1131
 	stack_destroy(&matcher->node_stack_alt);
... ...
@@ -1136,7 +1155,7 @@ void regex_list_cleanup(struct regex_matcher* matcher)
1136 1136
 
1137 1137
 int is_regex_ok(struct regex_matcher* matcher)
1138 1138
 {
1139
-	assert(matcher);
1139
+	massert(matcher);
1140 1140
 	return (!matcher->list_inited || matcher->list_inited!=-1);/* either we don't have a regexlist, or we initialized it successfully */
1141 1141
 }
1142 1142
 
... ...
@@ -1148,7 +1167,7 @@ static int add_pattern(struct regex_matcher* matcher,const unsigned char* pat,co
1148 1148
 	struct token_t token;
1149 1149
 	struct tree_node* node;
1150 1150
 	
1151
-	assert(matcher);
1151
+	massert(matcher);
1152 1152
 
1153 1153
 	node = matcher->root_regex;
1154 1154
 
... ...
@@ -1171,12 +1190,12 @@ static int add_pattern(struct regex_matcher* matcher,const unsigned char* pat,co
1171 1171
 				{
1172 1172
 					/* search for char in tree */
1173 1173
 					int left;
1174
-					struct tree_node* newnode = tree_node_char_binsearch(node,*token.u.start,&left);
1174
+					struct tree_node* newnode = tree_node_char_binsearch(node,token.u.c,&left);
1175 1175
 					if(newnode)
1176 1176
 						node = newnode;
1177 1177
 					else {
1178 1178
 						/* not found, insert it */
1179
-						node = tree_node_char_insert(node,*token.u.start,left);
1179
+						node = tree_node_char_insert(node,token.u.c,left);
1180 1180
 					}
1181 1181
 					break;
1182 1182
 				}
... ...
@@ -1210,7 +1229,7 @@ static int add_pattern(struct regex_matcher* matcher,const unsigned char* pat,co
1210 1210
 			case TOKEN_BRACKET:
1211 1211
 				{
1212 1212
 					struct tree_node* new = tree_node_alloc(tree_get_next(node),1);
1213
-					unsigned char charclass = char_getclass(token.u.start);
1213
+					unsigned char charclass = char_getclass(token.u.bitmap);
1214 1214
 					if(charclass == std_class_cnt) {/*not a std char class*/
1215 1215
 						new->op = OP_CUSTOMCLASS;
1216 1216
 						new->u.children = cli_malloc(sizeof(new->u.children[0])*2);
... ...
@@ -1240,7 +1259,7 @@ static int add_pattern(struct regex_matcher* matcher,const unsigned char* pat,co
1240 1240
 			case TOKEN_REGEX:
1241 1241
 			case TOKEN_DONE: {
1242 1242
 						 struct leaf_info* leaf=cli_malloc(sizeof(*leaf));
1243
-						 leaf->info=info;/*don't strdup, already done by caller*/
1243
+						 leaf->info=strdup(info);
1244 1244
 						 if(token.type==TOKEN_REGEX) {
1245 1245
 							 int rc;
1246 1246
 							 struct tree_node* new;
... ...
@@ -1279,9 +1298,9 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1279 1279
 	struct tree_node** children;
1280 1280
 	int rc;
1281 1281
 
1282
-	assert(node);
1283
-	assert(c);
1284
-	assert(info);
1282
+	massert(node);
1283
+	massert(c);
1284
+	massert(info);
1285 1285
 
1286 1286
 	if(!node->u.children)
1287 1287
 		return MATCH_FAILED;/* tree empty */
... ...
@@ -1289,7 +1308,7 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1289 1289
 	len++;
1290 1290
 	c--;
1291 1291
 	for(;;) {
1292
-		assert(node);
1292
+		massert(node);
1293 1293
 		children = node->u.children;
1294 1294
 		switch(node->op) {
1295 1295
 			case OP_ROOT:
... ...
@@ -1302,7 +1321,7 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1302 1302
 				rc=1;
1303 1303
 				break;
1304 1304
 			case OP_CHAR:
1305
-				assert(*c==node->c && "We know this has to match");
1305
+				massert(*c==node->c && "We know this has to match");
1306 1306
 				rc = 1;/* *c==node->c;- we know it has matched */
1307 1307
 				break;
1308 1308
 			case OP_DOT:	
... ...
@@ -1314,7 +1333,7 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1314 1314
 			case OP_CUSTOMCLASS:
1315 1315
 			{
1316 1316
 				char_bitmap_p bitmap;
1317
-				assert(children);
1317
+				massert(children);
1318 1318
 				bitmap = (char_bitmap_p)node->u.bitmap[0];
1319 1319
 				children++;
1320 1320
 				rc = bitmap[*c>>3]&(1<<(*c&0x7));
... ...
@@ -1328,7 +1347,7 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1328 1328
 					rc = !regexec(leaf->preg,(const char*)c,0,NULL,0);
1329 1329
 				}
1330 1330
 				else  {
1331
-					assert(*c==node->c && "We know this has to match[2]");
1331
+					massert(*c==node->c && "We know this has to match[2]");
1332 1332
 					rc = 1;
1333 1333
 				}
1334 1334
 				if(rc) {
... ...
@@ -1351,7 +1370,7 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1351 1351
 			int mid;
1352 1352
 			/*matched so far, go deeper*/
1353 1353
 			/*do a binary search between children */
1354
-			assert(children);
1354
+			massert(children);
1355 1355
 			while(left<=right) {
1356 1356
 				mid  = left+(right-left)/2;
1357 1357
 				if (children[mid]->c == csearch)
... ...
@@ -1363,7 +1382,7 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1363 1363
 			}
1364 1364
 			if(left<=right) {
1365 1365
 				node = children[mid];
1366
-				assert(node);
1366
+				massert(node);
1367 1367
 			}
1368 1368
 			else {
1369 1369
 				if(node->alternatives) {
... ...
@@ -1388,8 +1407,8 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1388 1388
 					if(node->op==OP_PARCLOSE) 
1389 1389
 						rewrite_next = node;
1390 1390
 					node = children[0];
1391
-					assert(node);
1392
-					assert(node->op!=OP_CHAR);
1391
+					massert(node);
1392
+					massert(node->op!=OP_CHAR);
1393 1393
 					if(rewrite_next)
1394 1394
 						node->next = rewrite_next;/* this node is pointed to by several parent nodes, 
1395 1395
 									     we need to know 
... ...
@@ -1421,8 +1440,8 @@ static int match_node(struct tree_node* node,const unsigned char* c,size_t len,c
1421 1421
 static inline void stack_push_once(struct node_stack* stack,struct tree_node* node)
1422 1422
 {
1423 1423
 	size_t i;
1424
-	assert(stack);
1425
-	assert(node);
1424
+	massert(stack);
1425
+	massert(node);
1426 1426
 
1427 1427
 	for(i=0;i < stack->cnt;i++)
1428 1428
 		if(stack->data[i]==node)
... ...
@@ -1433,8 +1452,8 @@ static inline void stack_push_once(struct node_stack* stack,struct tree_node* no
1433 1433
 static void destroy_tree_internal(struct regex_matcher* matcher,struct tree_node* node)
1434 1434
 {
1435 1435
 	struct tree_node **children;
1436
-	assert(matcher);
1437
-	assert(node);
1436
+	massert(matcher);
1437
+	massert(node);
1438 1438
 
1439 1439
 	children = tree_node_get_children(node);
1440 1440
 	if(node->op==OP_LEAF) {
... ...
@@ -1457,7 +1476,7 @@ static void destroy_tree_internal(struct regex_matcher* matcher,struct tree_node
1457 1457
 	if(node->alternatives) {
1458 1458
 		int i;
1459 1459
 		struct tree_node* p;
1460
-		assert(children);
1460
+		massert(children);
1461 1461
 		p = children[0]->op==OP_LEAF ? NULL : children[0]->next;
1462 1462
 		for(i=0;i<node->alternatives;i++)
1463 1463
 			destroy_tree_internal(matcher,children[i]);
... ...
@@ -1486,7 +1505,7 @@ static void destroy_tree(struct regex_matcher* matcher)
1486 1486
 	/* we might have the same node linked by different nodes, so a recursive walk&free doesn't work in all situations,
1487 1487
 	 * i.e. it might double-free, so instead of freeing, just push the nodes on a stack, and later free the nodes in that stack,
1488 1488
 	 * (and push to stack only if it doesn't contain it already*/
1489
-	assert(matcher);
1489
+	massert(matcher);
1490 1490
 
1491 1491
 	stack_reset(&matcher->node_stack);
1492 1492
 	destroy_tree_internal(matcher,matcher->root_regex);
... ...
@@ -1500,7 +1519,7 @@ static void dump_node(struct tree_node* node)
1500 1500
 {
1501 1501
 	int i;
1502 1502
 	struct tree_node* p,**children;
1503
-	assert(node);
1503
+	massert(node);
1504 1504
 	if(node->op==OP_LEAF) {
1505 1505
 		if(node->u.leaf->preg)
1506 1506
 			printf("n%p [label=\"regex\\nleaf\"]",(void*)node);
... ...
@@ -1518,13 +1537,13 @@ static void dump_node(struct tree_node* node)
1518 1518
 	printf("n%p -> {",(void*)node);/*using address of node as id*/
1519 1519
 	children = tree_node_get_children(node);
1520 1520
 	if(node->alternatives)
1521
-		assert(children);
1521
+		massert(children);
1522 1522
 	for(i=0;i<node->alternatives;i++)
1523 1523
 		printf("n%p ",(void*)children[i]);
1524 1524
 	if(node->alternatives && children[0]->op!=OP_LEAF)
1525 1525
 		for(p=children[0]->next;p!=node;p=p->next)
1526 1526
 		{
1527
-			assert(p);
1527
+			massert(p);
1528 1528
 			printf("n%p ",(void*)p);
1529 1529
 			if(p->op==OP_LEAF || p->listend)
1530 1530
 				break;
... ...
@@ -1561,7 +1580,7 @@ static void dump_node(struct tree_node* node)
1561 1561
 void dump_tree(struct tree_node* root)
1562 1562
 {
1563 1563
 	/*use dot/dotty from graphviz to view it*/
1564
-	assert(root);
1564
+	massert(root);
1565 1565
 	printf("digraph tree {\n");
1566 1566
 	dump_node(root);
1567 1567
 	printf("}\n");
... ...
@@ -25,6 +25,18 @@
25 25
 #ifndef _REGEX_LIST_H
26 26
 #define _REGEX_LIST_H
27 27
 
28
+
29
+
30
+#ifdef NDEBUG
31
+#define massert(x) (void)(0)
32
+#else
33
+/*debug version, massert enabled*/
34
+
35
+#define __massert_fail(expr,file,line) (void)cli_errmsg("Assertion failed at %s:%d\n %s\n",file,line,expr)
36
+
37
+#define massert(expr) ((void) ((expr) ? (void)0 : (__massert_fail (#expr,__FILE__,__LINE__))))
38
+#endif
39
+
28 40
 struct node_stack {
29 41
 	struct tree_node** data;
30 42
 	size_t capacity;
... ...
@@ -42,9 +54,9 @@ struct regex_matcher {
42 42
 	struct node_stack node_stack_alt;
43 43
 };
44 44
 
45
-int regex_list_match(struct regex_matcher* matcher,const char* real_url,const char* display_url,int hostOnly,const char** info);
45
+int regex_list_match(struct regex_matcher* matcher,const char* real_url,const char* display_url,int hostOnly,const char** info,int is_whitelist);
46 46
 int init_regex_list(struct regex_matcher* matcher);
47
-int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options);
47
+int load_regex_matcher(struct regex_matcher* matcher,FILE* fd,unsigned int options,int is_whitelist);
48 48
 void regex_list_cleanup(struct regex_matcher* matcher);
49 49
 void regex_list_done(struct regex_matcher* matcher);
50 50
 int is_regex_ok(struct regex_matcher* matcher);