INN commit: trunk (4 files)
INN Commit
rra at isc.org
Sun May 24 09:47:28 UTC 2020
Date: Sunday, May 24, 2020 @ 02:47:27
Author: iulius
Revision: 10377
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:
trunk/doc/pod/news.pod
trunk/doc/pod/rnews.pod
trunk/frontends/rnews.c
trunk/include/inn/options.h
-----------------------+
doc/pod/news.pod | 7 ++++
doc/pod/rnews.pod | 19 ++++++++----
frontends/rnews.c | 73 +++++++++++++++++++++++++-----------------------
include/inn/options.h | 6 ---
4 files changed, 59 insertions(+), 46 deletions(-)
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2020-05-24 09:13:27 UTC (rev 10376)
+++ doc/pod/news.pod 2020-05-24 09:47:27 UTC (rev 10377)
@@ -26,6 +26,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:13:27 UTC (rev 10376)
+++ doc/pod/rnews.pod 2020-05-24 09:47:27 UTC (rev 10377)
@@ -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:13:27 UTC (rev 10376)
+++ frontends/rnews.c 2020-05-24 09:47:27 UTC (rev 10377)
@@ -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;
@@ -497,11 +498,9 @@
static bool
UnpackOne(int *fdp, size_t *countp)
{
-#if defined(DO_RNEWSPROGS)
char path[(SMBUF * 2) + 1];
char *p;
int len;
-#endif /* defined(DO_RNEWSPROGS) */
char buff[SMBUF];
const char *cargv[4];
int artsize;
@@ -589,36 +588,39 @@
continue;
}
-#if defined(DO_RNEWSPROGS)
- 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;
}
@@ -891,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:13:27 UTC (rev 10376)
+++ include/inn/options.h 2020-05-24 09:47:27 UTC (rev 10377)
@@ -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