Patch adding "nnrpdflags" to readers.conf

Jeffrey M. Vinocur jeff at
Sun Jul 17 02:14:51 UTC 2005

Someone recently asked (<42d77fd5$1 at>) in for a way to pass "-n" to nnrpd when being spawned
directly from innd.  It seemed like a reasonable request, but rather than
add a boolean for whether or not to pass "-n", I just went ahead and added
an 'nnrpdflags' option to inn.conf, for passing arbitrary options whenever
innd spawns an instance of nnrpd.

Russ, I haven't gotten around to setting up subversion yet, so would you
mind committing this to CURRENT?  (This patch is shorter than the one I
posted to usenet, as it doesn't include changes to the generated manpages.  
It does, however, include one typo fix I happened to notice while

On a side note, I finally got to use vectors.  Mmm enough libraries like
that and I could forget I'm programming in C. Sadly, I ended up having to
copy back into a straight array to pass to Spawn().

Two flaws in this patch:

    - it does straightforward splitting on whitespace, so there's no
      way to use nnrpdflags to pass an argument that needs to include
      whitespace (e.g. "-r Too\ busy\ now" doesn't do what it should,
      but that shouldn't be much of a problem since -r is really
      intended for direct use by innd with the throttle string)

    - it re-splits the "nnrpdflags" string every time an nnrpd is
      spawned; I didn't think this was worth the trouble to optimize

Index: doc/pod/inn.conf.pod
RCS file: /proj/cvs/isc/inn/inn/doc/pod/inn.conf.pod,v
retrieving revision 1.51
diff -u -r1.51 inn.conf.pod
--- doc/pod/inn.conf.pod	2005/04/11 18:25:10	1.51
+++ doc/pod/inn.conf.pod	2005/07/16 21:47:21
@@ -23,7 +23,7 @@
     <name>: <value>
 (Any amount of whitespace can be put after the colon and is optional.)  If
-the value contains embedded whitespace or any of the characers C<[]<>"\:>,
+the value contains embedded whitespace or any of the characters C<[]<>"\:>,
 it must be enclosed in double quotes ("").  A backslash (C<\>) can be used
 to escape quotes and backslashes inside double quotes.  <name> is
 case-sensitive; C<server> is not the same as C<Server> or C<SERVER>.
@@ -571,6 +571,14 @@
 overview information slows down the overview commands, but reduces the
 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).  This is a
+string value and the default is unset.
 =item I<nnrpperlauth>
Index: doc/pod/nnrpd.pod
RCS file: /proj/cvs/isc/inn/inn/doc/pod/nnrpd.pod,v
retrieving revision 1.9
diff -u -r1.9 nnrpd.pod
--- doc/pod/nnrpd.pod	2005/04/11 08:59:26	1.9
+++ doc/pod/nnrpd.pod	2005/07/16 21:47:21
@@ -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
Index: include/inn/innconf.h
RCS file: /proj/cvs/isc/inn/inn/include/inn/innconf.h,v
retrieving revision 1.8
diff -u -r1.8 innconf.h
--- include/inn/innconf.h	2004/06/09 22:04:34	1.8
+++ include/inn/innconf.h	2005/07/16 21:47:21
@@ -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 */
Index: innd/rc.c
RCS file: /proj/cvs/isc/inn/inn/innd/rc.c,v
retrieving revision 1.89
diff -u -r1.89 rc.c
--- innd/rc.c	2005/04/14 06:48:02	1.89
+++ innd/rc.c	2005/07/16 21:47:21
@@ -13,6 +13,7 @@
 #include "inn/innconf.h"
 #include "inn/network.h"
+#include "inn/vector.h"
 #include "innd.h"
 #define TEST_CONFIG(a, b) \
@@ -386,9 +387,13 @@
 RChandoff(int fd, HANDOFF h)
-    const char *argv[6];
+    const char **argv;
     char buff[SMBUF];
-    int i;
+    int i, 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");
@@ -420,11 +425,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);
Index: lib/innconf.c
RCS file: /proj/cvs/isc/inn/inn/lib/innconf.c,v
retrieving revision 1.16
diff -u -r1.16 innconf.c
--- lib/innconf.c	2004/07/03 03:34:59	1.16
+++ lib/innconf.c	2005/07/16 21:47:21
@@ -203,6 +203,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) },

Jeffrey M. Vinocur
jeff at

More information about the inn-workers mailing list