Browse code

bugfixes

git-svn: trunk@494

Tomasz Kojm authored on 2004/04/15 23:30:23
Showing 7 changed files
... ...
@@ -1,3 +1,10 @@
1
+Thu Apr 15 16:26:38 CEST 2004 (tk)
2
+----------------------------------
3
+  * libclamav: add a "clamav-" prefix to temporary file names (Dirk Mueller
4
+	       <dmuell*gmx.net>)
5
+  * clamd: clamuko: fix signal handling (problem reported by Claudio Alonso
6
+	   <cfalonso*yahoo.com>)
7
+
1 8
 Thu Apr 15 10:54:02 BST 2004 (njh)
2 9
 ----------------------------------
3 10
   * clamav-milter:	Handle systems without inet_ntop()
... ...
@@ -56,6 +56,8 @@ void clamuko_exit(int sig)
56 56
 
57 57
     /* clamuko_running = 0; */
58 58
     logg("Clamuko stopped.\n");
59
+
60
+    pthread_exit(NULL);
59 61
 }
60 62
 
61 63
 void *clamukoth(void *arg)
... ...
@@ -340,7 +340,7 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
340 340
     pthread_attr_init(&thattr);
341 341
     pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED);
342 342
 
343
-    if(cfgopt(copt, "ClamukoScanOnLine"))
343
+    if(cfgopt(copt, "ClamukoScanOnLine") || cfgopt(copt, "ClamukoScanOnAccess"))
344 344
 #ifdef CLAMUKO
345 345
     {
346 346
 	pthread_attr_init(&clamuko_attr);
... ...
@@ -476,7 +476,7 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
476 476
 		exit(-1);
477 477
 	    }
478 478
 #ifdef CLAMUKO
479
-	    if(cfgopt(copt, "ClamukoScanOnLine")) {
479
+	    if(cfgopt(copt, "ClamukoScanOnLine") || cfgopt(copt, "ClamukoScanOnAccess")) {
480 480
 		logg("Stopping and restarting Clamuko.\n");
481 481
 		pthread_kill(clamuko_pid, SIGUSR1);
482 482
 		pthread_join(clamuko_pid, NULL);
... ...
@@ -490,7 +490,7 @@ int acceptloop_th(int socketd, struct cl_node *root, const struct cfgstruct *cop
490 490
     }
491 491
 
492 492
 #ifdef CLAMUKO
493
-    if(cfgopt(copt, "ClamukoScanOnLine")) {
493
+    if(cfgopt(copt, "ClamukoScanOnLine") || cfgopt(copt, "ClamukoScanOnAccess")) {
494 494
 	logg("Stopping Clamuko.\n");
495 495
 	pthread_kill(clamuko_pid, SIGUSR1);
496 496
 	pthread_join(clamuko_pid, NULL);
... ...
@@ -192,7 +192,7 @@ ArchiveMaxCompressionRatio 200
192 192
 ##
193 193
 
194 194
 # Enable Clamuko. Dazuko (/dev/dazuko) must be configured and running.
195
-#ClamukoScanOnLine
195
+#ClamukoScanOnAccess
196 196
 
197 197
 # Set access mask for Clamuko.
198 198
 ClamukoScanOnOpen
... ...
@@ -281,7 +281,7 @@ char *cl_gentemp(const char *dir)
281 281
     else
282 282
 	mdir = (char *) dir;
283 283
 
284
-    name = (char*) cli_calloc(strlen(mdir) + 1 + 16 + 1, sizeof(char));
284
+    name = (char*) cli_calloc(strlen(mdir) + 1 + 16 + 1 + 7, sizeof(char));
285 285
     if(name == NULL) {
286 286
 	cli_dbgmsg("cl_gentemp('%s'): out of memory\n", dir);
287 287
 	return NULL;
... ...
@@ -298,7 +298,7 @@ char *cl_gentemp(const char *dir)
298 298
 	    salt[i] = cl_rndnum(255);
299 299
 
300 300
 	tmp = cl_md5buff(( char* ) salt, 48);
301
-	sprintf(name, "%s/", mdir);
301
+	sprintf(name, "%s/clamav-", mdir);
302 302
 	strncat(name, tmp, 16);
303 303
 	free(tmp);
304 304
     } while(stat(name, &foo) != -1);
... ...
@@ -884,7 +884,7 @@ int cl_scandesc(int desc, const char **virname, unsigned long int *scanned, cons
884 884
     return cli_magic_scandesc(desc, virname, scanned, root, limits, options, &reclev);
885 885
 }
886 886
 
887
-int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
887
+static int cli_scanfile(const char *filename, const char **virname, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev)
888 888
 {
889 889
 	int fd, ret;
890 890
 
... ...
@@ -91,7 +91,8 @@ struct cfgstruct *parsecfg(const char *cfgfile)
91 91
 	    {"AllowSupplementaryGroups", OPT_NOARG},
92 92
 	    {"SelfCheck", OPT_NUM},
93 93
 	    {"VirusEvent", OPT_FULLSTR},
94
-	    {"ClamukoScanOnLine", OPT_NOARG},
94
+	    {"ClamukoScanOnLine", OPT_NOARG}, /* old name */
95
+	    {"ClamukoScanOnAccess", OPT_NOARG},
95 96
 	    {"ClamukoScanOnOpen", OPT_NOARG},
96 97
 	    {"ClamukoScanOnClose", OPT_NOARG},
97 98
 	    {"ClamukoScanOnExec", OPT_NOARG},