INN commit: branches/2.6 (4 files)

INN Commit rra at isc.org
Sun May 24 09:52:10 UTC 2020


    Date: Sunday, May 24, 2020 @ 02:52:10
  Author: iulius
Revision: 10378

rnews:  new -a flag to configure the use of additional unpackers

Added a new "-a" flag to rnews to disallow, if needed, the use of
additional unpackers from  "<pathbin>/rnews.libexec"; only "rnews" and
"cunbatch" will then be recognized as valid batch commands.

It was previously only a compile-time option (DO_RNEWSPROGS).

Modified:
  branches/2.6/doc/pod/news.pod
  branches/2.6/doc/pod/rnews.pod
  branches/2.6/frontends/rnews.c
  branches/2.6/include/inn/options.h

-----------------------+
 doc/pod/news.pod      |    7 +++
 doc/pod/rnews.pod     |   19 +++++++---
 frontends/rnews.c     |   88 ++++++++++++++++++++++++++++--------------------
 include/inn/options.h |    6 ---
 4 files changed, 72 insertions(+), 48 deletions(-)

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2020-05-24 09:47:27 UTC (rev 10377)
+++ doc/pod/news.pod	2020-05-24 09:52:10 UTC (rev 10378)
@@ -15,6 +15,13 @@
 
 =item *
 
+Added new B<-a> flag to B<rnews> to disallow, if needed, the use
+of additional unpackers from the F<rnews.libexec> sub-directory of
+I<pathbin> (as set in F<inn.conf>); only C<rnews> and C<cunbatch>
+will then be recognized as valid batch commands.
+
+=item *
+
 Added new B<-b> flag to B<rnews> to save rejected articles in the F<bad>
 sub-directory of I<pathincoming> (as set in F<inn.conf>).  Otherwise,
 B<rnews> just logs and discards any articles that are rejected or cannot

Modified: doc/pod/rnews.pod
===================================================================
--- doc/pod/rnews.pod	2020-05-24 09:47:27 UTC (rev 10377)
+++ doc/pod/rnews.pod	2020-05-24 09:52:10 UTC (rev 10378)
@@ -48,12 +48,12 @@
 than B<compress> because it can handle B<compress>-style compression but
 is more widely available, due to old patent issues, than B<compress>.)
 
-Otherwise, if the command is any other word, then B<rnews> will try to
-execute a program with that name, looking for it in the directory
-I<pathbin>/rnews.libexec.  The rest of the batch will be fed to that
-program's standard input, and the standard output from the program will be
-treated as if it were the original input to B<rnews>.  INN comes with three
-such standard batch processors:
+Otherwise, if the command is any other word and the B<-a> flag is not
+given, B<rnews> will try to execute a program with that name, looking
+for it in the directory I<pathbin>/rnews.libexec.  The rest of the
+batch will be fed to that program's standard input, and the standard
+output from the program will be treated as if it were the original
+input to B<rnews>.  INN comes with three such standard batch processors:
 
 =over 2
 
@@ -76,6 +76,13 @@
 
 =over 4
 
+=item B<-a>
+
+By default, B<rnews> looks for additional unpackers in the
+F<rnews.libexec> sub-directory of I<pathbin> (as set in F<inn.conf>).
+If B<-a> is given, no additional batch processor will be used; only
+C<rnews> and C<cunbatch> will be recognized as valid batch commands.
+
 =item B<-b>
 
 By default, B<rnews> will log and discard any articles that are rejected

Modified: frontends/rnews.c
===================================================================
--- frontends/rnews.c	2020-05-24 09:47:27 UTC (rev 10377)
+++ frontends/rnews.c	2020-05-24 09:52:10 UTC (rev 10378)
@@ -34,8 +34,9 @@
 } HEADER;
 
 
+static bool     addtionalUnpackers = true;
+static bool     backupBad = false;
 static bool     Verbose = false;
-static bool     backupBad = false;
 static const char	*InputFile = "stdin";
 static char	*UUCPHost;
 static char	*PathBadNews = NULL;
@@ -169,10 +170,22 @@
     FILE *F;
     int fd;
 
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     notice(reason, arg);
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     if (Verbose) {
 	fprintf(stderr, "%s: ", InputFile);
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
 	fprintf(stderr, reason, arg);
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 	fprintf(stderr, " [%.40s...]\n", article);
     }
 
@@ -485,10 +498,9 @@
 static bool
 UnpackOne(int *fdp, size_t *countp)
 {
-#if	defined(DO_RNEWSPROGS)
     char	path[(SMBUF * 2) + 1];
     char	*p;
-#endif	/* defined(DO_RNEWSPROGS) */
+    int         len;
     char	buff[SMBUF];
     const char *cargv[4];
     int		artsize;
@@ -576,38 +588,39 @@
 	    continue;
 	}
 
-#if	defined(DO_RNEWSPROGS)
-        int len;
-
-	cargv[0] = UNPACK;
-	cargv[1] = NULL;
-	/* Ignore any possible leading pathnames, to avoid trouble. */
-	if ((p = strrchr(&buff[3], '/')) != NULL)
-	    p++;
-	else
-	    p = &buff[3];
-	if (strchr(INN_PATH_RNEWSPROGS, '/') == NULL) {
-	    snprintf(path, sizeof(path), "%s/%s/%s", innconf->pathbin,
-                     INN_PATH_RNEWSPROGS, p);
-	    len = strlen(innconf->pathbin) + 1 + sizeof INN_PATH_RNEWSPROGS;
-	} else {
-	    snprintf(path, sizeof(path), "%s/%s", INN_PATH_RNEWSPROGS, p);
-	    len = sizeof INN_PATH_RNEWSPROGS;
-	}
-	for (p = &path[len]; *p; p++)
-	    if (ISWHITE(*p)) {
-		*p = '\0';
-		break;
-	    }
-	*fdp = StartChild(*fdp, path, cargv);
-	if (*fdp < 0)
-	    return false;
-	(*countp)++;
-	continue;
-#else
-        warn("bad_format unknown command %s", buff);
-	return false;
-#endif	/* defined(DO_RNEWSPROGS) */
+        if (additionalUnpackers) {
+            cargv[0] = UNPACK;
+            cargv[1] = NULL;
+            /* Ignore any possible leading pathnames, to avoid trouble. */
+            if ((p = strrchr(&buff[3], '/')) != NULL) {
+                p++;
+            } else {
+                p = &buff[3];
+            }
+            if (strchr(INN_PATH_RNEWSPROGS, '/') == NULL) {
+                snprintf(path, sizeof(path), "%s/%s/%s", innconf->pathbin,
+                         INN_PATH_RNEWSPROGS, p);
+                len = strlen(innconf->pathbin) + 1
+                    + sizeof(INN_PATH_RNEWSPROGS);
+            } else {
+                snprintf(path, sizeof(path), "%s/%s", INN_PATH_RNEWSPROGS, p);
+                len = sizeof(INN_PATH_RNEWSPROGS);
+            }
+            for (p = &path[len]; *p; p++)
+                if (ISWHITE(*p)) {
+                    *p = '\0';
+                    break;
+                }
+            *fdp = StartChild(*fdp, path, cargv);
+            if (*fdp < 0) {
+                return false;
+            }
+            (*countp)++;
+            continue;
+        } else {
+            warn("bad_format unknown command %s", buff);
+            return false;
+        }
     }
     return true;
 }
@@ -880,11 +893,14 @@
     /* Parse JCL. */
     fd = STDIN_FILENO;
     mode = '\0';
-    while ((i = getopt(ac, av, "bh:NP:r:S:Uv")) != EOF)
+    while ((i = getopt(ac, av, "abh:NP:r:S:Uv")) != EOF)
 	switch (i) {
 	default:
 	    die("usage error");
 	    /* NOTRTEACHED */
+        case 'a':
+            additionalUnpackers = false;
+            break;
         case 'b':
             backupBad = true;
             break;

Modified: include/inn/options.h
===================================================================
--- include/inn/options.h	2020-05-24 09:47:27 UTC (rev 10377)
+++ include/inn/options.h	2020-05-24 09:52:10 UTC (rev 10378)
@@ -53,12 +53,6 @@
 /* Define if rnews should syslog articles rejected as duplicates. */
 /* #undef DO_RNEWS_LOG_DUPS */
 
-/* Define if rnews should look in INN_PATH_RNEWSPROGS for batch unpackers. */
-#define DO_RNEWSPROGS
-
-/* Define if rnews should save articles rejected by the server. */
-/* #undef DO_RNEWS_SAVE_BAD */
-
 /* Value to pass to dbzincore() inside innd.  Under some bizarre low memory
    circumstance, you may want this not to be 1, but normally you always want
    to load the full history indexes into innd's memory.  Has no effect if



More information about the inn-committers mailing list