INN commit: trunk (doc/pod/news.pod innd/nc.c)

INN Commit rra at isc.org
Sun Mar 4 15:07:36 UTC 2012


    Date: Sunday, March 4, 2012 @ 07:07:36
  Author: iulius
Revision: 9398

fixed a trailing extra junk byte in innd answers

When an error occurs when innd writes on a channel, a trailing extra junk
byte is added to the reply.

If the write() function fails, "i" is negative and we substract "i" to
cp->Out->left anyway.
So if for instance i=-1, we end up in having cp->Out->left increased
by one.  Which would add an extra character after a complete response.
(So it appears in fact before a new response.)

Issue introduced in changeset [7418].

Thanks to River Tarnell for the bug report.

Modified:
  trunk/doc/pod/news.pod
  trunk/innd/nc.c

------------------+
 doc/pod/news.pod |    8 ++++++++
 innd/nc.c        |   10 +++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2012-01-14 13:20:10 UTC (rev 9397)
+++ doc/pod/news.pod	2012-03-04 15:07:36 UTC (rev 9398)
@@ -175,6 +175,14 @@
 
 =item *
 
+Fixed an invalid C<431> response to CHECK commands when B<innd> is paused:
+the message-ID of the article to defer was missing.  Also fixed another
+issue in the messages B<innd> replied; when an error occurred during a
+write on a channel, a trailing extra junk byte was added to the reply.
+Thanks to River Tarnell for these bug reports.
+
+=item *
+
 It is now possible to properly generate daily statistics with B<sendinpaths>
 thanks to the new B<-k> and B<-r> flags that permit to control the interval
 of days for processing dump files.  The new B<-c> flag permits to send a

Modified: innd/nc.c
===================================================================
--- innd/nc.c	2012-01-14 13:20:10 UTC (rev 9397)
+++ innd/nc.c	2012-03-04 15:07:36 UTC (rev 9398)
@@ -160,7 +160,7 @@
     WCHANappend(cp, text, strlen(text));	/* Text in buffer. */
     WCHANappend(cp, NCterm, strlen(NCterm));	/* Add CR LF to text. */
 
-    if (i == 0) {	/* If only data, then try to write directly. */
+    if (i == 0) {	/* If only new data, then try to write directly. */
 	i = write(cp->fd, &bp->data[bp->used], bp->left);
 	if (Tracing || cp->Tracing)
 	    syslog(L_TRACE, "%s NCwritereply %d=write(%d, \"%.15s\", %lu)",
@@ -173,10 +173,14 @@
 	    bp->used = bp->left = 0;
 	    NCwritedone(cp);
 	} else {
-            bp->left -= i;
+            if (i > 0) {
+                bp->left -= i;
+            }
             i = 0;
         }
-    } else i = 0;
+    } else {
+        i = 0;
+    }
     if (i <= 0) {	/* Write failed, queue it for later. */
 	WCHANadd(cp);
     }



More information about the inn-committers mailing list