Browse code

update

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

Tomasz Kojm authored on 2004/10/01 09:31:18
Showing 13 changed files
... ...
@@ -1,3 +1,11 @@
1
+Fri Oct  1 02:28:08 CEST 2004 (tk)
2
+----------------------------------
3
+  * clamd: add new directive IdleTimeout (patch by Andrey J. Melnikoff (TEMHOTA)
4
+	   <temnota*kmv.ru>)
5
+  * clamscan/others.c: preserve Mac OS X resource forks in filecopy() 
6
+		       (thanks to Remi Mommsen <remigius.mommsen*cern.ch>)
7
+  * cosmetic fixes (thanks to Damian Menscher <menscherr*uiuc.edu>)
8
+
1 9
 Thu Sep 30 22:48:53 BST 2004 (njh)
2 10
 ----------------------------------
3 11
   * libclamav/mbox.c:	Remove unneeded strdup() calls
... ...
@@ -30,5 +30,6 @@
30 30
 #define CL_DEFAULT_MAXPORTSCAN 1000
31 31
 #define CL_DEFAULT_MAXDIRREC 15
32 32
 #define CL_DEFAULT_STREAMMAXLEN 10 * 1048576
33
+#define CL_DEFAULT_IDLETIMEOUT 30
33 34
 
34 35
 #endif
... ...
@@ -211,6 +211,7 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
211 211
 	unsigned int selfchk;
212 212
 	time_t start_time, current_time;
213 213
 	pid_t mainpid;
214
+	int idletimeout;
214 215
 
215 216
 #if defined(C_BIGSTACK) || defined(C_BSD)
216 217
         size_t stacksize;
... ...
@@ -452,7 +453,13 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
452 452
     pthread_mutex_init(&exit_mutex, NULL);
453 453
     pthread_mutex_init(&reload_mutex, NULL);
454 454
 
455
-    if((thr_pool=thrmgr_new(max_threads, 30, scanner_thread)) == NULL) {
455
+
456
+    if((cpt = cfgopt(copt, "IdleTimeout")))
457
+	idletimeout = cpt->numarg;
458
+    else
459
+	idletimeout = CL_DEFAULT_IDLETIMEOUT;
460
+
461
+    if((thr_pool=thrmgr_new(max_threads, idletimeout, scanner_thread)) == NULL) {
456 462
 	logg("!thrmgr_new failed\n");
457 463
 	exit(-1);
458 464
     }
... ...
@@ -821,6 +821,7 @@ int checkstdin(const struct cl_node *root, const struct cl_limits *limits, int o
821 821
 
822 822
     fclose(fs);
823 823
 
824
+    mprintf("*Checking %s\n", file);
824 825
     claminfo.files++;
825 826
 
826 827
     if((ret = cl_scanfile(file, &virname, &claminfo.blocks, root, limits, options)) == CL_VIRUS) {
... ...
@@ -115,6 +115,21 @@ int checkaccess(const char *path, const char *username, int mode)
115 115
 
116 116
 int filecopy(const char *src, const char *dest)
117 117
 {
118
+
119
+#ifdef C_DARWIN
120
+    /* On Mac OS X use ditto and copy resource fork, too. */
121
+    char *ditto = (char *) mcalloc(strlen(src) + strlen(dest) + 30, sizeof(char));
122
+    sprintf(ditto, "/usr/bin/ditto --rsrc %s %s", src, dest);
123
+
124
+    if(system(ditto)) {
125
+	free(ditto);
126
+	return -1;
127
+    }
128
+
129
+    free(ditto);
130
+    return 0;
131
+
132
+#else
118 133
 	char buffer[FILEBUFF];
119 134
 	int s, d, bytes;
120 135
 
... ...
@@ -133,6 +148,9 @@ int filecopy(const char *src, const char *dest)
133 133
 
134 134
     /* njh@bandsman.co.uk: check result of close for NFS file */
135 135
     return close(d);
136
+
137
+#endif //__APPLE_CC__
138
+
136 139
 }
137 140
 
138 141
 int isnumb(const char *str)
... ...
@@ -37,8 +37,8 @@ Save the scan report to FILE.
37 37
 \fB\-\-log\-verbose\fR
38 38
 Save additional messages (mostly useless) to the report file.
39 39
 .TP 
40
-\fB\-\-disable\-summary\fR
41
-Disable summary at the end of scanning.
40
+\fB\-\-no\-summary\fR
41
+Do not display summary at the end of scanning.
42 42
 .SH "EXAMPLES"
43 43
 .LP 
44 44
 .TP 
... ...
@@ -50,7 +50,7 @@ Scan directories recursively. All the subdirectories in the given directory will
50 50
 Sound bell on virus detection.
51 51
 .TP 
52 52
 \fB\-\-no\-summary\fR
53
-Disable summary printing at the end of scanning.
53
+Do not display summary at the end of scanning.
54 54
 .TP 
55 55
 \fB\-\-exclude=PATT\fR
56 56
 Don't scan file names containing PATT. It may be used multiple times.
... ...
@@ -49,6 +49,9 @@ Unpack a selected CVD file to a current directory.
49 49
 .TP 
50 50
 \fB\-\-unpack\-current\fR
51 51
 Unpack a local CVD file to a current directory.
52
+.TP 
53
+\fB\-l, \-\-list\-sigs\fR
54
+List signature names.
52 55
 .SH "EXAMPLES"
53 56
 .LP 
54 57
 .TP 
... ...
@@ -103,6 +103,10 @@ FixStaleSocket
103 103
 # Default: 120
104 104
 #ReadTimeout 300
105 105
 
106
+# Waiting for a new job will timeout after this time (seconds).
107
+# Default: 30
108
+#IdleTimeout 60
109
+
106 110
 # Maximal depth directories are scanned at.
107 111
 # Default: 15
108 112
 #MaxDirectoryRecursion 20
... ...
@@ -20,7 +20,7 @@ INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib -I@srcdir@/mspack
20 20
 
21 21
 libclamav_la_LIBADD = @LIBCLAMAV_LIBS@
22 22
 
23
-libclamav_la_LDFLAGS = @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@
23
+libclamav_la_LDFLAGS = @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@ -no-undefined
24 24
 
25 25
 include_HEADERS = clamav.h
26 26
 
... ...
@@ -234,7 +234,7 @@ target_os = @target_os@
234 234
 target_vendor = @target_vendor@
235 235
 INCLUDES = -I$(top_srcdir) -I@srcdir@/zziplib -I@srcdir@/mspack
236 236
 libclamav_la_LIBADD = @LIBCLAMAV_LIBS@
237
-libclamav_la_LDFLAGS = @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@
237
+libclamav_la_LDFLAGS = @TH_SAFE@ -version-info @LIBCLAMAV_VERSION@ -no-undefined
238 238
 include_HEADERS = clamav.h
239 239
 libclamav_la_SOURCES = \
240 240
 	clamav.h \
... ...
@@ -214,7 +214,7 @@ int cli_scandesc(int desc, const char **virname, long int *scanned, const struct
214 214
     /* prepare the buffer */
215 215
     buffsize = root->maxpatlen + SCANBUFF;
216 216
     if(!(buffer = (char *) cli_calloc(buffsize, sizeof(char)))) {
217
-	cli_dbgmsg("cli_scandesc(): unable to cli_malloc(%d)\n", buffsize);
217
+	cli_dbgmsg("cli_scandesc(): unable to cli_calloc(%d)\n", buffsize);
218 218
 	return CL_EMEM;
219 219
     }
220 220
 
... ...
@@ -86,6 +86,7 @@ struct cfgstruct *parsecfg(const char *cfgfile, int messages)
86 86
 	    {"StreamMaxLength", OPT_COMPSIZE},
87 87
 	    {"MaxThreads", OPT_NUM},
88 88
 	    {"ReadTimeout", OPT_NUM},
89
+	    {"IdleTimeout", OPT_NUM},
89 90
 	    {"MaxDirectoryRecursion", OPT_NUM},
90 91
 	    {"FollowDirectorySymlinks", OPT_NOARG},
91 92
 	    {"FollowFileSymlinks", OPT_NOARG},