🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
8 messages
8 total messages Started by Keith Lewis Tue, 13 May 1997 00:00
very large path line crashes innd
#17749
Author: Keith Lewis
Date: Tue, 13 May 1997 00:00
288 lines
9312 bytes

-----BEGIN PGP SIGNED MESSAGE-----


Hi Folks,

	I run a pair of news servers.  One exchanges news with other sites,
and the other handles almost all the nnrp traffic for the University.

	The first is called Harbinger, the second is called Towncrier.

	They both run inn 1.5.1.  The second is a slave to the first.

	Today a message arrived with a very large path line:


| # more /news/soc/culture/singapore/272235
| Path:harbinger.cc.monash.edu.au!msunews!news.mtu.edu!newsxfer.itd.umich.edu!\
| news.izzy.net!news.good.net!news.good.net!news.getnet.com!out2.nntp.cais.net!\
| news2.cais.com!news.intr.net!news.charm.net!news.clark.net!hustle.rahul.net!\
| rahul.net!a2i!bug.rahul.net!rahul.net!a2i!nntp.mainstreet.net!news.walltech.com!\
| daver!news.he.net!calwebnntp!news.eli.net!news.wolsi.com!news.aros.net!\
| news.uoregon.edu!news.acsu.buffalo.edu!dsinc!newsfeed.pitt.edu!portc02.blue.\
| aol.com!howland.erols.net!blackbush.xlink.net!news-kar1.dfn.de!news-fra1.dfn.de!\
| news-ber1.dfn.de!zrz.TU-Berlin.DE!stern.fokus.gmd.de!nntp.gmd.de!newsserver.\
| jvnc.net!news.merck.com!cam-news-feed1.bbnplanet.com!cam-news-hub1.bbnplanet.\
| com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-feed2.bbnplanet.\
| com!bigboote.WPI.EDU!news.ultranet.com!zombie.ncsc.mil!news.missouri.edu!ukma!\
| news.memphis.edu!nntp.msstate.edu!gatech!csulb.edu!hammer.uoregon.edu!news.\
| ironhorse.com!nntp.portal.ca!van-bc!n1van.istar!van.istar!west.istar!news-\
| w.ans.net!newsfeeds.ans.net!lantana.singnet.com.sg!usenet
| From: Anonymous
| Newsgroups: soc.culture.singapore
| Subject: Hello.
| Date: -
| Organization: Singapore Telecom Internet Service
| Lines: 3
| Distribution: world
| Message-ID: <ALmpw9pCs0@Alamak>
| NNTP-Posting-Host: ts900-6929.singnet.com.sg
| Mime-Version: 1.0
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: 7bit
| Xref: harbinger.cc.monash.edu.au soc.culture.singapore:272235
| 
| hello. How is everybody here.
|

	Now somehow that message got accepted by Harbinger, and passed on to
Towncrier using the xreplic protocol.  

	At which point Towncrier died a dismal death.

	innd didn't write any log anywhere, just dropped core in the news
spool.

	Analysing the core I proceeded as follows:

# dbx /usr/local/etc/innd ./core
dbx version 3.11.10
Type 'help' for help.
Core file created by program "innd"

signal Segmentation fault at >*[NLstrdlen, 0x3ff800d1870] ldq_u r1, 0(r16)
(dbx) where
> 0 NLstrdlen(0x2d, 0x11fffe980, 0x3ff00000010, 0x140012a00,
0x7ff0000000000000) [0x3ff800d1870]
   1 HISsetkey(p = (nil), keyp = 0x11fffe9f8) ["his.c":104, 0x1200169c4]
   2 HISwrite(Data = 0x11fffea88, paths = 0x140001aa8 = "") ["his.c":245,
0x1200170f8]
   3 ARTpost(cp = 0x14001a7c0, Replic = 0x14014df38, ihave = (nil))
["art.c":1787, 0x12000ba68]
   4 NCpostit(cp = 0x14001a7c0) ["nc.c":235, 0x12001c568]
   5 NCproc(cp = 0x14001a7c0) ["nc.c":1086, 0x12001fdb0]
   6 NCreader(cp = 0x14001a7c0) ["nc.c":1311, 0x12002098c]
   7 CHANreadloop() ["chan.c":873, 0x120015db0]
   8 main(ac = 0, av = 0x11ffffd28) ["innd.c":952, 0x12001b2d4]
(dbx) 


	OK, starting at the top, segfault.  Presumably strlen called with a
null pointer.

	Looking at the source of HISsetkey 

STATIC void
HISsetkey(p, keyp)
    register char       *p;
    datum               *keyp;
{
    static BUFFER       MessageID;
    register char       *dest;
    register int        i;

    /* Get space to hold the ID. */
    i = strlen(p);

	Yep.  Strlen called with a null allright.

	But why?  What was HISwrite doing?

BOOL
HISwrite(Data, paths)
    ARTDATA             *Data;
    char                *paths;
{
    static char         NOPATHS[] = "";
    long                offset;
    datum               key;
    datum               val;
    int                 i;

    HISsetkey(Data->MessageID, &key);

	Is MessageID blank?

(dbx) func HISwrite
HISwrite:        Source not available
(dbx) print Data
0x11fffea88 
(dbx) print *Data
struct {
    Poster = 0x14014a8c0 = ""
    Replyto = 0x14014a8c0 = ""
    Body = 0x1404a3000 = "Path:
harbinger.cc.monash.edu.au!msunews!news.mtu.edu!newsxfer.itd.umich.edu!news.izzy.net!news.good.net!news.good.net!news.getnet.com!o\..."
    Posted = 863304370
    Arrived = 863483145
    Expires = 0
    Groupcount = 1
    LinesValue = 6
    Lines = ""
    SizeValue = 951
    Size = ""
    SizeLength = 3
    Name = "alt/2600/hope/announce/4253"
    NameLength = 27
    TimeReceived = "863483145"
    TimeReceivedLength = 9
    MessageID = (nil)
    MessageIDLength = 36
    Newsgroups = 0x1404a2d00 = "alt.2600.hope.announce"
    NewsgroupsLength = 22
    Distribution = 0x140001958 = "?"
More (n if no)?
    DistributionLength = 1
    Feedsite = 0x1400140f0 = "harbinger.cc.monash.edu.au"
    FeedsiteLength = 26
    Replic = 0x1404a2c80 = "alt.2600.hope.announce/4253"
    ReplicLength = 27
    Headers = 0x3ff80091f39
    Overview = 0x140008140
} 
(dbx) 

	Yep.  Sure is.  So where did that come from?
	Looking in art.c line 1787

    /* Now see if we got an error in the article. */
    if (error != NULL) {
        (void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, error);
        ARTlog(&Data, ART_REJECT, buff);
#if     defined(DO_REMEMBER_TRASH)
        if (Mode == OMrunning && !HISwrite(&Data, ""))		<------------
            syslog(L_ERROR, "%s cant write history %s %m",
                   LogName, Data.MessageID);
#endif  /* defined(DO_REMEMBER_TRASH) */
        ARTreject(buff, article);
        return buff;
    }

	While we are here, lets print out buff:

(dbx) print buff
"437 "Path" header too long" 
(dbx) 

	But what we really want to know is why is 

(dbx) print Data.MessageID
(nil) 
(dbx) 

	Going up to NCpostit:

    case OMrunning:
        wp = &NCwip[cp->fd];
        response = ARTpost(cp, AmSlave ? &wp->Replic : NULL, wp->MessageID);

(dbx) func NCpostit
NCpostit:        Source not available
(dbx) print wp->MessageID
(nil) 
(dbx) 

	Going up further, to NCproc, 

(dbx) func NCproc
NCproc:  Source not available
(dbx)

(dbx) print NCwip[16]
struct {
    MessageID = (nil)
    Size = 0
    Timestamp = 863483145
    Replic = struct {
        Size = 29
        Used = 29
        Left = 29
        Data = 0x1403d2970 = "soc.culture.singapore/272235"
    }
    Wanted = 0
} 
(dbx) 

	So we have to go up even more to find why MessageID is nill.
 
	looking at line 1086 in NCproc:

            /* Strip article terminator and post the article. */
            p[-3] = '\0';
            bp->Used -= 2;
            SCHANremove(cp);
            if (cp->Argument != NULL) {
                DISPOSE(cp->Argument);
                cp->Argument = NULL;
            }
            NCclean(bp);
            NCpostit(cp);			<---------------
            cp->State = CSgetcmd;
            break;


	Right... thats the problem...  Immediately before NCpostit is
NCclean which called ARTparseheader:

    for (error = NULL, in = out = Article->Data; ; out += delta, in = p) {
	...
        /* Check the validity of this header. */
        if ((p = ARTparseheader(in, out, &delta, &error)) == NULL)
            break;
    }
    Data->Body = out;
    in++;

    /* Try to set this now, so we can report it in errors. */
    p = HDR(_message_id);


	What went wrong was that ARTparseheader failed on the first header,
and hence broke out of the loop without parsing messageid.  Hence the line
p = HDR(_message_id), which, defined in art.h, expands to #define HDR(_x)
(ARTheaders[(_x)].Value), returned nil.  Hence the rest of the story.

	So what to do?

	Well, in the loop in NCclean we could be changed to not break on
errors...  That way all headers would be tested, and the last error, if any
would be returned.  Rather than the first.  So if a message id exists we will
find it and be able to do the history add and so on.

	Another thing we could do is not try and add items to history if
their headers are faulty...  i.e. `if ( p == NULL ) return;' at the top of  
HISwrite, or ARTpost...

	Actualy I guess there are lots of better alternatives.

	So finally my question:  `Is this a known bug, and is there an
official fix?'

Keith Lewis


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i

iQCVAwUBM3gSUXEpE0nRVDfpAQE9gwQAvol3PtvCPJCr4r/LxgN6dgOlw/UkzRnz
8AqJjMjFxA1niDFZgX97a3969rHALI8/gwb6KJyobmPGV+uq3fAol9bIEWtF2ooz
O7HBiFXP3TlopzM2QN+ngPtQQJ9zpHsB+XT0kicC0h6ilAlpxicSDZJgrrCg0D9t
IGyaUyzbl2o=
=3E+e
-----END PGP SIGNATURE-----

	

Re: very large path line crashes innd
#17724
Author: Sang-yong Suh
Date: Tue, 13 May 1997 00:00
37 lines
2090 bytes
In article <5l93pr$3jm$1@towncrier.cc.monash.edu.au>,
Keith Lewis <keithl@mukluk.cc.monash.edu.au> wrote:
  [ many statements deleted ]
>
>	Right... thats the problem...  Immediately before NCpostit is
>NCclean which called ARTparseheader:

Hello.  I also have problem of the slave server.  It dies without
any log.  But I do not know how to debug the core.  Thank you for
the detailed description of using debug.

Btw, my inn-1.5.1 source looks like different from yours, i.e.,
NCclean does not call ARTparseheader.  Instead ARTclean does that.

  [deleted some more]

>	What went wrong was that ARTparseheader failed on the first header,
>and hence broke out of the loop without parsing messageid.  Hence the line
>p = HDR(_message_id), which, defined in art.h, expands to #define HDR(_x)
>(ARTheaders[(_x)].Value), returned nil.  Hence the rest of the story.

In ARTclean, the message ID is replaced by if there is something in
p = HDR(_message_id).  Otherwise, Data->MessageID remains the vaule
of ihave.

In my case, I added some code in innwatch to check if innd is running
or not.  And if it's not running, I simply restarts it.  Of course
the renumbering and invoking another innwatch are disabled in my rc.news.
My slave innd crashes one or two times a week but never on master.
Anyway, I wish you to trace some more, if what I wrote is right.

Regards,
--
Sang-yong Suh

Re: very large path line crashes innd
#18390
Author: James Brister
Date: Tue, 10 Jun 1997 00:00
31 lines
1400 bytes
mibsoft@epix.net (Forrest J. Cavalier III) writes:

> In article <5l93pr$3jm$1@towncrier.cc.monash.edu.au>, 
> keithl@mukluk.cc.monash.edu.au wrote...
> 
> [detective story]
> 
> Nice work

Agreed.

> but I think you are reporting a known problem.  ALL
> sites running INN 1.5.1 should make this patch.

Correct, and this patch will be part of the next release.

> ftp://ftp.isc.org/isc/inn/unoff-patches/null-pointer.patch
> 	Type: Bug/Security Fix
> 	Symptom: 1060 character Path header crashes innd.
> 	Applies to: INN-1.5.1/innd/art.c
> 	OS: all
> 	Incorporated into 1.5.1: No
> 	Authored: Michael Shields, 17 Dec 1996

James
-- 
James Brister                                            brister@vix.com
Internet Software Consortium      http://www.isc.org     inn@isc.org 

Re: very large path line crashes innd
#18403
Author: Dale Ghent
Date: Wed, 11 Jun 1997 00:00
12 lines
893 bytes
James Brister wrote:

> Correct, and this patch will be part of the next release.

Just curious... when is the next release slated to be released and could
you provide any insight as to what it will incorporate?

		Thanks
		-Dale G.

Re: very large path line crashes innd
#18419
Author: James Brister
Date: Wed, 11 Jun 1997 00:00
63 lines
4189 bytes
Dale Ghent <daleg-hatesspam@maximum.net> writes:

> Just curious... when is the next release slated to be released and could
> you provide any insight as to what it will incorporate?

I've been saying "soon" for too long now, so I'm not going to hazard a
guess as to when. As for what it will have, here's the changes portion of
the README. It's not finished yet though.

        - Slaving is now done automatically via Xref header
          parsing. XREPLIC is no longer needed.
        - Improvements in responsiveness to new connections or ctlinnd
          connections.
        - All IP_OPTIONS on new connections are logged and cleared.
        - A new header X-Trace is added by nnrpd when articles are posted.
          It contains the date (in UTC seconds), the pid of the nnrpd
          process, the IP address (dotted quad form) of the client. There's
          a place holder for possible ident data, but that's not yet 
          supported.
        - New 'P' value for the 'W' flag in the newsfeeds file (sends the
          Path header to the site process/file.
        - The LIKE_PULLERS code has been moved to *after* the article is
          sent and fixed and the default is now off.
        - If the Perl hooks are used, then the filter_mode subroutine is
          called when innd is shutdown. The mode is "throttled" and the
          reason string is "shutting down".
        - A perl script is supplied (innmail) that can be used in place 
          of UCB Mail as the _PATH_MAIL definition in config.data. This is
          recommended as UCB mail has too many security holes when used
          non-interactively.
        - Some defaults are changed in the control.ctl, mostly to reduce
          the amount of mail that goes out.
        - Many potential buffer overruns fixed. Fixing these requires using
          snprintf(), which some systems don't have. An implementation is
          supplied in the directory newlog-1.0.4.
        - The active file is now MMAPed by nnrpd.
        - a lot of minor documentation cleanups
        - a svr4-style startup script is in samples/nntp.server (copied to
          site/nntp.server during building). You need to do the right thing
          with this if you need it. See the comments at the beginning of
          the script.
        - innxmit will now ignore extra arguments in the batch files, and
          will write out those same arguments if it has to respool the
          article (thus permitting more effecient preprocessing filters to
          the batch files, for example).
        - innwatch will monitor the log disk's free space.
        - nnrpd will accept postings with NNTP-Posting-Host headers in
          them, but it will silently toss them and set the correct value
          (previously it refused to accept the post if the header was there).
        - The innshellvars.csh file has had almost all its variables
          renamed because of a limit on the length of C shell variable
          names on some systems.
        - New config.data variables: INNWATCH_LOGSPACE, HAVE_SNPRINTF
        - The necessary code and Makefile adjustments have been made to be
          able to link in the GNU dmalloc library if wanted.
        - Various minor bug fixes.

-- 
James Brister                                            brister@vix.com
Internet Software Consortium      http://www.isc.org     inn@isc.org 

New INN (was Re: very large path line crashes innd)
#18462
Author: Forrest J. Cavalier III
Date: Fri, 13 Jun 1997 00:00
22 lines
1310 bytes
In article <yy3yb8hc4nc.fsf@velo.pp.vix.com>, brister@vix.com wrote...
>
>Dale Ghent <daleg-hatesspam@maximum.net> writes:
>
>> Just curious... when is the next release slated to be released and could
>> you provide any insight as to what it will incorporate?
>
>I've been saying "soon" for too long now, so I'm not going to hazard a
>guess as to when. As for what it will have, here's the changes portion of
>the README. It's not finished yet though.
>
[snip of change list]

Also: Any thought to Y2000 compliance?

Forrest Cavalier, INN customization and consulting




INN man pages (was Re: very large path line crashes innd)
#18465
Author: Forrest J. Cavalier III
Date: Fri, 13 Jun 1997 00:00
85 lines
4950 bytes
In article <yy3yb8hc4nc.fsf@velo.pp.vix.com>, brister@vix.com wrote...
>
>Dale Ghent <daleg-hatesspam@maximum.net> writes:
>
>> Just curious... when is the next release slated to be released and could
>> you provide any insight as to what it will incorporate?
>
>I've been saying "soon" for too long now, so I'm not going to hazard a
>guess as to when. As for what it will have, here's the changes portion of
>the README. It's not finished yet though.
>
[snip]
>        - a lot of minor documentation cleanups
[snip]

(I've been meaning to mention this for a while....)

The standard INN man pages are subst victim files.  I think this is a poor
design for the following reasons:
	- When reading the man page, the config value which affects the
	  behavior is not documented: only its value appears.

        - Some man pages have conditional sections based on config variables.
          (So in addition to not being good documentation, it makes everyone's                     
          man page different, depending on their config.data.

Let show by example.  Which of the following is better documentation?

------------------------------------------------------------------------------
Excerpt from http://www.mibsoftware.com/userkt/inn/doc/innd.8.htm

DESCRIPTION
     Innd, the InterNetNews daemon, handles all incoming NNTP feeds.  It reads
     the  active(5) ,  newsfeeds(5) ,  and  hosts.nntp(5) files into memory.  It
     then opens the NNTP port to receive articles from remote sites  (see  the
     ``-p''  option),  When  <config$HAVE_UNIX_DOMAIN>  ==  DO,  a Unix-domain
     stream socket to receive articles from local processes such  as  nnrpd(8) 
     and  rnews(1) ,  and  a Unix-domain datagram socket for use by ctlinnd(8) .
     When <config$HAVE_UNIX_DOMAIN> is not DO named pipes  are  used  instead.
     ctlinnd(8)   is  used to direct the server to perform certain actions.  It
     also opens the history(5)  database and  two  log  files  to  replace  its
     standard output and standard error.

     Once the files and sockets have been opened, innd waits  for  connections
     and  data  to  be  ready on its ports by using select(2) and non-blocking
     I/O.  If no data is available,  then  it  will  flush  its  in-core  data
     structures.   The default number of seconds to timeout before flushing is
     set as <config$DEFAULT_TIMEOUT> (typically 300) seconds.
-------------------------------------------------------------------------------

Compare to an excerpt from the standard innd(8) man page:

-------------------------------------------------------------------------------
DESCRIPTION
     Innd, the InterNetNews daemon, handles all incoming NNTP feeds.  It reads
     the  active(5),  newsfeeds(5),  and  hosts.nntp(5) files into memory.  It
     then opens the NNTP port to receive articles from remote sites  (see  the
     ``-p''  option),  a  Unix-domain  stream  socket to receive articles from
     local processes such as nnrpd(8) and rnews(1), and a Unix-domain datagram
     socket  for use  by ctlinnd(8) to  direct  the server  to perform certain
     actions.  It also  opens  the  history(5)  database  and two log files to
     replace its standard output and standard error.

     Once the files and sockets have been opened, innd waits  for  connections
     and  data  to  be  ready on its ports by using select(2) and non-blocking
     I/O.  If no data is available,  then  it  will  flush  its  in-core  data
     structures.   The default number of seconds to timeout before flushing is
     300 seconds.
------------------------------------------------------------------------------

There is a lot of useful information that gets hidden in the standard man
pages, (even if they are much easier to read than my version.)

It must have taken a great deal of work to write all the conditional roff
statements.  I wonder why the choice was made that way.
   

(Apologies for long line lengths...)
Forrest Cavalier, Mib Software, INN customization and consulting.
Searchable Hypertext docs (INN man pages, FAQ, etc)
     http://www.mibsoftware.com/userkt/forprov.htm


Re: INN man pages (was Re: very large path line crashes innd)
#18473
Author: James Brister
Date: Sat, 14 Jun 1997 00:00
29 lines
2103 bytes
mibsoft@epix.net (Forrest J. Cavalier III) writes:

> (I've been meaning to mention this for a while....)
> 
> The standard INN man pages are subst victim files.  I think this is a poor
> design for the following reasons:
> 	- When reading the man page, the config value which affects the
> 	  behavior is not documented: only its value appears.

The config variables need to be better documented, but the man page for
newsfeeds (for example) is not the place to document the name and
behaviour of the _PATH_NEWSBIN variable (which it uses).

>         - Some man pages have conditional sections based on config variables.
>           (So in addition to not being good documentation, it makes everyone's                     
>           man page different, depending on their config.data.

Right. People not using the Perl hooks (for example) don't want to wade
through perl hook documentation. Personally I like the subst'ing of the
man pages -- no need to refering to config.data to see what the values
really are, and no reading unnecessary info.

James
-- 
James Brister                                            brister@vix.com
Internet Software Consortium      http://www.isc.org     inn@isc.org 

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads