Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!mintaka!bloom-beacon!eru!hagbard!sunic!ericom!eua.ericsson.se!erix.ericsson.se!per From: per@erix.ericsson.se (Per Hedeland) Newsgroups: news.software.b Subject: Re: Wrong Path in articles under C News Message-ID: <1991May16.213751.3902@eua.ericsson.se> Date: 16 May 91 21:37:51 GMT References: <1991May15.224905.985@zoo.toronto.edu> Sender: news@eua.ericsson.se Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden Lines: 109 Nntp-Posting-Host: super.eua.ericsson.se In article <1991May15.224905.985@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >In article mike@apex.yorku.ca (Mike Marques) writes: >>... Things work just fine except articles posted locally have >>the local host twice in their Path: field: >> >>Path: newshub.ccs.yorku.ca!newshub.ccs.yorku.ca!mike > >This probably means that whatever software is being used to do the posting >is supplying its own Path header, which is a stupid mistake but does happen. The "stupidity", if any, is most likely not a mistake, but an attempt (futile, I know), to make the Path: header usable for mail replies - when posting over NNTP, the poster need not even have an account on the server host, and so the posting program provides a 'Path: posting-host!user' line. Perhaps the posting program should detect that posting-host is equal to nntpserver, and skip the Path: in this case, but I don't know of any that does. >The fix is to fix the posting software. This just might be NNTP's fault >if you are posting through it, but whatever you're using as reader/poster >is more likely to be at fault. Nntpd just passes the bytes to inews; the mini-inews that comes with the NNTP distribution does create a Path: header in certain circumstances, though. >It's relatively harmless. Agreed, but it's ugly and space-wasting - and easily fixable in C news, of course - the fix (to relay/hdrmunge.c) that isn't one is appended below, but somehow I don't expect it to show up in the official patches:-). --Per Hedeland per@erix.ericsson.se or per%erix.ericsson.se@uunet.uu.net or ...uunet!erix.ericsson.se!per *** /tmp/,RCSt1a03848 Thu May 16 23:32:31 1991 --- hdrmunge.c Sun Apr 28 12:04:49 1991 *************** *** 177,205 **** { if (CISTREQN(hdr, pathhdr.hdrnm, (int)pathhdr.hdrlen)) { register char *oldpath, *hostnm = hostname(); oldpath = skipsp(&hdr[pathhdr.hdrlen]); - /* - * V7 f?printf return 0 or EOF, not a byte count, so it is - * not portable to use fprintf's return value as a byte count. - */ - if (fprintf(art->a_artf, "%s %s!", pathhdr.hdrnm, hostnm) == - EOF || fputs(oldpath, art->a_artf) == EOF) - fulldisk(art, spoolnm(art)); - else { - static unsigned hostlen = 0; ! if (hostlen == 0) ! hostlen = strlen(hostnm); ! art->a_charswritten += pathhdr.hdrlen + STRLEN(" ") + ! hostlen + STRLEN("!") + strlen(oldpath); } - } else { - if (fwrite(hdr, hdrlen, 1, art->a_artf) != 1) - fulldisk(art, spoolnm(art)); - else - art->a_charswritten += hdrlen; } } /* --- 187,224 ---- { if (CISTREQN(hdr, pathhdr.hdrnm, (int)pathhdr.hdrlen)) { register char *oldpath, *hostnm = hostname(); + static unsigned hostlen = 0; + if (hostlen == 0) + hostlen = strlen(hostnm); oldpath = skipsp(&hdr[pathhdr.hdrlen]); ! /* Don't add our name to Path: if it's already there ! (may happen e.g. with NNTP posters) - B news doesn't... */ ! if (strncmp(hostnm, oldpath, hostlen) != 0 || ! strlen(oldpath) <= hostlen || ! oldpath[hostlen] != '!') { ! /* ! * V7 f?printf return 0 or EOF, not a byte count, ! * so it is not portable to use fprintf's return ! * value as a byte count. ! */ ! if (fprintf(art->a_artf, "%s %s!", ! pathhdr.hdrnm, hostnm) == EOF || ! fputs(oldpath, art->a_artf) == EOF) ! fulldisk(art, spoolnm(art)); ! else { ! art->a_charswritten += ! pathhdr.hdrlen + STRLEN(" ") + ! hostlen + STRLEN("!") + strlen(oldpath); ! } ! return; } } + if (fwrite(hdr, hdrlen, 1, art->a_artf) != 1) + fulldisk(art, spoolnm(art)); + else + art->a_charswritten += hdrlen; } /*