[news.software.b] Bug in mailing to moderator

rees@apollo.uucp (Jim Rees) (06/17/87)

Here's one that I'm amazed has escaped detection so far.  Actually, it
looks familiar, but I couldn't find it in my bug list.

The symptom is to put garbage in the "To:" line on articles redirected
by inews to the moderator.  I suspect it has gone undetected because the
"To:" address is normally given explicitly to sendmail rather than gleaned
from the header.  Also, it's sometimes OK, due to the layout of the header
struct and the proximity of the various "from" fields to the beginning
of the struct.

In inews.c:

***************
*** 927,933
  		mfd = mhopen(&mhdr);
  		if (mfd == NULL)
  			xerror("Can't send mail to %s", mhdr.path);
! 		fprintf(mfd, "To: %s\n", replyname(mhdr.path));
  		lhwrite(&header, mfd);
  		putc('\n', mfd);
  		while ((c = getc(infp)) != EOF)

--- 927,933 -----
  		mfd = mhopen(&mhdr);
  		if (mfd == NULL)
  			xerror("Can't send mail to %s", mhdr.path);
! 		fprintf(mfd, "To: %s\n", replyname(&mhdr));
  		lhwrite(&header, mfd);
  		putc('\n', mfd);
  		while ((c = getc(infp)) != EOF)


While we're at it, replyname() shouldn't be stripping off the full name
from the address, in my humble opinion.  I diked that code and it works
just fine, with the benefit that our headers on replies now look better
than yours (nyah nyah).

The replyname() fix, if you want it; it works here, but then we don't use
sendmail directly.  Install this at your own risk, and test it first.
In funcs2.c:

***************
*** 328,339
  		ptr = hptr->replyto;
  #endif
  	(void) strcpy(tbuf, ptr);
- 	ptr = index(tbuf, '(');
- 	if (ptr) {
- 		while (ptr[-1] == ' ')
- 			ptr--;
- 		*ptr = 0;
- 	}
  #ifdef	SunIII
  	if (ptr = rindex(tbuf, '.')) {
  		if (prefix(++ptr, "OZ")) {

--- 328,333 -----
  		ptr = hptr->replyto;
  #endif
  	(void) strcpy(tbuf, ptr);
  #ifdef	SunIII
  	if (ptr = rindex(tbuf, '.')) {
  		if (prefix(++ptr, "OZ")) {

page@ulowell.cs.ulowell.edu (Bob Page) (06/18/87)

rees@apollo.uucp (Jim Rees) wrote in article <3586af4f.b8ab@apollo.uucp>:
>Here's one that I'm amazed has escaped detection so far.  Actually, it
>looks familiar, but I couldn't find it in my bug list.

It isn't that old; it was introduced in patch 5.  It looks familiar because
this was code that I wrote to fix the "submission for mod-foo-bar" subject
lines, posted to the net after patch 4 came out.  I took a look at the code
I submitted to Rick (and to the net) and compared it with what was included
in patch 5.

The code I submitted/posted was correct, patch 5 was not.  Jim Rees' patch
will correct the problem if you didn't install my patch and installed
patch 5 instead, or de-installed the patch before installing patch 5.

Once again, in inews.c:
 		fprintf(mfd, "To: %s\n", replyname(mhdr.path));
should be:
 		fprintf(mfd, "To: %s\n", replyname(&mhdr));

..Bob (still on patch 4, the last stable version as far as I'm concerned)
-- 
Bob Page, U of Lowell CS Dept.   page@ulowell.{uucp,edu,csnet}