INN commit: trunk (5 files)

INN Commit Russ_Allbery at isc.org
Fri Oct 5 00:12:07 UTC 2007


    Date: Thursday, October 4, 2007 @ 17:12:07
  Author: jeff
Revision: 7696

Add a "nnrpdflags" parameter to inn.conf (modeled on the concept of
"innflags") to permit passing of commandline arguments to instances of
nnrpd spawned from innd.

Modified:
  trunk/doc/pod/inn.conf.pod
  trunk/doc/pod/nnrpd.pod
  trunk/include/inn/innconf.h
  trunk/innd/rc.c
  trunk/lib/innconf.c

-----------------------+
 doc/pod/inn.conf.pod  |    9 +++++++++
 doc/pod/nnrpd.pod     |    6 ++++++
 include/inn/innconf.h |    1 +
 innd/rc.c             |   14 +++++++++++++-
 lib/innconf.c         |    1 +
 5 files changed, 30 insertions(+), 1 deletion(-)

Modified: doc/pod/inn.conf.pod
===================================================================
--- doc/pod/inn.conf.pod	2007-10-04 19:25:34 UTC (rev 7695)
+++ doc/pod/inn.conf.pod	2007-10-05 00:12:07 UTC (rev 7696)
@@ -578,6 +578,15 @@
 number of "article is missing" errors seen by the client.  This is a
 boolean value and the default is true.
 
+=item I<nnrpdflags>
+
+When nnrpd(8) is spawned from innd(8), these flags are passed as
+arguments to the nnrpd process.  This setting does not affect instances
+of nnrpd that are started in daemon mode, or instances that are started
+via another listener process such as inetd(8) or xinetd(8).  Shell
+quoting and metacharacters are not supported.  This is a string value
+and the default is unset.
+
 =item I<nnrpdloadlimit>
 
 If set to a value other than C<0>, connections to nnrpd will be refused

Modified: doc/pod/nnrpd.pod
===================================================================
--- doc/pod/nnrpd.pod	2007-10-04 19:25:34 UTC (rev 7695)
+++ doc/pod/nnrpd.pod	2007-10-05 00:12:07 UTC (rev 7696)
@@ -30,6 +30,12 @@
 connections.  If you are instead running B<nnrpd> with the B<-D> option,
 any configuration changes won't take effect until B<nnrpd> is restarted.
 
+The F<inn.conf> setting I<nnrpdflags> can be used to pass any of the
+options below to instances of B<nnrpd> that are spawned directly from
+B<innd>.  Many options only make sense when B<-D> is used, so these
+options should not be used with I<nnrpdflags>.  See also the discussion
+of I<nnrpdflags> in inn.conf(5).
+
 When I<nnrpdloadlimit> in F<inn.conf> is not 0, it will also reject
 connections if the load average is greater than that value (typically 16).
 B<nnrpd> can also prevent high-volume posters from abusing your

Modified: include/inn/innconf.h
===================================================================
--- include/inn/innconf.h	2007-10-04 19:25:34 UTC (rev 7695)
+++ include/inn/innconf.h	2007-10-05 00:12:07 UTC (rev 7696)
@@ -76,6 +76,7 @@
     bool nfsreader;             /* Use NFS reader functionality */
     long nfsreaderdelay;        /* Delay applied to article arrival */
     bool nnrpdcheckart;         /* Check article existence before returning? */
+    char *nnrpdflags;           /* Arguments to pass when spawning nnrpd */
     long nnrpdloadlimit;        /* Maximum getloadvg() we allow */
     bool noreader;              /* Refuse to fork nnrpd for readers? */
     bool readerswhenstopped;    /* Allow nnrpd when server is paused */

Modified: innd/rc.c
===================================================================
--- innd/rc.c	2007-10-04 19:25:34 UTC (rev 7695)
+++ innd/rc.c	2007-10-05 00:12:07 UTC (rev 7696)
@@ -13,6 +13,7 @@
 
 #include "inn/innconf.h"
 #include "inn/network.h"
+#include "inn/vector.h"
 #include "innd.h"
 
 #define TEST_CONFIG(a, b) \
@@ -393,9 +394,14 @@
 void
 RChandoff(int fd, HANDOFF h)
 {
-    const char *argv[6];
+    const char **argv;
     char buff[SMBUF];
     int i;
+    unsigned int j;
+    struct vector *flags;
+    
+    flags = vector_split_space(innconf->nnrpdflags, NULL);
+    argv  = xmalloc( (flags->count + 6) * sizeof(char*) );
 
     if (RCnnrpd == NULL)
 	RCnnrpd = concatpath(innconf->pathbin, "nnrpd");
@@ -427,11 +433,17 @@
 	argv[i++] = "-t";
     if (RCslaveflag)
 	argv[i++] = RCslaveflag;
+
+    for(j = 0; j < flags->count; j++) {
+        argv[i++] = flags->strings[j];
+    }
     argv[i] = NULL;
 
     /* Call NNRP; don't send back a QUIT message if Spawn fails since  
      * that's a major error we want to find out about quickly. */
     Spawn(innconf->nicekids, fd, fd, fd, (char * const *)argv);
+    vector_free(flags);
+    free(argv);
 }
 
 

Modified: lib/innconf.c
===================================================================
--- lib/innconf.c	2007-10-04 19:25:34 UTC (rev 7695)
+++ lib/innconf.c	2007-10-05 00:12:07 UTC (rev 7696)
@@ -201,6 +201,7 @@
     { K(nfsreaderdelay),        NUMBER  (60) },
     { K(nicenewnews),           NUMBER  (0) },
     { K(nicennrpd),             NUMBER  (0) },
+    { K(nnrpdflags),            STRING  ("") },
     { K(nnrpdauthsender),       BOOL    (false) },
     { K(nnrpdloadlimit),        NUMBER  (16) },
     { K(nnrpdoverstats),        BOOL    (false) },



More information about the inn-committers mailing list