From richard@hekkihek.hacom.nl Fri Sep 29 11:51:05 EDT 1995
Article: 14379 of news.software.nntp
Path: news.math.psu.edu!psuvax1!uwm.edu!hookup!news.caren.net!news.join.ad.jp!news.imnet.ad.jp!usenet.seri.re.kr!news.kreonet.re.kr!news.dacom.co.kr!news.netins.net!solaris.cc.vt.edu!news.mathworks.com!tank.news.pipex.net!pipex!news.sprintlink.net!EU.net!sun4nl!hacom.nl!hekkihek.hacom.nl!news
From: richard@hekkihek.hacom.nl (Richard Huveneers)
Newsgroups: news.software.nntp
Subject: Re: Hanging ctlinnds under Linux. Patch?
Date: 28 Sep 1995 18:38:37 GMT
Organization: Private site ** OS: Linux ** NTS: INN 1.4 unoff2, Taylor UUCP 1.05
Lines: 169
Distribution: world
Message-ID: <44eq3d$3c@hekkihek.hacom.nl>
References: <447bk6$4ln@dodgson.math.psu.edu>
Reply-To: richard@hekkihek.hacom.nl
NNTP-Posting-Host: hekkihek.hacom.nl
X-Newsreader: xvnews 2.3 PL2

In article <447bk6$4ln@dodgson.math.psu.edu>, barr@math.psu.edu (Dave Barr) writes:
>In article <440ird$3c@hekkihek.hacom.nl>,
>Richard Huveneers <richard@hekkihek.hacom.nl> wrote:
>>I followed up Arjen de Vet's instructions to install it, including applying his
>>patch to solve the problem with multiple control messages.
>>You can find these in the latest newspak distribution on sunsite.
>>
>>BTW, this bug should affect other OS's too.
>
>If anyone can find me this patch, I'd love to put it in the next unoff
>release.
>
>--Dave

Oops, my fault. It's _not_ in the newspak distribution, but in another file.
The patch is rather small, so I included it at the end of this article.
(if you really want to download it yourself, it's in the file
/pub/Linux/system/Mail/news/inn-1.4-linux-0.1.tar.gz on sunsite)

N.B. 1: In the UNOFF-NOTES directory of inn1.4unoff2, there is a file Linux, which
also has a patch in it. It looks like it is handling the same problem, although the
two patches are not the same. I don't recommend applying that patch.

N.B. 2: Although the patch is meant for inn1.4sec, it still applies cleanly.

I noticed that there is no config.data for Linux in the inn1.4unoff2 distribution.
I started with Arjan's config.data, added the two new symbols, and changed all
pathnames in accordance with the Linux Filesystem Standard 1.2.
It's too big to include here, so anybody who's interested in it,
please e-mail me (Dave?).

I haven't had one single problem with inn1.4unoff2 so far...

Richard.

####

Ok, so here's the patch to solve the ctlinnd problems:

*** lib/inndcomm.c.orig	Fri Aug 13 13:44:24 1993
--- lib/inndcomm.c	Sat Aug 14 15:12:54 1993
***************
*** 169,175 ****
--- 169,186 ----
  
  /*
  **  Send an arbitrary command to the server.
+ **  Note that for those systems without Unix Domain Sockets,
+ **  the command format is different. There is a two byte
+ **  length code on the front of the message. This is a
+ **  direct mapped integer. Note that sending and receiving
+ **  architectures *must* be the same as we are on the same
+ **  machine.
  */
+ #if defined(DO_HAVE_UNIX_DOMAIN)
+ #define BUFF_OFFSET 0
+ #else
+ #define BUFF_OFFSET sizeof(ICC_MSGLENTYPE)
+ #endif
  int
  ICCcommand(cmd, argv, replyp)
      char		cmd;
***************
*** 203,209 ****
  	bufsiz += 1 + strlen(p);
      if (bufsiz < MIN_BUFFER_SIZE)
  	bufsiz = MIN_BUFFER_SIZE;
!     buff = malloc((unsigned int)bufsiz);
      if (buff == NULL) {
  	ICCfailure = "malloc";
  	return -1;
--- 214,220 ----
  	bufsiz += 1 + strlen(p);
      if (bufsiz < MIN_BUFFER_SIZE)
  	bufsiz = MIN_BUFFER_SIZE;
!     buff = malloc((unsigned int)bufsiz + BUFF_OFFSET);
      if (buff == NULL) {
  	ICCfailure = "malloc";
  	return -1;
***************
*** 211,216 ****
--- 222,229 ----
      if (replyp)
  	*replyp = NULL;
  
+     buff += BUFF_OFFSET;	/* Advance to leave space for length */
+ 
      /* Format the message. */
      (void)sprintf(buff, "%s%c%c", ICCsockname, SC_SEP, cmd);
      for (p = buff + strlen(buff), i = 0; (q = argv[i]) != NULL; i++) {
***************
*** 221,226 ****
--- 234,243 ----
      /* Send message. */
      ICCfailure = NULL;
      len = p - buff;
+ 
+     buff -= BUFF_OFFSET;	/* Not strictly required - could be inside
+ 				 * #else clause below */
+ 
  #if	defined(DO_HAVE_UNIX_DOMAIN)
      if (sendto(ICCfd, buff, len, 0,
  	    (struct sockaddr *)&ICCserv, AF_UNIX_SOCKSIZE(ICCserv)) < 0) {
***************
*** 234,239 ****
--- 251,258 ----
  	ICCfailure = "open";
  	return -1;
      }
+     *(ICC_MSGLENTYPE *) buff = len;
+     len += BUFF_OFFSET;
      if (write(fd, buff, len) != len) {
  	i = errno;
  	DISPOSE(buff);
*** include/inndcomm.h.orig	Sat Aug 14 15:09:12 1993
--- include/inndcomm.h	Sat Aug 14 15:14:44 1993
***************
*** 4,9 ****
--- 4,15 ----
  **  running.
  */
  
+ #if !defined(DO_HAVE_UNIX_DOMAIN)
+ typedef short ICC_MSGLENTYPE;	/* Length code to prefix commands to
+ 				** the server.
+ 				*/
+ #endif
+ 
  #define SC_SEP		'\001'
  #define SC_MAXFIELDS	6
  
*** innd/cc.c.orig	Fri Aug 13 13:51:22 1993
--- innd/cc.c	Sat Aug 14 15:13:52 1993
***************
*** 1314,1319 ****
--- 1314,1320 ----
      struct sockaddr_un	client;
  #else
      int			written;
+     ICC_MSGLENTYPE	bufflen;
  #endif	/* defined(DO_HAVE_UNIX_DOMAIN) */
      int			i;
      char		buff[BUFSIZ + 2];
***************
*** 1329,1335 ****
--- 1330,1350 ----
      }
  
      /* Get the message. */
+ #if !defined(DO_HAVE_UNIX_DOMAIN)
+     i = RECVorREAD(CCchan->fd, (char *) &bufflen, sizeof(bufflen));
+     if (i != sizeof(bufflen) 
+ 	|| bufflen < 1 || bufflen >= (sizeof buff - 1)) {
+ 	syslog(L_ERROR, "%s cant recv CCreader length %m", LogName);
+ 	return;
+     }
+     i = RECVorREAD(CCchan->fd, buff, bufflen);
+     if (i > 0 && i != bufflen) {
+ 	syslog(L_ERROR, "%s cant recv CCreader data %m", LogName);
+ 	return;
+     }
+ #else
      i = RECVorREAD(CCchan->fd, buff, sizeof buff - 1);
+ #endif
      if (i < 0) {
  	syslog(L_ERROR, "%s cant recv CCreader %m", LogName);
  	return;




