INN commit: trunk/lib (innconf.c)

INN Commit rra at isc.org
Sat Nov 7 17:58:46 UTC 2009


    Date: Saturday, November 7, 2009 @ 09:58:46
  Author: iulius
Revision: 8715

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:
  trunk/lib/innconf.c

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

Modified: innconf.c
===================================================================
--- innconf.c	2009-11-07 13:50:43 UTC (rev 8714)
+++ innconf.c	2009-11-07 17:58:46 UTC (rev 8715)
@@ -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