INN commit: branches/2.5/lib (innconf.c)

INN Commit rra at isc.org
Sun Nov 15 09:26:37 UTC 2009


    Date: Sunday, November 15, 2009 @ 01:26:37
  Author: iulius
Revision: 8785

If keyword generation is set to true in inn.conf but the
Keywords: header is not stored in the overview, warn the
news administrator and deactive keyword generation (because
it is useless and eats resources for nothing).

Modified:
  branches/2.5/lib/innconf.c

-----------+
 innconf.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

Modified: innconf.c
===================================================================
--- innconf.c	2009-11-15 09:26:19 UTC (rev 8784)
+++ innconf.c	2009-11-15 09:26:37 UTC (rev 8785)
@@ -457,7 +457,6 @@
 innconf_validate(struct config_group *group)
 {
     bool okay = true;
-    unsigned long threshold;
 
     if (GetFQDN(innconf->domain) == NULL) {
         warn("hostname does not resolve or domain not set in inn.conf");
@@ -480,12 +479,42 @@
         okay = false;
     }
 
-    threshold = innconf->datamovethreshold;
-    if (threshold > 1024 * 1024) {
+    if (innconf->datamovethreshold > 1024 * 1024) {
         config_error_param(group, "datamovethreshold",
                            "maximum value for datamovethreshold is 1MB");
         innconf->datamovethreshold = 1024 * 1024;
     }
+
+    if (innconf->keywords) {
+        bool found = false;
+        unsigned int i;
+        if (innconf->extraoverviewadvertised->strings != NULL) {
+            for (i = 0; i < innconf->extraoverviewadvertised->count; i++) {
+                if (innconf->extraoverviewadvertised->strings[i] != NULL &&
+                    (strcasecmp(innconf->extraoverviewadvertised->strings[i], "Keywords") == 0)) {
+                    found = true;
+                    break;
+                }
+            }
+        }
+        if (innconf->extraoverviewhidden->strings != NULL) {
+            for (i = 0; i < innconf->extraoverviewhidden->count; i++) {
+                if (innconf->extraoverviewhidden->strings[i] != NULL &&
+                    (strcasecmp(innconf->extraoverviewhidden->strings[i], "Keywords") == 0)) {
+                    found = true;
+                    break;
+                }
+            }
+        }
+
+        if (!found) {
+            config_error_param(group, "keywords",
+                               "keyword generation is useless if the Keywords:"
+                               " header is not stored in the overview");
+            innconf->keywords = false;
+        }
+    }
+
     return okay;
 }
 




More information about the inn-committers mailing list