Browse code

some database settings were being lost after reload

git-svn: trunk@2265

Tomasz Kojm authored on 2006/09/15 04:08:59
Showing 4 changed files
... ...
@@ -1,6 +1,10 @@
1
+Thu Sep 14 21:07:43 CEST 2006 (tk)
2
+----------------------------------
3
+  * clamd: some database settings were being lost after reload
4
+
1 5
 Thu Sep 14 20:53:28 CEST 2006 (acab)
2 6
 ------------------------------------
3
-  * clmad: phishing merge complete!
7
+  * clamd: phishing merge complete!
4 8
 
5 9
 Thu Sep 14 19:36:25 CEST 2006 (acab)
6 10
 ------------------------------------
... ...
@@ -376,7 +376,7 @@ int main(int argc, char **argv)
376 376
 	nlsockets++;
377 377
     }
378 378
 
379
-    ret = acceptloop_th(lsockets, nlsockets, root, copt);
379
+    ret = acceptloop_th(lsockets, nlsockets, root, dboptions, copt);
380 380
 
381 381
 #ifdef C_WINDOWS
382 382
     if(tcpsock)
... ...
@@ -182,13 +182,12 @@ void sighandler_th(int sig)
182 182
     }
183 183
 }
184 184
 
185
-static struct cl_node *reload_db(struct cl_node *root, const struct cfgstruct *copt, int do_check)
185
+static struct cl_node *reload_db(struct cl_node *root, unsigned int dboptions, const struct cfgstruct *copt, int do_check)
186 186
 {
187 187
 	const char *dbdir;
188 188
 	int retval;
189 189
 	unsigned int sigs = 0;
190 190
 	static struct cl_stat *dbstat=NULL;
191
-	unsigned int dboptions = 0;
192 191
 
193 192
     if(do_check) {
194 193
 	if(dbstat == NULL) {
... ...
@@ -223,11 +222,6 @@ static struct cl_node *reload_db(struct cl_node *root, const struct cfgstruct *c
223 223
     memset(dbstat, 0, sizeof(struct cl_stat));
224 224
     cl_statinidir(dbdir, dbstat);
225 225
 
226
-    if(!cfgopt(copt, "DetectPhishing")->enabled) {
227
-	dboptions |= CL_DB_NOPHISHING;
228
-	logg("Not loading phishing signatures.\n");
229
-    }
230
-
231 226
     if((retval = cl_load(dbdir, &root, &sigs, dboptions))) {
232 227
 	logg("!reload db failed: %s\n", cl_strerror(retval));
233 228
 	exit(-1);
... ...
@@ -248,7 +242,7 @@ static struct cl_node *reload_db(struct cl_node *root, const struct cfgstruct *c
248 248
     return root;
249 249
 }
250 250
 
251
-int acceptloop_th(int *socketds, int nsockets, struct cl_node *root, const struct cfgstruct *copt)
251
+int acceptloop_th(int *socketds, int nsockets, struct cl_node *root, unsigned int dboptions, const struct cfgstruct *copt)
252 252
 {
253 253
 	int new_sd, max_threads, i;
254 254
 	unsigned int options = 0;
... ...
@@ -557,7 +551,7 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_node *root, const struc
557 557
 	if(selfchk) {
558 558
 	    time(&current_time);
559 559
 	    if((current_time - start_time) > (time_t)selfchk) {
560
-		if(reload_db(root, copt, TRUE)) {
560
+		if(reload_db(root, dboptions, copt, TRUE)) {
561 561
 		    pthread_mutex_lock(&reload_mutex);
562 562
 		    reload = 1;
563 563
 		    pthread_mutex_unlock(&reload_mutex);
... ...
@@ -569,7 +563,7 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_node *root, const struc
569 569
 	pthread_mutex_lock(&reload_mutex);
570 570
 	if(reload) {
571 571
 	    pthread_mutex_unlock(&reload_mutex);
572
-	    root = reload_db(root, copt, FALSE);
572
+	    root = reload_db(root, dboptions, copt, FALSE);
573 573
 	    pthread_mutex_lock(&reload_mutex);
574 574
 	    reload = 0;
575 575
 	    time(&reloaded_time);
... ...
@@ -51,7 +51,7 @@ struct thrwarg {
51 51
     int options;
52 52
 };
53 53
 
54
-int acceptloop_th(int *socketds, int nsockets, struct cl_node *root, const struct cfgstruct *copt);
54
+int acceptloop_th(int *socketds, int nsockets, struct cl_node *root, unsigned int dboptions, const struct cfgstruct *copt);
55 55
 void sighandler(int sig);
56 56
 void sighandler_th(int sig);
57 57
 void daemonize(void);