Article View: news.software.nntp
Article #5873Re: UNOFF4 breaks CTLINND
From: Mike Bird
Date: Thu, 21 Mar 1996 00:00
Date: Thu, 21 Mar 1996 00:00
118 lines
4184 bytes
4184 bytes
Dave is right. I was wrong. The change did not occur in unoff4.
I'm guessing the fix came from some unacknowledged genius at
Slackware. Here it is for those that may have lost it.
Dave, since it fixes Linux installations and is otherwise harmless,
please consider it for inclusion in unoff5.
IMHO the unpatched version relies on behavior which is not part of
any Unix standard (I look forward to being corrected again).
--Mike
===========================
Patch to prevent ctlinnd/expire etc messages being joined together
(and lost):
--- ../inn1.4unoff4/lib/inndcomm.c Thu Mar 18 13:04:36 1993
+++ lib/inndcomm.c Thu Mar 14 15:01:03 1996
@@ -169,7 +169,18 @@
/*
** 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,7 +214,7 @@
bufsiz += 1 + strlen(p);
if (bufsiz < MIN_BUFFER_SIZE)
bufsiz = MIN_BUFFER_SIZE;
- buff = malloc((unsigned int)bufsiz);
+ buff = malloc((unsigned int)bufsiz + BUFF_OFFSET);
if (buff == NULL) {
ICCfailure = "malloc";
return -1;
@@ -211,6 +222,8 @@
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,6 +234,10 @@
/* 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,6 +251,8 @@
ICCfailure = "open";
return -1;
}
+ *(ICC_MSGLENTYPE *) buff = len;
+ len += BUFF_OFFSET;
if (write(fd, buff, len) != len) {
i = errno;
DISPOSE(buff);
--- ../inn1.4unoff4/innd/cc.c Thu Mar 18 13:04:22 1993
+++ innd/cc.c Thu Mar 14 15:00:21 1996
@@ -1314,6 +1314,7 @@
struct sockaddr_un client;
#else
int written;
+ ICC_MSGLENTYPE bufflen;
#endif /* defined(DO_HAVE_UNIX_DOMAIN) */
int i;
char buff[BUFSIZ + 2];
@@ -1329,7 +1330,21 @@
}
/* 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;
----------------------------------------------------------
Mike Bird Tel: 209-742-5000 FAX: 209-966-3177
President POP: 209-742-5333 NOC: 209-742-9979
Iron Mtn Systems http://www.ims.mariposa.ca.us/
Technical Details
Message-ID:
<4iqai4$jm0@news.ims.mariposa.ca.us>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:
<4iaara$ct8@news.ims.mariposa.ca.us> <4ibd21$ha0@news.ims.mariposa.ca.us> <4iicj0$pbm@augusta.math.psu.edu>Show Full Headers
Complete Article Headers
Message-ID: <4iqai4$jm0@news.ims.mariposa.ca.us> Subject: Re: UNOFF4 breaks CTLINND Date: Thu, 21 Mar 1996 00:00:00 +0000 From: mgb@ims.mariposa.ca.us (Mike Bird) References: <4iaara$ct8@news.ims.mariposa.ca.us> <4ibd21$ha0@news.ims.mariposa.ca.us> <4iicj0$pbm@augusta.math.psu.edu> 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: 143403723 Organization: Iron Mtn Systems Newsgroups: news.software.nntp