INN commit: trunk (12 files)

INN Commit Russ_Allbery at isc.org
Sat May 16 12:43:53 UTC 2009


    Date: Saturday, May 16, 2009 @ 05:43:53
  Author: iulius
Revision: 8469

Use NNTP_MAXLEN_COMMAND instead of NNTP_STRLEN.

Modified:
  trunk/authprogs/radius.c
  trunk/backends/innxbatch.c
  trunk/backends/innxmit.c
  trunk/backends/nntpget.c
  trunk/include/inn/options.h
  trunk/include/nntp.h
  trunk/innd/art.c
  trunk/innd/nc.c
  trunk/innfeed/innlistener.c
  trunk/lib/clientlib.c
  trunk/lib/localopen.c
  trunk/lib/remopen.c

-----------------------+
 authprogs/radius.c    |    2 +-
 backends/innxbatch.c  |    4 ++--
 backends/innxmit.c    |   18 +++++++++---------
 backends/nntpget.c    |    8 ++++----
 include/inn/options.h |    2 +-
 include/nntp.h        |    2 --
 innd/art.c            |    2 +-
 innd/nc.c             |    6 +++---
 innfeed/innlistener.c |    4 ++--
 lib/clientlib.c       |    6 +++---
 lib/localopen.c       |    2 +-
 lib/remopen.c         |    2 +-
 12 files changed, 28 insertions(+), 30 deletions(-)

Modified: authprogs/radius.c
===================================================================
--- authprogs/radius.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ authprogs/radius.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -36,7 +36,7 @@
     unsigned char	id;
     unsigned short	length;
     unsigned char	vector[AUTH_VECTOR_LEN];
-    unsigned char	data[NNTP_STRLEN*2];
+    unsigned char	data[NNTP_MAXLEN_COMMAND*2];
     int			datalen;
 } auth_req;
 

Modified: backends/innxbatch.c
===================================================================
--- backends/innxbatch.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ backends/innxbatch.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -80,7 +80,7 @@
   int		i;
   int		err;
   char		*dest;
-  static char		buff[NNTP_STRLEN];
+  static char		buff[NNTP_MAXLEN_COMMAND];
 
   for (dest = buff, i = 0; p[i]; ) *dest++ = p[i++];
   *dest++ = '\r';
@@ -317,7 +317,7 @@
   char                  *p;
   FILE			*From;
   FILE			*To;
-  char			buff[NNTP_STRLEN];
+  char			buff[NNTP_MAXLEN_COMMAND];
   void	        	(*volatile old)(int) = NULL;
   struct stat		statbuf;
   int			fd;

Modified: backends/innxmit.c
===================================================================
--- backends/innxmit.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ backends/innxmit.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -220,14 +220,14 @@
     }
     /* allocate buffers on first use.
     ** If filename ever is longer than SPOOLNAMEBUFF then code will abort.
-    ** If ID is ever longer than NNTP_STRLEN then other code would break.
+    ** If ID is ever longer than NNTP_MAXLEN_COMMAND then other code would break.
     */
     if (!stbuf[i].st_fname)
         stbuf[i].st_fname = xmalloc(SPOOLNAMEBUFF);
     if (!stbuf[i].st_id)
-        stbuf[i].st_id = xmalloc(NNTP_STRLEN);
+        stbuf[i].st_id = xmalloc(NNTP_MAXLEN_COMMAND);
     strlcpy(stbuf[i].st_fname, Article, SPOOLNAMEBUFF);
-    strlcpy(stbuf[i].st_id, MessageID, NNTP_STRLEN);
+    strlcpy(stbuf[i].st_id, MessageID, NNTP_MAXLEN_COMMAND);
     stbuf[i].art = art;
     stbuf[i].st_hash = hash;
     stbuf[i].st_retry = 0;
@@ -576,7 +576,7 @@
 */
 static bool
 REMsendarticle(char *Article, char *MessageID, ARTHANDLE *art) {
-    char	buff[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
 
     if (!REMflush())
 	return false;
@@ -719,7 +719,7 @@
 */
 static bool
 check(int i) {
-    char	buff[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
 
     /* send "check <ID>" to the other system */
     snprintf(buff, sizeof(buff), "check %s", stbuf[i].st_id);
@@ -746,7 +746,7 @@
 */
 static bool
 takethis(int i) {
-    char	buff[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
 
     if (!stbuf[i].art) {
         warn("internal error: null article for %s in takethis",
@@ -784,7 +784,7 @@
     int		resp;
     int		i;
     char	*id, *p;
-    char	buff[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
     int		hash;
 
     while(true) {
@@ -1285,10 +1285,10 @@
 	    continue;
 	}
 
-        /* Drop articles with a message ID longer than NNTP_MSGID_MAXLEN to
+        /* Drop articles with a message ID longer than NNTP_MAXLEN_MSGID to
            avoid overrunning buffers and throwing the server on the
            receiving end a blow from behind. */
-        if (MessageID != NULL && strlen(MessageID) > NNTP_MSGID_MAXLEN) {
+        if (MessageID != NULL && strlen(MessageID) > NNTP_MAXLEN_MSGID) {
             warn("dropping article in %s: long message ID %s", BATCHname,
                  MessageID);
             continue;

Modified: backends/nntpget.c
===================================================================
--- backends/nntpget.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ backends/nntpget.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -65,7 +65,7 @@
     int			i;
     char		c;
 
-    for (p = start, end = &start[NNTP_STRLEN - 1]; ; ) {
+    for (p = start, end = &start[NNTP_MAXLEN_COMMAND - 1]; ; ) {
 	if (sp->Count == 0) {
 	    /* Fill the buffer. */
     Again:
@@ -159,7 +159,7 @@
 static void
 SITEquit(SITE *sp)
 {
-    char	buff[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
 
     SITEwrite(sp, "quit", 4);
     SITEread(sp, buff);
@@ -186,8 +186,8 @@
 int
 main(int ac, char *av[])
 {
-    char	buff[NNTP_STRLEN];
-    char	mesgid[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
+    char	mesgid[NNTP_MAXLEN_COMMAND];
     char	tbuff[SMBUF];
     char	*msgidfile = NULL;
     int         msgidfd;

Modified: include/inn/options.h
===================================================================
--- include/inn/options.h	2009-05-16 12:28:24 UTC (rev 8468)
+++ include/inn/options.h	2009-05-16 12:43:53 UTC (rev 8469)
@@ -101,7 +101,7 @@
 /* Input buffers start at START_BUFF_SIZE.  While reading input, if we have
    less than LOW_WATER bytes left free in the buffer, use the current
    buffersize as input to GROW_AMOUNT to determine how much to realloc.
-   Growth must be at least NNTP_STRLEN bytes!  The default settings provide
+   Growth must be at least NNTP_MAXLEN_COMMAND bytes!  The default settings provide
    aggressive, exponential buffer growth. */
 #define START_BUFF_SIZE         (4 * 1024)
 #define LOW_WATER               (1 * 1024)

Modified: include/nntp.h
===================================================================
--- include/nntp.h	2009-05-16 12:28:24 UTC (rev 8468)
+++ include/nntp.h	2009-05-16 12:43:53 UTC (rev 8469)
@@ -91,5 +91,3 @@
 #define NNTP_RESENDIT_XBATCHERR	"436 xbatch failed: "
 /* and one more meaning for the 501 code NNTP_SYNTAX_USE */
 #define NNTP_XBATCH_BADSIZE	"501 Invalid or missing size for xbatch"
-
-#define NNTP_STRLEN			512

Modified: innd/art.c
===================================================================
--- innd/art.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ innd/art.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -717,7 +717,7 @@
   const char	*p;
 
   /* Check the length of the message ID. */
-  if (MessageID == NULL || strlen(MessageID) > NNTP_MSGID_MAXLEN)
+  if (MessageID == NULL || strlen(MessageID) > NNTP_MAXLEN_MSGID)
     return false;
 
   /* Scan local-part:  "< atom|quoted [ . atom|quoted]" */

Modified: innd/nc.c
===================================================================
--- innd/nc.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ innd/nc.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -865,7 +865,7 @@
       for (i = cp->Next; (i < bp->used) && (bp->data[i] != '\n'); i++) ;
       if (i == bp->used) {
 	/* Check for too long command. */
-	if ((j = bp->used - cp->Start) > NNTP_STRLEN) {
+	if ((j = bp->used - cp->Start) > NNTP_MAXLEN_COMMAND) {
 	  /* Make some room, saving only the last few bytes. */
 	  for (p = bp->data, i = 0; i < SAVE_AMT; i++)
 	    p[i] = p[bp->used - SAVE_AMT + i];
@@ -1070,10 +1070,10 @@
 	}
 	i += cp->LargeCmdSize;
 	syslog(L_NOTICE, "%s internal rejecting too long command line (%lu > %d)",
-	  CHANname(cp), (unsigned long) i, NNTP_STRLEN);
+	  CHANname(cp), (unsigned long) i, NNTP_MAXLEN_COMMAND);
 	cp->LargeCmdSize = 0;
 	snprintf(buff, sizeof(buff), "%d command exceeds limit of %d bytes",
-                 NNTP_ERR_COMMAND, NNTP_STRLEN);
+                 NNTP_ERR_COMMAND, NNTP_MAXLEN_COMMAND);
 	cp->State = CSgetcmd;
 	cp->Start = cp->Next;
 	NCwritereply(cp, buff);

Modified: innfeed/innlistener.c
===================================================================
--- innfeed/innlistener.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ innfeed/innlistener.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -499,9 +499,9 @@
           *fileNameEnd = ' ' ;
 
           /* Check the message ID length */
-          if (strlen(msgid) > NNTP_MSGID_MAXLEN) {
+          if (strlen(msgid) > NNTP_MAXLEN_MSGID) {
             warn ("ME message id exceeds limit of %d octets: %s",
-                  NNTP_MSGID_MAXLEN, msgid) ;
+                  NNTP_MAXLEN_MSGID, msgid) ;
             *(msgidEnd+1) = '\0' ;
           }
           *msgidEnd = ' ' ;

Modified: lib/clientlib.c
===================================================================
--- lib/clientlib.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ lib/clientlib.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -12,7 +12,7 @@
 
 FILE	*ser_rd_fp = NULL;
 FILE	*ser_wr_fp = NULL;
-char	ser_line[NNTP_STRLEN + 2];
+char	ser_line[NNTP_MAXLEN_COMMAND + 2];
 
 
 /*
@@ -36,7 +36,7 @@
 int
 server_init(char *host, int port)
 {
-    char	line2[NNTP_STRLEN];
+    char	line2[NNTP_MAXLEN_COMMAND];
 
     /* This interface may be used by clients that assume C News behavior and
        won't read inn.conf themselves. */
@@ -144,7 +144,7 @@
 void
 close_server(void)
 {
-    char	buff[NNTP_STRLEN];
+    char	buff[NNTP_MAXLEN_COMMAND];
 
     if (ser_wr_fp != NULL && ser_rd_fp != NULL) {
 	put_server("QUIT");

Modified: lib/localopen.c
===================================================================
--- lib/localopen.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ lib/localopen.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -30,7 +30,7 @@
     int			oerrno;
     struct sockaddr_un	server;
     FILE		*F;
-    char		mybuff[NNTP_STRLEN + 2];
+    char		mybuff[NNTP_MAXLEN_COMMAND + 2];
     char		*buff;
 
     if (errbuff)

Modified: lib/remopen.c
===================================================================
--- lib/remopen.c	2009-05-16 12:28:24 UTC (rev 8468)
+++ lib/remopen.c	2009-05-16 12:43:53 UTC (rev 8469)
@@ -22,7 +22,7 @@
 NNTPconnect(const char *host, int port, FILE **FromServerp, FILE **ToServerp,
             char *errbuff, size_t len)
 {
-    char mybuff[NNTP_STRLEN + 2];
+    char mybuff[NNTP_MAXLEN_COMMAND + 2];
     char *buff;
     int fd, code, oerrno;
     FILE *F = NULL;




More information about the inn-committers mailing list