Article View: news.software.nntp
Article #13202FIX: Re: INN 1.5 VS 1.5b2, perl filtering trouble
From: Andy Burgess
Date: Wed, 11 Dec 1996 00:00
Date: Wed, 11 Dec 1996 00:00
111 lines
3564 bytes
3564 bytes
In <58k1l2$vs4$1@loach.cichlid.com> aab@cichlid.com (Andy Burgess) writes:
>I have been attempting to upgrade from INN 1.5b2 to 1.5. Both versions
>use almost the same config.data, exactly the same perl (5.003) and
>filter_innd.pl (config diff at the end of this post). I switch between
>versions by running make update in the appropriate directories).
This was caused by the perl memory leak fixes in 1.5.
The perl lib macro FREETMPS frees the return value from the perl
function filter_art. The value was returned from HandleArticle() in
perl.c, a classic using memory after freeing it bug. The following
patch fixes this.
This was causing intermittant garbage returns from filter_art and thus
garbage reasons for rejection in the log file, eg:
innd: rejecting[perl] <961209210445_708138071@emout19.mail.aol.com> 437 xH
Dec 9 18:14:16.377 - news.scruz.net <961209210445_708138071@emout19.mail.aol.co
m> 437 xH
There is another bug which I haven't fixed yet whereby optional article
headers are not cleared from the perl hdr array. Thus when you get a
header with a Control line, the hdr array has the same control line
value for all subsequent articles in the perl program that do not have
Control header lines. This can be worked around in the perl code by
including the following line in filter_art after you are finished with
the hdr array:
$hdr{"Control"} = "";
I don't know how to fix this in perl.c without leaking memory but its
just a perl manpage read away.
Thanks to everyone who ever worked on inn :-)
========================================================================
*** perl.c.orig Wed Dec 11 12:49:04 1996
--- perl.c Wed Dec 11 13:14:56 1996
***************
*** 39,45 ****
ARTHEADER *hp;
HV *hdr;
int rc;
! char *p;
if (!PerlFilterActive || perl_filter_cv == NULL)
return NULL;
--- 39,46 ----
ARTHEADER *hp;
HV *hdr;
int rc;
! char *p = NULL; /* may not get set below */
! static char buf[200];
if (!PerlFilterActive || perl_filter_cv == NULL)
return NULL;
***************
*** 46,51 ****
--- 47,55 ----
/* Create the Perl Hash */
hdr = perl_get_hv("hdr", TRUE);
+
+ /* fix the Control header not being reset bug */
+ /* hv_store(hdr, "Control", sizeof("Control"), ... */
for (hp = ARTheaders; hp < ARTheadersENDOF; hp++)
{
if (hp->Found && hp->Value)
***************
*** 70,82 ****
{
p = POPp;
}
PUTBACK;
FREETMPS;
LEAVE;
! if (p != NULL && *p != '\0')
! return p;
return NULL;
}
--- 74,93 ----
{
p = POPp;
}
+ if(p != NULL && *p != '\0')
+ {
+ strncpy(buf, p, sizeof(buf)-1);
+ buf[sizeof(buf)-1] = '\0';
+ }
+ else
+ *buf = '\0';
PUTBACK;
FREETMPS;
LEAVE;
! if (*buf != '\0')
! return buf;
return NULL;
}
Technical Details
Message-ID:
<58n9n2$lfr$1@loach.cichlid.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<58k1l2$vs4$1@loach.cichlid.com>Show Full Headers
Complete Article Headers
Message-ID: <58n9n2$lfr$1@loach.cichlid.com> Subject: FIX: Re: INN 1.5 VS 1.5b2, perl filtering trouble Date: Wed, 11 Dec 1996 00:00:00 +0000 From: aab@cichlid.com (Andy Burgess) References: <58k1l2$vs4$1@loach.cichlid.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 203579057 Distribution: inet Newsgroups: news.software.nntp