tweaked it so filters.php can pass a default TTL to bulkquery.c
authorbbice <bbice@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 10 Apr 2002 23:21:14 +0000 (23:21 +0000)
committerbbice <bbice@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 10 Apr 2002 23:21:14 +0000 (23:21 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2708 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/filters/bulkquery/bulkquery.c
plugins/filters/filters.php

index a28fc390961d9441a9b0c571b52320edad580ad3..8b8ed8860c3abb9a2f9b082dc5a91ceb6d0686ce 100644 (file)
@@ -10,7 +10,7 @@
 #define MAXSTR 80
 #define MAXTHREADS 50
 #define MAXRBLS 40
-#define DEFTTL 7200
+#define DEFTTL 600
 
 extern int errno;
 extern int h_errno;
@@ -29,7 +29,7 @@ pthread_mutex_t *mutexp;
 pthread_mutex_t *mutexoutput;
 
 char *dnsrbls[MAXRBLS];
-int numrbls, numthreads, numqueries;
+int numrbls, numthreads, numqueries, defttl;
 
 void do_queries () {
    iplist tIP;
@@ -64,7 +64,7 @@ void do_queries () {
            lwres_grbnresponse_free(ctx, &response);
         } else {
            //fprintf (stderr, "Nothing found\n");
-            printf ("%s, %s, %d\n", tIP->IP, tIP->IP, DEFTTL);
+            printf ("%s, %s, %d\n", tIP->IP, tIP->IP, defttl);
         }
         //fprintf (stderr, "freeing context\n"); fflush(stderr);
         lwres_context_destroy(&ctx);
@@ -106,6 +106,12 @@ main () {
    iplist tIP;
    int loop1;
 
+   if (fgets(instr, MAXSTR, stdin) != NULL) {
+      defttl = atoi(instr);
+   }
+   if (defttl < 0)
+      defttl = DEFTTL;
+
    GetRBLs();
 
 //   for (loop1=0; loop1<numrbls; loop1++)
index a144822c08721bd1f839c4df5b339eb0521cab36..2c5c8809f668b5d7e491896700bd2903ae01fd49 100644 (file)
@@ -57,6 +57,7 @@ function filters_LoadCache () {
     global $data_dir, $SpamFilters_DNScache;
 
     if (file_exists($data_dir . "/dnscache")) {
+        $SpamFilters_DNScache = array();
         if ($fp = fopen ($data_dir . "/dnscache", "r")) {
             flock($fp,LOCK_SH);
             while ($data=fgetcsv($fp,1024)) {
@@ -73,7 +74,8 @@ function filters_LoadCache () {
 
 function filters_bulkquery($filters_spam_scan, $filters, $read) {
     global $SpamFilters_YourHop, $attachment_dir, $username,
-           $SpamFilters_DNScache, $SpamFilters_BulkQuery;
+           $SpamFilters_DNScache, $SpamFilters_BulkQuery,
+           $SpamFilters_CacheTTL;
 
     $IPs = array();
     $i = 0;
@@ -152,6 +154,7 @@ function filters_bulkquery($filters_spam_scan, $filters, $read) {
 
         $bqfil = $attachment_dir . $username . "-bq.in";
         $fp = fopen($bqfil, "w");
+        fputs ($fp, $SpamFilters_CacheTTL . "\n");
         foreach ($rbls as $key => $value) {
             fputs ($fp, "." . $key . "\n");
         }