git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@549 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2004/05/10 07:11:30... | ... |
@@ -63,6 +63,7 @@ Kamil Andrusz <wizz*mniam.net> |
63 | 63 |
Patrick Bihan-Faou <patrick*mindstep.com> |
64 | 64 |
Len Budney <lbudney*pobox.com> |
65 | 65 |
Andrey Cherezov <andrey*cherezov.koenig.su> |
66 |
+Alex Cherney <alex*cher.id.au> |
|
66 | 67 |
Tom G. Christensen <tgc*statsbiblioteket.dk> |
67 | 68 |
Damien Curtain <damien*pagefault.org> |
68 | 69 |
Michael Dankov <misha*btrc.ru> |
... | ... |
@@ -1,12 +1,20 @@ |
1 |
+Mon May 10 00:05:23 CEST 2004 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamscan: + allow regular expressions in --[in|ex]clude (patch by |
|
4 |
+ Alex Cherney <alex*cher.id.au>) |
|
5 |
+ + do not overwrite old files in quarantine directory (Alex |
|
6 |
+ Cherney) |
|
7 |
+ * configure/Makefiles: improve NetBSD support |
|
8 |
+ |
|
1 | 9 |
Sun May 9 18:40:55 BST 2004 (njh) |
2 | 10 |
---------------------------------- |
3 | 11 |
* clamav-milter: Ensure a thread wakes up when another thread dies |
4 |
- Fix from Damian Menscher <menscher@uiuc.edu> ensures |
|
12 |
+ Fix from Damian Menscher <menscher*uiuc.edu> ensures |
|
5 | 13 |
Only report that we've dropped privilege if the setuid |
6 |
- succeeded, fix by Jens Elkner <elkner@linofee.org> |
|
14 |
+ succeeded, fix by Jens Elkner <elkner*linofee.org> |
|
7 | 15 |
If logVerbose is set state both starting and started |
8 | 16 |
messages (based on an idea by "Sergey Y. Afonin" |
9 |
- <asy@kraft-s.ru> |
|
17 |
+ <asy*kraft-s.ru> |
|
10 | 18 |
Also added X-Infected-Received-From: header by Sergey |
11 | 19 |
Report an error if inet_ntop fails in tcp_wrappers |
12 | 20 |
* docs/man: Clarified suggested use of max-children only on |
... | ... |
@@ -81,7 +81,7 @@ dnl there is now a CREATE_PREFIX_TARGET_H in this file as a shorthand for |
81 | 81 |
dnl PREFIX_CONFIG_H from a target.h file, however w/o the target.h ever created |
82 | 82 |
dnl (the prefix is a bit different, since we add an extra -target- and -host-) |
83 | 83 |
dnl |
84 |
-dnl @version: $Id: aclocal.m4,v 1.35 2004/04/20 22:33:18 kojm Exp $ |
|
84 |
+dnl @version: $Id: aclocal.m4,v 1.36 2004/05/09 22:11:29 kojm Exp $ |
|
85 | 85 |
dnl @author Guido Draheim <guidod@gmx.de> STATUS: used often |
86 | 86 |
|
87 | 87 |
AC_DEFUN([AC_CREATE_TARGET_H], |
... | ... |
@@ -4041,7 +4041,7 @@ dnl AC_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers) |
4041 | 4041 |
dnl AC_COMPILE_CHECK_SIZEOF(off_t, $headers) |
4042 | 4042 |
dnl |
4043 | 4043 |
dnl @author Kaveh Ghazi <ghazi@caip.rutgers.edu> |
4044 |
-dnl @version $Id: aclocal.m4,v 1.35 2004/04/20 22:33:18 kojm Exp $ |
|
4044 |
+dnl @version $Id: aclocal.m4,v 1.36 2004/05/09 22:11:29 kojm Exp $ |
|
4045 | 4045 |
dnl |
4046 | 4046 |
AC_DEFUN([AC_COMPILE_CHECK_SIZEOF], |
4047 | 4047 |
[changequote(<<, >>)dnl |
... | ... |
@@ -37,6 +37,6 @@ endif |
37 | 37 |
|
38 | 38 |
DEFS = @DEFS@ -DSENDMAIL_BIN=\"@SENDMAIL@\" |
39 | 39 |
# CLAMD_LIBS is used, because clamav-milter requires the same libraries as clamd |
40 |
-LIBS = -L$(top_builddir)/libclamav -lclamav -L/usr/lib/libmilter -lmilter @CLAMAV_MILTER_LIBS@ |
|
40 |
+LIBS = -L$(top_builddir)/libclamav -lclamav -L/usr/lib/libmilter -lmilter @CLAMAV_MILTER_LIBS@ @ADDITIONAL_LIBS@ |
|
41 | 41 |
INCLUDES = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_srcdir)/shared |
42 | 42 |
EXTRA_DIST = clamav-milter.c INSTALL |
... | ... |
@@ -85,6 +85,7 @@ target_triplet = @target@ |
85 | 85 |
EXEEXT = @EXEEXT@ |
86 | 86 |
OBJEXT = @OBJEXT@ |
87 | 87 |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
88 |
+ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ |
|
88 | 89 |
AMTAR = @AMTAR@ |
89 | 90 |
AS = @AS@ |
90 | 91 |
AWK = @AWK@ |
... | ... |
@@ -134,7 +135,7 @@ install_sh = @install_sh@ |
134 | 134 |
|
135 | 135 |
DEFS = @DEFS@ -DSENDMAIL_BIN=\"@SENDMAIL@\" |
136 | 136 |
# CLAMD_LIBS is used, because clamav-milter requires the same libraries as clamd |
137 |
-LIBS = -L$(top_builddir)/libclamav -lclamav -L/usr/lib/libmilter -lmilter @CLAMAV_MILTER_LIBS@ |
|
137 |
+LIBS = -L$(top_builddir)/libclamav -lclamav -L/usr/lib/libmilter -lmilter @CLAMAV_MILTER_LIBS@ @ADDITIONAL_LIBS@ |
|
138 | 138 |
INCLUDES = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_srcdir)/shared |
139 | 139 |
EXTRA_DIST = clamav-milter.c INSTALL |
140 | 140 |
subdir = clamav-milter |
... | ... |
@@ -61,5 +61,5 @@ clamd_SOURCES = \ |
61 | 61 |
endif |
62 | 62 |
|
63 | 63 |
DEFS = @DEFS@ |
64 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @CLAMD_LIBS@ |
|
64 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @CLAMD_LIBS@ @ADDITIONAL_LIBS@ |
|
65 | 65 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
... | ... |
@@ -85,6 +85,7 @@ target_triplet = @target@ |
85 | 85 |
EXEEXT = @EXEEXT@ |
86 | 86 |
OBJEXT = @OBJEXT@ |
87 | 87 |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
88 |
+ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ |
|
88 | 89 |
AMTAR = @AMTAR@ |
89 | 90 |
AS = @AS@ |
90 | 91 |
AWK = @AWK@ |
... | ... |
@@ -159,7 +160,7 @@ install_sh = @install_sh@ |
159 | 159 |
|
160 | 160 |
|
161 | 161 |
DEFS = @DEFS@ |
162 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @CLAMD_LIBS@ |
|
162 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @CLAMD_LIBS@ @ADDITIONAL_LIBS@ |
|
163 | 163 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
164 | 164 |
subdir = clamd |
165 | 165 |
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
# |
2 |
-# Copyright (C) 2002 Tomasz Kojm <zolw@konarski.edu.pl> |
|
2 |
+# Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net> |
|
3 | 3 |
# |
4 | 4 |
# This program is free software; you can redistribute it and/or modify |
5 | 5 |
# it under the terms of the GNU General Public License as published by |
... | ... |
@@ -36,4 +36,4 @@ clamdscan_LDADD = $(top_builddir)/clamscan/options.o $(top_builddir)/clamscan/ge |
36 | 36 |
endif |
37 | 37 |
|
38 | 38 |
INCLUDES = -I$(top_srcdir)/clamscan -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
39 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ |
|
39 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@ |
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
@SET_MAKE@ |
16 | 16 |
|
17 | 17 |
# |
18 |
-# Copyright (C) 2002 Tomasz Kojm <zolw@konarski.edu.pl> |
|
18 |
+# Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net> |
|
19 | 19 |
# |
20 | 20 |
# This program is free software; you can redistribute it and/or modify |
21 | 21 |
# it under the terms of the GNU General Public License as published by |
... | ... |
@@ -85,6 +85,7 @@ target_triplet = @target@ |
85 | 85 |
EXEEXT = @EXEEXT@ |
86 | 86 |
OBJEXT = @OBJEXT@ |
87 | 87 |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
88 |
+ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ |
|
88 | 89 |
AMTAR = @AMTAR@ |
89 | 90 |
AS = @AS@ |
90 | 91 |
AWK = @AWK@ |
... | ... |
@@ -134,7 +135,7 @@ install_sh = @install_sh@ |
134 | 134 |
@BUILD_CLAMD_TRUE@clamdscan_LDADD = $(top_builddir)/clamscan/options.o $(top_builddir)/clamscan/getopt.o |
135 | 135 |
|
136 | 136 |
INCLUDES = -I$(top_srcdir)/clamscan -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
137 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ |
|
137 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@ |
|
138 | 138 |
subdir = clamdscan |
139 | 139 |
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
140 | 140 |
CONFIG_HEADER = $(top_builddir)/clamav-config.h |
... | ... |
@@ -86,6 +86,7 @@ target_triplet = @target@ |
86 | 86 |
EXEEXT = @EXEEXT@ |
87 | 87 |
OBJEXT = @OBJEXT@ |
88 | 88 |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
89 |
+ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ |
|
89 | 90 |
AMTAR = @AMTAR@ |
90 | 91 |
AS = @AS@ |
91 | 92 |
AWK = @AWK@ |
... | ... |
@@ -140,7 +141,7 @@ clamscan_SOURCES = \ |
140 | 140 |
|
141 | 141 |
|
142 | 142 |
DEFS = @DEFS@ |
143 |
-LIBS = -L$(top_builddir)/libclamav -lclamav |
|
143 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @ADDITIONAL_LIBS@ |
|
144 | 144 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
145 | 145 |
subdir = clamscan |
146 | 146 |
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
... | ... |
@@ -203,8 +203,13 @@ void help(void) |
203 | 203 |
mprintf(" --infected -i Print infected files only\n"); |
204 | 204 |
mprintf(" --remove Remove infected files. Be careful.\n"); |
205 | 205 |
mprintf(" --move=DIRECTORY Move infected files into DIRECTORY\n"); |
206 |
+#ifdef HAVE_REGEX_H |
|
207 |
+ mprintf(" --exclude=REGEX Don't scan file names matching REGEX\n"); |
|
208 |
+ mprintf(" --include=REGEX Only scan file names matching REGEX\n"); |
|
209 |
+#else |
|
206 | 210 |
mprintf(" --exclude=PATT Don't scan file names containing PATT\n"); |
207 | 211 |
mprintf(" --include=PATT Only scan file names containing PATT\n"); |
212 |
+#endif |
|
208 | 213 |
mprintf(" --bell Sound bell on virus detection\n"); |
209 | 214 |
mprintf(" --no-summary Disable summary at end of scanning\n"); |
210 | 215 |
mprintf(" --mbox -m Treat stdin as a mailbox\n"); |
... | ... |
@@ -38,6 +38,10 @@ |
38 | 38 |
#include <clamav.h> |
39 | 39 |
#include <errno.h> |
40 | 40 |
|
41 |
+#ifdef HAVE_REGEX_H |
|
42 |
+#include <regex.h> |
|
43 |
+#endif |
|
44 |
+ |
|
41 | 45 |
#include "defaults.h" |
42 | 46 |
#include "others.h" |
43 | 47 |
#include "options.h" |
... | ... |
@@ -303,6 +307,29 @@ int scanmanager(const struct optstruct *opt) |
303 | 303 |
return ret; |
304 | 304 |
} |
305 | 305 |
|
306 |
+int match_regex(const char *filename, const char *pattern) |
|
307 |
+{ |
|
308 |
+#ifdef HAVE_REGEX_H |
|
309 |
+ regex_t reg; |
|
310 |
+ int match, flags; |
|
311 |
+#ifndef C_CYGWIN |
|
312 |
+ flags = 0; |
|
313 |
+#else |
|
314 |
+ flags = REG_ICASE; /* case insensitive on Windows */ |
|
315 |
+#endif |
|
316 |
+ if(regcomp(®, pattern, flags) != 0) { |
|
317 |
+ mprintf("!%s: Could not parse regular expression %s.\n", filename, pattern); |
|
318 |
+ logg("!%s: Could not parse regular expression %s.\n", filename, pattern); |
|
319 |
+ return 2; |
|
320 |
+ } |
|
321 |
+ match = (regexec(®, filename, 0, NULL, 0) == REG_NOMATCH) ? 0 : 1; |
|
322 |
+ regfree(®); |
|
323 |
+ return match; |
|
324 |
+#else /* HAVE_REGEX_H */ |
|
325 |
+ return strstr(filename, pattern) ? 1 : 0; |
|
326 |
+#endif |
|
327 |
+} |
|
328 |
+ |
|
306 | 329 |
int scanfile(const char *filename, struct cl_node *root, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits) |
307 | 330 |
{ |
308 | 331 |
int ret, options = 0, included; |
... | ... |
@@ -319,12 +346,12 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
319 | 319 |
mprintf("%s: Excluded (/proc).\n", filename); |
320 | 320 |
return 0; |
321 | 321 |
} |
322 |
-#endif |
|
323 |
- |
|
322 |
+#endif |
|
323 |
+ |
|
324 | 324 |
if(optl(opt, "exclude")) { |
325 | 325 |
argument = getfirstargl(opt, "exclude", &optnode); |
326 | 326 |
while (argument) { |
327 |
- if(strstr(filename, argument)) { |
|
327 |
+ if(match_regex(filename, argument) == 1) { |
|
328 | 328 |
if(!printinfected) |
329 | 329 |
mprintf("%s: Excluded.\n", filename); |
330 | 330 |
return 0; |
... | ... |
@@ -332,12 +359,12 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
332 | 332 |
argument = getnextargl(&optnode, "exclude"); |
333 | 333 |
} |
334 | 334 |
} |
335 |
- |
|
336 |
- if(optl(opt, "include")) { |
|
335 |
+ |
|
336 |
+ if(optl(opt, "include")) { |
|
337 | 337 |
included = 0; |
338 | 338 |
argument = getfirstargl(opt, "include",&optnode); |
339 | 339 |
while (argument && !included) { |
340 |
- if(strstr(filename, argument)) |
|
340 |
+ if(match_regex(filename, argument) == 1) |
|
341 | 341 |
included = 1; |
342 | 342 |
argument = getnextargl(&optnode, "include"); |
343 | 343 |
} |
... | ... |
@@ -350,7 +377,6 @@ int scanfile(const char *filename, struct cl_node *root, const struct passwd *us |
350 | 350 |
|
351 | 351 |
} |
352 | 352 |
|
353 |
- |
|
354 | 353 |
if(fileinfo(filename, 1) == 0) { |
355 | 354 |
if(!printinfected) |
356 | 355 |
mprintf("%s: Empty file.\n", filename); |
... | ... |
@@ -920,11 +946,12 @@ int clamav_unpack(const char *prog, char **args, const char *tmpdir, const struc |
920 | 920 |
|
921 | 921 |
void move_infected(const char *filename, const struct optstruct *opt) |
922 | 922 |
{ |
923 |
- char *movedir, *movefilename, *tmp; |
|
923 |
+ char *movedir, *movefilename, *tmp, numext[4 + 1]; |
|
924 | 924 |
struct stat fstat, mfstat; |
925 |
+ int n, len, movefilename_size; |
|
925 | 926 |
|
926 |
- if(!(movedir = getargl(opt, "move"))) |
|
927 |
- { |
|
927 |
+ |
|
928 |
+ if(!(movedir = getargl(opt, "move"))) { |
|
928 | 929 |
/* Should never reach here */ |
929 | 930 |
mprintf("@error moving file '%s'.\n", filename); |
930 | 931 |
mprintf("clamscan: getargc() returned NULL.\n"); |
... | ... |
@@ -933,35 +960,33 @@ void move_infected(const char *filename, const struct optstruct *opt) |
933 | 933 |
return; |
934 | 934 |
} |
935 | 935 |
|
936 |
- if(access(movedir, W_OK|X_OK) == -1) |
|
937 |
- { |
|
936 |
+ if(access(movedir, W_OK|X_OK) == -1) { |
|
938 | 937 |
mprintf("@error moving file '%s'.\n", filename); |
939 | 938 |
mprintf("clamscan: cannot write to '%s': %s.\n", movedir, strerror(errno)); |
940 | 939 |
logg("clamscan: cannot write to '%s': %s.\n", movedir, strerror(errno)); |
941 | 940 |
claminfo.notmoved++; |
942 | 941 |
return; |
943 | 942 |
} |
944 |
- |
|
945 |
- if(!(tmp = strrchr(filename, '/'))) |
|
946 |
- { |
|
943 |
+ |
|
944 |
+ if(!(tmp = strrchr(filename, '/'))) { |
|
947 | 945 |
mprintf("@error moving file '%s'.\n", filename); |
948 | 946 |
mprintf("clamscan: '%s' does not appear to be a valid filename.\n", filename); |
949 | 947 |
logg("clamscan: '%s' does not appear to be a valid filename.\n", filename); |
950 | 948 |
claminfo.notmoved++; |
951 | 949 |
return; |
952 | 950 |
} |
953 |
- |
|
954 |
- if(!(movefilename = malloc(sizeof(char) * (strlen(movedir) + strlen(tmp) + 1)))) |
|
955 |
- { |
|
951 |
+ |
|
952 |
+ movefilename_size = sizeof(char) * (strlen(movedir) + strlen(tmp) + sizeof(numext) + 1); |
|
953 |
+ |
|
954 |
+ if(!(movefilename = malloc(movefilename_size))) { |
|
956 | 955 |
mprintf("@error moving file '%s'.\n", filename); |
957 | 956 |
mprintf("clamscan: malloc() returned NULL.\n"); |
958 | 957 |
logg("clamscan: malloc() returned NULL.\n"); |
959 | 958 |
claminfo.notmoved++; |
960 | 959 |
return; |
961 | 960 |
} |
962 |
- |
|
963 |
- if(!(strrcpy(movefilename, movedir))) |
|
964 |
- { |
|
961 |
+ |
|
962 |
+ if(!(strrcpy(movefilename, movedir))) { |
|
965 | 963 |
mprintf("@error moving file '%s'.\n", filename); |
966 | 964 |
mprintf("clamscan: strrcpy() returned NULL.\n"); |
967 | 965 |
logg("clamscan: strrcpy() returned NULL.\n"); |
... | ... |
@@ -969,9 +994,8 @@ void move_infected(const char *filename, const struct optstruct *opt) |
969 | 969 |
free(movefilename); |
970 | 970 |
return; |
971 | 971 |
} |
972 |
- |
|
973 |
- if(!(strcat(movefilename, tmp))) |
|
974 |
- { |
|
972 |
+ |
|
973 |
+ if(!(strcat(movefilename, tmp))) { |
|
975 | 974 |
mprintf("@error moving file '%s'.\n", filename); |
976 | 975 |
mprintf("clamscan: strcat() returned NULL.\n"); |
977 | 976 |
logg("clamscan: strcat() returned NULL.\n"); |
... | ... |
@@ -979,22 +1003,36 @@ void move_infected(const char *filename, const struct optstruct *opt) |
979 | 979 |
free(movefilename); |
980 | 980 |
return; |
981 | 981 |
} |
982 |
- |
|
982 |
+ |
|
983 | 983 |
stat(filename, &fstat); |
984 | 984 |
|
985 |
- if(!stat(movefilename, &mfstat)) |
|
986 |
- { |
|
985 |
+ if(!stat(movefilename, &mfstat)) { |
|
987 | 986 |
if(fstat.st_ino == mfstat.st_ino) { /* It's the same file*/ |
988 | 987 |
mprintf("clamscan: file excluded '%s'.\n", filename); |
989 | 988 |
logg("clamscan: file excluded '%s'.\n", filename); |
990 | 989 |
claminfo.notmoved++; |
991 | 990 |
free(movefilename); |
992 | 991 |
return; |
993 |
- } |
|
992 |
+ } else { |
|
993 |
+ /* file exists - try to append an ordinal number to the |
|
994 |
+ * quranatined file in an attempt not to overwrite existing |
|
995 |
+ * files in quarantine |
|
996 |
+ */ |
|
997 |
+ len = strlen(movefilename); |
|
998 |
+ n = 0; |
|
999 |
+ do { |
|
1000 |
+ /* reset the movefilename to it's initial value by |
|
1001 |
+ * truncating to the original filename length |
|
1002 |
+ */ |
|
1003 |
+ movefilename[len] = 0; |
|
1004 |
+ /* append .XXX */ |
|
1005 |
+ sprintf(numext, ".%03d", n++); |
|
1006 |
+ strcat(movefilename, numext); |
|
1007 |
+ } while(!stat(movefilename, &mfstat) && (n < 1000)); |
|
1008 |
+ } |
|
994 | 1009 |
} |
995 |
- |
|
996 |
- if(filecopy(filename, movefilename) == -1) |
|
997 |
- { |
|
1010 |
+ |
|
1011 |
+ if(filecopy(filename, movefilename) == -1) { |
|
998 | 1012 |
mprintf("@error moving file '%s'.\n", filename); |
999 | 1013 |
mprintf("clamscan: cannot move '%s' to '%s': %s.\n", filename, movefilename, strerror(errno)); |
1000 | 1014 |
logg("clamscan: cannot move '%s' to '%s': %s.\n", filename, movefilename, strerror(errno)); |
... | ... |
@@ -1005,16 +1043,13 @@ void move_infected(const char *filename, const struct optstruct *opt) |
1005 | 1005 |
|
1006 | 1006 |
chmod(movefilename, fstat.st_mode); |
1007 | 1007 |
chown(movefilename, fstat.st_uid, fstat.st_gid); |
1008 |
- |
|
1009 |
- if(unlink(filename)) |
|
1010 |
- { |
|
1008 |
+ |
|
1009 |
+ if(unlink(filename)) { |
|
1011 | 1010 |
mprintf("@error moving file '%s'.\n", filename); |
1012 | 1011 |
mprintf("clamscan: cannot unlink '%s': %s.\n", filename, strerror(errno)); |
1013 | 1012 |
logg("clamscan: cannot unlink '%s': %s.\n", filename, strerror(errno)); |
1014 | 1013 |
claminfo.notremoved++; |
1015 |
- } |
|
1016 |
- else |
|
1017 |
- { |
|
1014 |
+ } else { |
|
1018 | 1015 |
mprintf("%s: moved to '%s'.\n", filename, movefilename); |
1019 | 1016 |
logg("%s: moved to '%s'.\n", filename, movefilename); |
1020 | 1017 |
} |
... | ... |
@@ -7695,10 +7695,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' |
7695 | 7695 |
|
7696 | 7696 |
|
7697 | 7697 |
|
7698 |
- |
|
7699 |
- |
|
7700 |
- |
|
7701 |
- |
|
7702 | 7698 |
cat >>confdefs.h <<\_ACEOF |
7703 | 7699 |
#define SCANBUFF 131072 |
7704 | 7700 |
_ACEOF |
... | ... |
@@ -7865,7 +7861,8 @@ fi |
7865 | 7865 |
|
7866 | 7866 |
|
7867 | 7867 |
|
7868 |
-for ac_header in stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h |
|
7868 |
+ |
|
7869 |
+for ac_header in stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h regex.h |
|
7869 | 7870 |
do |
7870 | 7871 |
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` |
7871 | 7872 |
if eval "test \"\${$as_ac_Header+set}\" = set"; then |
... | ... |
@@ -8699,6 +8696,8 @@ cat >>confdefs.h <<\_ACEOF |
8699 | 8699 |
#define HAVE_BZLIB_H 1 |
8700 | 8700 |
_ACEOF |
8701 | 8701 |
|
8702 |
+else |
|
8703 |
+ echo "WARNING: Bzip2 support disabled" |
|
8702 | 8704 |
fi |
8703 | 8705 |
|
8704 | 8706 |
|
... | ... |
@@ -9208,7 +9207,6 @@ fi |
9208 | 9208 |
|
9209 | 9209 |
|
9210 | 9210 |
|
9211 |
- |
|
9212 | 9211 |
# Check whether --enable-pthreads or --disable-pthreads was given. |
9213 | 9212 |
if test "${enable_pthreads+set}" = set; then |
9214 | 9213 |
enableval="$enable_pthreads" |
... | ... |
@@ -9702,7 +9700,6 @@ fi |
9702 | 9702 |
rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext |
9703 | 9703 |
fi |
9704 | 9704 |
|
9705 |
- |
|
9706 | 9705 |
case "$target_os" in |
9707 | 9706 |
linux*) |
9708 | 9707 |
|
... | ... |
@@ -9883,7 +9880,7 @@ cat >>confdefs.h <<\_ACEOF |
9883 | 9883 |
#define _REENTRANT 1 |
9884 | 9884 |
_ACEOF |
9885 | 9885 |
|
9886 |
- LIBS="$LIBS -lpthread" |
|
9886 |
+ ADDITIONAL_LIBS="$LIBS -lpthread" |
|
9887 | 9887 |
fi |
9888 | 9888 |
|
9889 | 9889 |
cat >>confdefs.h <<\_ACEOF |
... | ... |
@@ -9923,12 +9920,12 @@ cat >>confdefs.h <<\_ACEOF |
9923 | 9923 |
_ACEOF |
9924 | 9924 |
|
9925 | 9925 |
use_netinfo="yes" |
9926 |
- ;; |
|
9926 |
+ ;; |
|
9927 | 9927 |
sco*) |
9928 | 9928 |
FRESHCLAM_LIBS="-lsocket" |
9929 | 9929 |
CLAMD_LIBS="-lsocket" |
9930 | 9930 |
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket" |
9931 |
- ;; |
|
9931 |
+ ;; |
|
9932 | 9932 |
hpux*) |
9933 | 9933 |
if test "$have_pthreads" = "yes"; then |
9934 | 9934 |
LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread" |
... | ... |
@@ -9997,7 +9994,7 @@ cat >>confdefs.h <<\_ACEOF |
9997 | 9997 |
#define C_IRIX 1 |
9998 | 9998 |
_ACEOF |
9999 | 9999 |
|
10000 |
- ;; |
|
10000 |
+ ;; |
|
10001 | 10001 |
|
10002 | 10002 |
*) |
10003 | 10003 |
;; |
... | ... |
@@ -10011,6 +10008,7 @@ esac |
10011 | 10011 |
|
10012 | 10012 |
|
10013 | 10013 |
|
10014 |
+ |
|
10014 | 10015 |
if test "$have_pthreads" = "yes"; then |
10015 | 10016 |
BUILD_CLAMD_TRUE= |
10016 | 10017 |
BUILD_CLAMD_FALSE='#' |
... | ... |
@@ -11497,6 +11495,7 @@ s,@CLAMD_LIBS@,$CLAMD_LIBS,;t t |
11497 | 11497 |
s,@CLAMAV_MILTER_LIBS@,$CLAMAV_MILTER_LIBS,;t t |
11498 | 11498 |
s,@FRESHCLAM_LIBS@,$FRESHCLAM_LIBS,;t t |
11499 | 11499 |
s,@TH_SAFE@,$TH_SAFE,;t t |
11500 |
+s,@ADDITIONAL_LIBS@,$ADDITIONAL_LIBS,;t t |
|
11500 | 11501 |
s,@BUILD_CLAMD_TRUE@,$BUILD_CLAMD_TRUE,;t t |
11501 | 11502 |
s,@BUILD_CLAMD_FALSE@,$BUILD_CLAMD_FALSE,;t t |
11502 | 11503 |
s,@HAVE_MILTER_TRUE@,$HAVE_MILTER_TRUE,;t t |
... | ... |
@@ -18,7 +18,6 @@ dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | 18 |
AC_INIT(clamscan/clamscan.c) |
19 | 19 |
AC_CREATE_TARGET_H(target.h) |
20 | 20 |
AM_INIT_AUTOMAKE(clamav, "devel-`date +%Y%m%d`") |
21 |
-dnl AM_INIT_AUTOMAKE(clamav, `date +%Y%m%d`) |
|
22 | 21 |
AM_CONFIG_HEADER(clamav-config.h) |
23 | 22 |
|
24 | 23 |
LC_CURRENT=1 |
... | ... |
@@ -34,25 +33,11 @@ AC_PROG_LN_S |
34 | 34 |
AC_PROG_MAKE_SET |
35 | 35 |
AC_PROG_LIBTOOL |
36 | 36 |
|
37 |
-dnl Version numbers for libtool |
|
38 |
- |
|
39 |
-dnl LT_RELEASE=$CLAMAV_MAJOR_VERSION.$CLAMAV_MINOR_VERSION |
|
40 |
-dnl LT_CURRENT=$CLAMAV_MINOR_VERSION |
|
41 |
-dnl LT_REVISION=1 |
|
42 |
-dnl LT_AGE=2 |
|
43 |
- |
|
44 |
-dnl AC_SUBST(LT_RELEASE) |
|
45 |
-dnl AC_SUBST(LT_CURRENT) |
|
46 |
-dnl AC_SUBST(LT_REVISION) |
|
47 |
-dnl AC_SUBST(LT_AGE) |
|
48 |
- |
|
49 |
-dnl BUFFSIZE must be at least 16 kb !!! |
|
50 |
- |
|
51 | 37 |
AC_DEFINE(SCANBUFF, 131072, [scan buffer size]) |
52 | 38 |
AC_DEFINE(FILEBUFF, 8192, [file i/o buffer size]) |
53 | 39 |
|
54 | 40 |
AC_HEADER_STDC |
55 |
-AC_CHECK_HEADERS(stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h) |
|
41 |
+AC_CHECK_HEADERS(stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h regex.h) |
|
56 | 42 |
AC_TYPE_OFF_T |
57 | 43 |
AC_COMPILE_CHECK_SIZEOF(short) |
58 | 44 |
AC_COMPILE_CHECK_SIZEOF(int) |
... | ... |
@@ -88,7 +73,7 @@ want_bzip2="no",) |
88 | 88 |
|
89 | 89 |
if test "$want_bzip2" = "yes" |
90 | 90 |
then |
91 |
- AC_CHECK_HEADER(bzlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lbz2"; AC_DEFINE(HAVE_BZLIB_H,1,have bzip2)],) |
|
91 |
+ AC_CHECK_HEADER(bzlib.h,[LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lbz2"; AC_DEFINE(HAVE_BZLIB_H,1,have bzip2)],[echo "WARNING: Bzip2 support disabled"]) |
|
92 | 92 |
AC_CHECK_LIB(bz2, bzReadOpen, AC_DEFINE(NOBZ2PREFIX,1,bzip funtions do not have bz2 prefix),) |
93 | 93 |
fi |
94 | 94 |
|
... | ... |
@@ -118,9 +103,6 @@ fi |
118 | 118 |
|
119 | 119 |
AC_CHECK_HEADER(syslog.h,AC_DEFINE(USE_SYSLOG,1,[use syslog]),) |
120 | 120 |
|
121 |
-dnl AC_CHECK_LIB(c, strtok_r,, AC_DEFINE(NO_STRTOK_R)) |
|
122 |
-dnl AC_CHECK_LIB(c, mkstemp, AC_DEFINE(HAVE_MKSTEMP),) |
|
123 |
- |
|
124 | 121 |
AC_ARG_ENABLE(pthreads, |
125 | 122 |
[ --disable-pthreads Disable POSIX threads support], |
126 | 123 |
have_pthreads=no, ) |
... | ... |
@@ -142,12 +124,10 @@ AC_ARG_ENABLE(yp-check, |
142 | 142 |
[ --enable-yp-check Use ypmatch utility instead of /etc/passwd parsing], |
143 | 143 |
use_yp="yes", use_yp="no") |
144 | 144 |
|
145 |
-dnl clamav user |
|
146 | 145 |
AC_ARG_WITH(user, |
147 | 146 |
[ --with-user=uid name of the clamav user (default=clamav).], |
148 | 147 |
clamav_user="$withval", clamav_user="clamav") |
149 | 148 |
|
150 |
-dnl clamav group |
|
151 | 149 |
AC_ARG_WITH(group, |
152 | 150 |
[ --with-group=gid name of the clamav group (default=clamav).], |
153 | 151 |
clamav_group="$withval", clamav_group="clamav") |
... | ... |
@@ -168,22 +148,19 @@ AC_ARG_ENABLE(bigstack, |
168 | 168 |
[ --enable-bigstack Increase thread stack size.], |
169 | 169 |
AC_DEFINE(C_BIGSTACK,1,[Increase thread stack size.]),) |
170 | 170 |
|
171 |
-dnl database directory |
|
172 | 171 |
AC_ARG_WITH(dbdir, |
173 | 172 |
[ --with-dbdir=path Path to virus database directory.], |
174 | 173 |
db_dir="$withval", db_dir="_default_") |
175 | 174 |
|
176 |
-dnl main.cvd |
|
177 | 175 |
AC_ARG_WITH(db1, |
178 | 176 |
[ --with-db1=name Name of the main database (main.cvd).], |
179 | 177 |
AC_DEFINE_UNQUOTED(DB1NAME,"$withval",[Name of the main database]), AC_DEFINE(DB1NAME, "main.cvd",[Name of the main database])) |
180 | 178 |
|
181 |
-dnl daily.cvd |
|
182 | 179 |
AC_ARG_WITH(db2, |
183 | 180 |
[ --with-db2=name Name of the daily database (daily.cvd).], |
184 | 181 |
AC_DEFINE_UNQUOTED(DB2NAME,"$withval",[Name of the daily database]), AC_DEFINE(DB2NAME, "daily.cvd",[Name of the daily database])) |
185 | 182 |
|
186 |
-dnl I had problems with $pkgdatadir, that's why I'm using these funny checks |
|
183 |
+dnl I had problems with $pkgdatadir thus these funny checks |
|
187 | 184 |
if test "$db_dir" = "_default_" |
188 | 185 |
then |
189 | 186 |
if test "$prefix" = "NONE" |
... | ... |
@@ -216,7 +193,7 @@ CFGDIR=$cfg_dir |
216 | 216 |
AC_SUBST(CFGDIR) |
217 | 217 |
AC_DEFINE_UNQUOTED(CONFDIR,"$cfg_dir",[where to look for the config file]) |
218 | 218 |
|
219 |
-dnl Do not overwrite the current config file |
|
219 |
+dnl Do not overwrite current config files |
|
220 | 220 |
AM_CONDITIONAL(INSTALL_CLAMAV_CONF, test ! -r "$cfg_dir/clamav.conf") |
221 | 221 |
AM_CONDITIONAL(INSTALL_FRESHCLAM_CONF, test ! -r "$cfg_dir/freshclam.conf") |
222 | 222 |
|
... | ... |
@@ -281,11 +258,6 @@ AC_TRY_RUN([ |
281 | 281 |
int main(int argc, char **argv) { in_port_t pt; pt = 0; return pt; } |
282 | 282 |
], AC_DEFINE(HAVE_IN_PORT_T,1,[in_port_t is defined]), AC_MSG_RESULT(in_port_t is not defined)) |
283 | 283 |
|
284 |
-dnl CLAMSCAN_LIBS="" |
|
285 |
-dnl FRESHCLAM_LIBS="" |
|
286 |
-dnl CLAMD_LIBS="" |
|
287 |
-dnl TH_SAFE="" |
|
288 |
- |
|
289 | 284 |
case "$target_os" in |
290 | 285 |
linux*) |
291 | 286 |
AC_DEFINE(C_LINUX,1,[target is linux]) |
... | ... |
@@ -303,7 +275,6 @@ linux*) |
303 | 303 |
fi |
304 | 304 |
;; |
305 | 305 |
cygwin*) |
306 |
- dnl It probably won't work. |
|
307 | 306 |
AC_DEFINE(C_CYGWIN,1,[os is cygwin]) |
308 | 307 |
if test "$test_clamav" = "yes"; then |
309 | 308 |
if test ! -r /etc/passwd; then |
... | ... |
@@ -379,7 +350,7 @@ netbsd*) |
379 | 379 |
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread" |
380 | 380 |
AC_DEFINE(CL_THREAD_SAFE,1,[thread safe]) |
381 | 381 |
AC_DEFINE(_REENTRANT,1,[thread safe]) |
382 |
- LIBS="$LIBS -lpthread" |
|
382 |
+ ADDITIONAL_LIBS="$LIBS -lpthread" |
|
383 | 383 |
fi |
384 | 384 |
AC_DEFINE(C_BSD,1,[os is bsd flavor]) |
385 | 385 |
;; |
... | ... |
@@ -397,15 +368,12 @@ darwin*) |
397 | 397 |
AC_DEFINE(C_BSD,1,[os is bsd flavor]) |
398 | 398 |
AC_DEFINE(C_DARWIN,1,[os is darwin]) |
399 | 399 |
use_netinfo="yes" |
400 |
- dnl have_pthreads="no" |
|
401 |
- dnl AC_MSG_RESULT(Darwin detected. Disabling thread support.) |
|
402 | 400 |
;; |
403 | 401 |
sco*) |
404 | 402 |
dnl njh@bandsman.sco.uk: SCO Unix port |
405 | 403 |
FRESHCLAM_LIBS="-lsocket" |
406 | 404 |
CLAMD_LIBS="-lsocket" |
407 | 405 |
CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lsocket" |
408 |
- dnl AC_DEFINE(NO_SNPRINTF) |
|
409 | 406 |
;; |
410 | 407 |
hpux*) |
411 | 408 |
if test "$have_pthreads" = "yes"; then |
... | ... |
@@ -439,7 +407,6 @@ irix*) |
439 | 439 |
AC_DEFINE(_REENTRANT,1,[thread safe]) |
440 | 440 |
fi |
441 | 441 |
AC_DEFINE(C_IRIX,1,[os is irix]) |
442 |
- dnl AC_DEFINE(NO_SNPRINTF,1,no snprintf available) |
|
443 | 442 |
;; |
444 | 443 |
|
445 | 444 |
*) |
... | ... |
@@ -451,6 +418,7 @@ AC_SUBST(CLAMD_LIBS) |
451 | 451 |
AC_SUBST(CLAMAV_MILTER_LIBS) |
452 | 452 |
AC_SUBST(FRESHCLAM_LIBS) |
453 | 453 |
AC_SUBST(TH_SAFE) |
454 |
+AC_SUBST(ADDITIONAL_LIBS) |
|
454 | 455 |
|
455 | 456 |
AM_CONDITIONAL(BUILD_CLAMD, test "$have_pthreads" = "yes") |
456 | 457 |
AM_CONDITIONAL(HAVE_MILTER, test "$have_milter" = "yes") |
... | ... |
@@ -40,4 +40,4 @@ freshclam_SOURCES = \ |
40 | 40 |
|
41 | 41 |
DEFS = @DEFS@ |
42 | 42 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
43 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ |
|
43 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@ |
... | ... |
@@ -86,6 +86,7 @@ target_triplet = @target@ |
86 | 86 |
EXEEXT = @EXEEXT@ |
87 | 87 |
OBJEXT = @OBJEXT@ |
88 | 88 |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
89 |
+ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ |
|
89 | 90 |
AMTAR = @AMTAR@ |
90 | 91 |
AS = @AS@ |
91 | 92 |
AWK = @AWK@ |
... | ... |
@@ -141,7 +142,7 @@ freshclam_SOURCES = \ |
141 | 141 |
|
142 | 142 |
DEFS = @DEFS@ |
143 | 143 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
144 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ |
|
144 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@ |
|
145 | 145 |
subdir = freshclam |
146 | 146 |
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
147 | 147 |
CONFIG_HEADER = $(top_builddir)/clamav-config.h |
... | ... |
@@ -32,4 +32,4 @@ sigtool_LDADD = $(top_builddir)/clamscan/others.o |
32 | 32 |
|
33 | 33 |
DEFS = @DEFS@ |
34 | 34 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
35 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ |
|
35 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@ |
... | ... |
@@ -85,6 +85,7 @@ target_triplet = @target@ |
85 | 85 |
EXEEXT = @EXEEXT@ |
86 | 86 |
OBJEXT = @OBJEXT@ |
87 | 87 |
PATH_SEPARATOR = @PATH_SEPARATOR@ |
88 |
+ADDITIONAL_LIBS = @ADDITIONAL_LIBS@ |
|
88 | 89 |
AMTAR = @AMTAR@ |
89 | 90 |
AS = @AS@ |
90 | 91 |
AWK = @AWK@ |
... | ... |
@@ -134,7 +135,7 @@ sigtool_LDADD = $(top_builddir)/clamscan/others.o |
134 | 134 |
|
135 | 135 |
DEFS = @DEFS@ |
136 | 136 |
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav |
137 |
-LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ |
|
137 |
+LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@ |
|
138 | 138 |
subdir = sigtool |
139 | 139 |
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs |
140 | 140 |
CONFIG_HEADER = $(top_builddir)/clamav-config.h |