Browse code

various fixes

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@575 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/05/26 05:38:25
Showing 21 changed files
... ...
@@ -65,6 +65,7 @@ Len Budney <lbudney*pobox.com>
65 65
 Andrey Cherezov <andrey*cherezov.koenig.su>
66 66
 Alex Cherney <alex*cher.id.au>
67 67
 Tom G. Christensen <tgc*statsbiblioteket.dk>
68
+Eugene Crosser <crosser*rol.ru>
68 69
 Damien Curtain <damien*pagefault.org>
69 70
 Michael Dankov <misha*btrc.ru>
70 71
 Maxim Dounin <mdounin*rambler-co.ru>
... ...
@@ -1,3 +1,13 @@
1
+Tue May 25 22:30:33 CEST 2004 (tk)
2
+----------------------------------
3
+  * libclamav: + report oversized archives (just like clamav-0.6x did)
4
+	       + do not trigger off file type recognizer in raw mode
5
+	         (fixes stdin scanning in clamscan - Debian Bug #250806)
6
+  * clamd: harden read() in command parser
7
+  * Makefiles: fix *.cvd and *.conf installation in VPATHed directory
8
+	       (patch by Eugene Crosser <crosser*rol.ru>)
9
+  * doc: include manual page for freshclam.conf (from Debian)
10
+
1 11
 Tue May 25 17:24:48 BST 2004 (njh)
2 12
 ----------------------------------
3 13
   * clamav-milter:	X-Virus-Status: Not Scanned - StreamMaxLength exceeded
... ...
@@ -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.37 2004/05/16 01:09:43 kojm Exp $
84
+dnl @version: $Id: aclocal.m4,v 1.38 2004/05/25 20:38:23 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.37 2004/05/16 01:09:43 kojm Exp $
4044
+dnl @version $Id: aclocal.m4,v 1.38 2004/05/25 20:38:23 kojm Exp $
4045 4045
 dnl
4046 4046
 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
4047 4047
 [changequote(<<, >>)dnl
... ...
@@ -83,7 +83,9 @@ int command(int desc, const struct cl_node *root, const struct cl_limits *limits
83 83
 	return -1;
84 84
     }
85 85
 
86
-    if((bread = read(desc, buff, 1024)) == -1) {
86
+    while((bread = read(desc, buff, 1024)) == -1 && errno == EINTR);
87
+
88
+    if(bread <= 0) {
87 89
 	logg("!Command parser: read() failed.\n");
88 90
 	/* at least try to display this error message */
89 91
 	mdprintf(desc, "ERROR: Command parser: read() failed.\n");
... ...
@@ -35,5 +35,6 @@ clamdscan_LDADD = $(top_builddir)/clamscan/options.o $(top_builddir)/clamscan/ge
35 35
 
36 36
 endif
37 37
 
38
+DEFS = @DEFS@ -DCL_NOTHREADS
38 39
 INCLUDES = -I$(top_srcdir)/clamscan -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
39 40
 LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@
... ...
@@ -134,6 +134,7 @@ install_sh = @install_sh@
134 134
 
135 135
 @BUILD_CLAMD_TRUE@clamdscan_LDADD = $(top_builddir)/clamscan/options.o $(top_builddir)/clamscan/getopt.o
136 136
 
137
+DEFS = @DEFS@ -DCL_NOTHREADS
137 138
 INCLUDES = -I$(top_srcdir)/clamscan -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
138 139
 LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@
139 140
 subdir = clamdscan
... ...
@@ -153,8 +154,6 @@ clamdscan_OBJECTS = $(am_clamdscan_OBJECTS)
153 153
 @BUILD_CLAMD_TRUE@	$(top_builddir)/clamscan/getopt.o
154 154
 @BUILD_CLAMD_FALSE@clamdscan_DEPENDENCIES =
155 155
 clamdscan_LDFLAGS =
156
-
157
-DEFS = @DEFS@
158 156
 DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)
159 157
 CPPFLAGS = @CPPFLAGS@
160 158
 LDFLAGS = @LDFLAGS@
... ...
@@ -39,6 +39,6 @@ clamscan_SOURCES = \
39 39
     treewalk.h \
40 40
     defaults.h
41 41
 
42
-DEFS = @DEFS@
42
+DEFS = @DEFS@ -DCL_NOTHREADS
43 43
 LIBS = -L$(top_builddir)/libclamav -lclamav @ADDITIONAL_LIBS@
44 44
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
... ...
@@ -142,7 +142,7 @@ clamscan_SOURCES = \
142 142
     defaults.h
143 143
 
144 144
 
145
-DEFS = @DEFS@
145
+DEFS = @DEFS@ -DCL_NOTHREADS
146 146
 LIBS = -L$(top_builddir)/libclamav -lclamav @ADDITIONAL_LIBS@
147 147
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
148 148
 subdir = clamscan
... ...
@@ -24,8 +24,8 @@ CLAMAVGROUP = @CLAMAVGROUP@
24 24
  
25 25
 install:
26 26
 	$(mkinstalldirs) $(DESTDIR)$(DBINST)
27
-	@test -f $(DESTDIR)$(DBINST)/main.cvd || $(INSTALL_DATA) main.cvd $(DESTDIR)$(DBINST)
28
-	@test -f $(DESTDIR)$(DBINST)/daily.cvd || $(INSTALL_DATA) daily.cvd $(DESTDIR)$(DBINST)
27
+	@test -f $(DESTDIR)$(DBINST)/main.cvd || $(INSTALL_DATA) $(srcdir)/main.cvd $(DESTDIR)$(DBINST)
28
+	@test -f $(DESTDIR)$(DBINST)/daily.cvd || $(INSTALL_DATA) $(srcdir)/daily.cvd $(DESTDIR)$(DBINST)
29 29
 	@test -f $(DESTDIR)$(DBINST)/mirrors.txt && rm -f $(DESTDIR)$(DBINST)/mirrors.txt || true
30 30
 	@test -f $(DESTDIR)$(DBINST)/viruses.db && rm -f $(DESTDIR)$(DBINST)/viruses.db || true
31 31
 	@test -f $(DESTDIR)$(DBINST)/viruses.db2 && rm -f $(DESTDIR)$(DBINST)/viruses.db2 || true
... ...
@@ -250,8 +250,8 @@ uninstall-am: uninstall-info-am
250 250
 
251 251
 install:
252 252
 	$(mkinstalldirs) $(DESTDIR)$(DBINST)
253
-	@test -f $(DESTDIR)$(DBINST)/main.cvd || $(INSTALL_DATA) main.cvd $(DESTDIR)$(DBINST)
254
-	@test -f $(DESTDIR)$(DBINST)/daily.cvd || $(INSTALL_DATA) daily.cvd $(DESTDIR)$(DBINST)
253
+	@test -f $(DESTDIR)$(DBINST)/main.cvd || $(INSTALL_DATA) $(srcdir)/main.cvd $(DESTDIR)$(DBINST)
254
+	@test -f $(DESTDIR)$(DBINST)/daily.cvd || $(INSTALL_DATA) $(srcdir)/daily.cvd $(DESTDIR)$(DBINST)
255 255
 	@test -f $(DESTDIR)$(DBINST)/mirrors.txt && rm -f $(DESTDIR)$(DBINST)/mirrors.txt || true
256 256
 	@test -f $(DESTDIR)$(DBINST)/viruses.db && rm -f $(DESTDIR)$(DBINST)/viruses.db || true
257 257
 	@test -f $(DESTDIR)$(DBINST)/viruses.db2 && rm -f $(DESTDIR)$(DBINST)/viruses.db2 || true
... ...
@@ -16,4 +16,4 @@
16 16
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
 
18 18
 EXTRA_DIST = clamdoc.pdf DMS German Spanish Japanese html man FreeBSD-HowTo Portugese Turkish clamd_supervised clamav-mirror-howto.pdf signatures.pdf French Polish
19
-man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamav.conf.5 man/clamdscan.1 man/clamav-milter.8
19
+man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamav.conf.5 man/clamdscan.1 man/clamav-milter.8 man/freshclam.conf.5
... ...
@@ -118,7 +118,7 @@ am__quote = @am__quote@
118 118
 install_sh = @install_sh@
119 119
 
120 120
 EXTRA_DIST = clamdoc.pdf DMS German Spanish Japanese html man FreeBSD-HowTo Portugese Turkish clamd_supervised clamav-mirror-howto.pdf signatures.pdf French Polish
121
-man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamav.conf.5 man/clamdscan.1 man/clamav-milter.8
121
+man_MANS = man/clamscan.1 man/freshclam.1 man/sigtool.1 man/clamd.8 man/clamav.conf.5 man/clamdscan.1 man/clamav-milter.8 man/freshclam.conf.5
122 122
 subdir = docs
123 123
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
124 124
 CONFIG_HEADER = $(top_builddir)/clamav-config.h
125 125
new file mode 100644
... ...
@@ -0,0 +1,93 @@
0
+.\" Based on work by by Tomasz Kojm, 1.10.2002. 
1
+.\" Manual page created by Magnus Ekdahl and Thomas Lamy
2
+.TH "freshclam.conf" "5" "June 6, 2003" "Thomas Lamy" "Clam AntiVirus"
3
+.SH "NAME"
4
+.LP 
5
+\fBfreshclam.conf\fR \- Configuration file for Clam AntiVirus Database Updater
6
+.SH "DESCRIPTION"
7
+.LP 
8
+The file freshclam.conf configures the Clam AntiVirus Database Updater, freshclam(1).
9
+.SH "FILE FORMAT"
10
+The file consists of comments and options with arguments. Each line that starts with a hash (\fB#\fR) symbol is ignored. Everything is case sensitive. Options are of the form \fBOption Argument\fR, some options don't use arguments. There are few types of the arguments:
11
+.TP 
12
+\fBSTRING\fR
13
+String without blank characters.
14
+.TP 
15
+\fBSIZE\fR
16
+Size in bytes. You can use a 'M' or 'm' modifiers for megabytes and a 'K' or 'k' for kilobytes.
17
+.TP 
18
+\fBNUMBER\fR
19
+Unsigned integer.
20
+.SH "OPTIONS"
21
+.LP 
22
+When some option is not used (hashed or doesn't exist in the configuration file), freshclam takes a default action.
23
+.TP 
24
+\fBExample\fR
25
+When this option is set, freshclam will stop and ask you to modify the configuration file.
26
+.TP
27
+\fBDatabaseOwner STRING\fR
28
+When started by root, drop privileges to a specified user. Default is \"clamav\".
29
+.TP
30
+\fBDatabaseDirectory STRING\fR
31
+One can change the default database directory here.  Note that clamd and clamscan expect the hardcoded path \/var\/lib\/clamav.
32
+.TP
33
+\fBChecks NUM\fR
34
+Number of new database checks per day. Default is to check 6 times \(every 4 hours\).
35
+.TP 
36
+\fBUpdateLogFile STRING\fR
37
+Enable logging to a specified file. Highly recommended.
38
+.br 
39
+Default: disabled.
40
+.TP 
41
+\fBLogSyslog\fR
42
+Enable logging to Syslog.  May be used in combination with UpdateLogFile
43
+.br 
44
+Default: disabled.
45
+.TP 
46
+\fBLogVerbose\fR
47
+Enable verbose logging.
48
+.TP 
49
+\fBDatabaseMirror STRING\fR
50
+Server name where database updates are downloaded from. The default is database.clamav.net, which points to all official mirrors.
51
+.br.
52
+If this option is given multiple times, freshclam(1) tries them in the order given if one download fails.
53
+.br 
54
+There is no default, which results in an error when running freshclam(1).
55
+.TP
56
+\fBMaxAttempts NUM\fR
57
+Freshclam(1) tries every mirror this number of times before switching to the next mirror.
58
+.br.
59
+Default is to try once per mirror.
60
+.TP
61
+\fBHTTPProxyServer STR\fR, \fBHTTPProxyPort NUM\fR
62
+Use given proxy server and TCP port for database downloads.
63
+.TP
64
+\fBHTTPProxyUsername STR\fR,\fBHTTPProxyPassword STR\fR
65
+Proxy usage is authenticated through given username and password.
66
+.br.
67
+Default: no proxy authentication
68
+.TP
69
+\fBNotifyClamd \[STRING\]\fR
70
+Notify a running clamd(8) to reload it\'s database after a download has occured. Optionally a clamav.conf(5) file location may be given to tell freshclam(1) how to communicate with clamd(8).
71
+.br.
72
+The default is to not notify clamd. See clamav.conf(5)\'s option SelfCheck for how clamd(8) handles database updates in this case.
73
+.TP
74
+\fBOnUpdateExecute STRING\fR
75
+Execute this command after the database has been successfully updated.
76
+.TP
77
+\fBOnErrorExecute\fR
78
+Execute this command after a database update has failed.
79
+.SH "NOTE"
80
+While not reasonable, any configuration option from clamav.conf(5) may be given.
81
+.SH "FILES"
82
+.LP 
83
+/usr/local/etc/freshclam.conf
84
+.br
85
+/etc/clamav/freshclam.conf
86
+.SH "AUTHOR"
87
+.LP 
88
+Thomas Lamy <thomas.lamy@netwake.de>
89
+.SH "SEE ALSO"
90
+.LP 
91
+freshclam(1), clamav.conf(5), clamd(8), clamscan(1)
92
+
... ...
@@ -23,8 +23,8 @@ CFGINST = @CFGDIR@
23 23
 install:
24 24
 	$(mkinstalldirs) $(DESTDIR)$(CFGINST)
25 25
 if INSTALL_CLAMAV_CONF
26
-	@$(INSTALL_DATA) clamav.conf $(DESTDIR)$(CFGINST)
26
+	@$(INSTALL_DATA) $(srcdir)/clamav.conf $(DESTDIR)$(CFGINST)
27 27
 endif
28 28
 if INSTALL_FRESHCLAM_CONF
29
-	@$(INSTALL_DATA) freshclam.conf $(DESTDIR)$(CFGINST)
29
+	@$(INSTALL_DATA) $(srcdir)/freshclam.conf $(DESTDIR)$(CFGINST)
30 30
 endif
... ...
@@ -250,8 +250,8 @@ uninstall-am: uninstall-info-am
250 250
 
251 251
 install:
252 252
 	$(mkinstalldirs) $(DESTDIR)$(CFGINST)
253
-@INSTALL_CLAMAV_CONF_TRUE@	@$(INSTALL_DATA) clamav.conf $(DESTDIR)$(CFGINST)
254
-@INSTALL_FRESHCLAM_CONF_TRUE@	@$(INSTALL_DATA) freshclam.conf $(DESTDIR)$(CFGINST)
253
+@INSTALL_CLAMAV_CONF_TRUE@	@$(INSTALL_DATA) $(srcdir)/clamav.conf $(DESTDIR)$(CFGINST)
254
+@INSTALL_FRESHCLAM_CONF_TRUE@	@$(INSTALL_DATA) $(srcdir)/freshclam.conf $(DESTDIR)$(CFGINST)
255 255
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
256 256
 # Otherwise a system limit (for SysV at least) may be exceeded.
257 257
 .NOEXPORT:
... ...
@@ -38,6 +38,6 @@ freshclam_SOURCES = \
38 38
     notify.h
39 39
 
40 40
 
41
-DEFS = @DEFS@
41
+DEFS = @DEFS@ -DCL_NOTHREADS
42 42
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
43 43
 LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@
... ...
@@ -140,7 +140,7 @@ freshclam_SOURCES = \
140 140
     notify.h
141 141
 
142 142
 
143
-DEFS = @DEFS@
143
+DEFS = @DEFS@ -DCL_NOTHREADS
144 144
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
145 145
 LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@
146 146
 subdir = freshclam
... ...
@@ -73,7 +73,7 @@ static const struct cli_magic_s cli_magic[] = {
73 73
 
74 74
     /* Executables */
75 75
 
76
-    /* {0,  "MZ",				2,  "DOS/W32 executable", CL_DOSEXE}, */
76
+    {0,  "MZ",				2,  "DOS/W32 executable", CL_DOSEXE},
77 77
 
78 78
     /* Archives */
79 79
 
... ...
@@ -401,8 +401,9 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
401 401
 	}
402 402
 
403 403
 	if(limits && limits->maxratio > 0 && ((unsigned) zdirent.st_size / (unsigned) zdirent.d_csize) >= limits->maxratio) {
404
-            files++;
405
-            continue;
404
+	    *virname = "Oversized.Zip";
405
+	    ret = CL_VIRUS;
406
+	    break;
406 407
         }
407 408
 
408 409
 	/* work-around for problematic zips (zziplib crashes with them) */
... ...
@@ -967,6 +968,12 @@ static int cli_magic_scandesc(int desc, const char **virname, long int *scanned,
967 967
 	return -1;
968 968
     }
969 969
 
970
+    if(!options) { /* raw mode (stdin, etc.) */
971
+	if((ret = cli_scandesc(desc, virname, scanned, root) == CL_VIRUS))
972
+	    cli_dbgmsg("%s virus found in descriptor %d.\n", *virname, desc);
973
+	return ret;
974
+    }
975
+
970 976
     if(SCAN_ARCHIVE && limits && limits->maxreclevel)
971 977
 	if(*reclev > limits->maxreclevel)
972 978
 	    /* return CL_EMAXREC; */
... ...
@@ -20,6 +20,10 @@
20 20
 #include "clamav-config.h"
21 21
 #endif
22 22
 
23
+#ifdef CL_NOTHREADS
24
+#undef CL_THREAD_SAFE
25
+#endif
26
+
23 27
 #include <stdio.h>
24 28
 #include <stdarg.h>
25 29
 #include <stdlib.h>
... ...
@@ -32,6 +32,6 @@ sigtool_SOURCES = \
32 32
 
33 33
 sigtool_LDADD = $(top_builddir)/clamscan/others.o 
34 34
 
35
-DEFS = @DEFS@
35
+DEFS = @DEFS@ -DCL_NOTHREADS
36 36
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
37 37
 LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@
... ...
@@ -135,7 +135,7 @@ sigtool_SOURCES = \
135 135
 
136 136
 sigtool_LDADD = $(top_builddir)/clamscan/others.o 
137 137
 
138
-DEFS = @DEFS@
138
+DEFS = @DEFS@ -DCL_NOTHREADS
139 139
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
140 140
 LIBS = -L$(top_builddir)/libclamav -lclamav @FRESHCLAM_LIBS@ @ADDITIONAL_LIBS@
141 141
 subdir = sigtool