INN commit: branches/2.6 (doc/pod/news.pod innd/nc.c)
INN Commit
rra at isc.org
Mon May 21 12:41:24 UTC 2018
Date: Monday, May 21, 2018 @ 05:41:23
Author: iulius
Revision: 10286
Add trailing comment in CHECK and TAKETHIS responses
Responses to CHECK and TAKETHIS commands did not mention the reason of
a reject (notably from Python or Perl filter hook, but also directly
from innd main checks). This is now fixed.
closes #148
Modified:
branches/2.6/doc/pod/news.pod
branches/2.6/innd/nc.c
------------------+
doc/pod/news.pod | 6 ++++++
innd/nc.c | 38 +++++++++++++++++++++++++-------------
2 files changed, 31 insertions(+), 13 deletions(-)
Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod 2018-05-16 19:57:59 UTC (rev 10285)
+++ doc/pod/news.pod 2018-05-21 12:41:23 UTC (rev 10286)
@@ -23,6 +23,12 @@
INN documentation and samples of Python hooks have been updated to
provide more examples.
+=item *
+
+When a Python or Perl filter hook rejects an article, B<innd> now mentions
+the reason in response to CHECK and TAKETHIS commands. Previously,
+the reason was given only for the IHAVE command.
+
=back
=head1 Changes in 2.6.2
Modified: innd/nc.c
===================================================================
--- innd/nc.c 2018-05-16 19:57:59 UTC (rev 10285)
+++ innd/nc.c 2018-05-21 12:41:23 UTC (rev 10286)
@@ -642,7 +642,7 @@
{
char *buff = NULL;
#if defined(DO_PERL) || defined(DO_PYTHON)
- char *filterrc;
+ char *filterrc = NULL;
size_t msglen;
#endif /*defined(DO_PERL) || defined(DO_PYTHON) */
@@ -1801,7 +1801,7 @@
char *buff = NULL;
size_t idlen, msglen;
#if defined(DO_PERL) || defined(DO_PYTHON)
- char *filterrc;
+ char *filterrc = NULL;
#endif /* DO_PERL || DO_PYTHON */
cp->Check++;
@@ -1819,7 +1819,8 @@
cp->Sendid.data = xmalloc(cp->Sendid.size);
}
if (!IsValidMessageID(cp->av[1], false, laxmid)) {
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ snprintf(cp->Sendid.data, cp->Sendid.size,
+ "%d %s Syntax error in message-ID",
NNTP_FAIL_CHECK_REFUSE, cp->av[1]);
NCwritereply(cp, cp->Sendid.data);
syslog(L_NOTICE, "%s bad_messageid %s", CHANname(cp),
@@ -1830,7 +1831,7 @@
if ((innconf->refusecybercancels) && (strncmp(cp->av[1], "<cancel.", 8) == 0)) {
cp->Refused++;
cp->Check_cybercan++;
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s Cyberspam cancel",
NNTP_FAIL_CHECK_REFUSE, cp->av[1]);
NCwritereply(cp, cp->Sendid.data);
return;
@@ -1853,8 +1854,8 @@
filterrc = PLmidfilter(cp->av[1]);
if (filterrc) {
cp->Refused++;
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
- NNTP_FAIL_CHECK_REFUSE, cp->av[1]);
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s %.200s",
+ NNTP_FAIL_CHECK_REFUSE, cp->av[1], filterrc);
NCwritereply(cp, cp->Sendid.data);
return;
}
@@ -1865,8 +1866,8 @@
filterrc = PYmidfilter(cp->av[1], idlen);
if (filterrc) {
cp->Refused++;
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
- NNTP_FAIL_CHECK_REFUSE, cp->av[1]);
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s %.200s",
+ NNTP_FAIL_CHECK_REFUSE, cp->av[1], filterrc);
NCwritereply(cp, cp->Sendid.data);
return;
}
@@ -1875,7 +1876,7 @@
if (HIScheck(History, cp->av[1]) || cp->Ignore) {
cp->Refused++;
cp->Check_got++;
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s Duplicate",
NNTP_FAIL_CHECK_REFUSE, cp->av[1]);
NCwritereply(cp, cp->Sendid.data);
} else if (WIPinprogress(cp->av[1], cp, true)) {
@@ -1882,16 +1883,16 @@
cp->Check_deferred++;
if (cp->NoResendId) {
cp->Refused++;
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s Do not resend",
NNTP_FAIL_CHECK_REFUSE, cp->av[1]);
} else {
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s Retry later",
NNTP_FAIL_CHECK_DEFER, cp->av[1]);
}
NCwritereply(cp, cp->Sendid.data);
} else {
cp->Check_send++;
- snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s Send it",
NNTP_OK_CHECK, cp->av[1]);
NCwritereply(cp, cp->Sendid.data);
}
@@ -1912,7 +1913,7 @@
size_t idlen, msglen;
WIP *wp;
#if defined(DO_PERL) || defined(DO_PYTHON)
- char *filterrc;
+ char *filterrc = NULL;
#endif /* DO_PERL || DO_PYTHON */
cp->Takethis++;
@@ -1969,9 +1970,20 @@
cp->Sendid.size = MED_BUFFER;
cp->Sendid.data = xmalloc(cp->Sendid.size);
}
+
/* Save ID for later NACK or ACK. */
+#if defined(DO_PERL) || defined(DO_PYTHON)
+ if (filterrc != NULL) {
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s %.200s",
+ returncode, mid, filterrc);
+ } else {
+ snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
+ returncode, mid);
+ }
+#else
snprintf(cp->Sendid.data, cp->Sendid.size, "%d %s",
returncode, mid);
+#endif /* defined(DO_PERL) || defined(DO_PYTHON) */
cp->ArtBeg = Now.tv_sec;
cp->State = CSgetheader;
More information about the inn-committers
mailing list