Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Jul 2002 04:49:56 -0400 (EDT)
From:      "Nathan J. Yoder" <njyoder@gummibears.nu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/41197: newsfetch fails to fetch any news on certain news servers
Message-ID:  <200207310849.g6V8nuP06946@topcat.mine.nu>

next in thread | raw e-mail | index | archive | help

>Number:         41197
>Category:       ports
>Synopsis:       newsfetch fails to fetch any news on certain news servers
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 31 01:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Nathan J. Yoder
>Release:        FreeBSD 4.5-RELEASE-p6 i386
>Organization:
>Environment:
System: FreeBSD topcat.mine.nu 4.5-RELEASE-p6 FreeBSD 4.5-RELEASE-p6 #4: Wed Jun 26 00:30:22 EDT 2002 njyoder@topcat.mine.nu:/usr/obj/usr/src/sys/TOPCAT i386
>Description:
	Newsfetch will choke when trying to get news from certain news
servers.  This is due to the fact that newsfetch will send new lines to
the server as just a LF (line feed).  The NNTP standard, however,
requires that new lines be sent as CR, LF (carriage return, line feed).
Certain news servers, such as Twister, do not consider an LF standing
alone to be a new line, so the server will pause waiting for the end of
the line to be sent.  This means that newsfetch will simply hang because
the server doesn't realize that a new line has been sent.

>How-To-Repeat:
	Run newsfetch on a server which doesn't like bare LFs.  Twister
is an example of this.  I tried it on news.verizon.net which runs
Twister v2.0.5.1.

>Fix:
I just changed the naked LFs to CR,LF pairs.  Apply the patch below.

--- nntp.c.patch begins here ---
--- work/newsfetch-1.21/nntp.c	Thu Jul 23 06:03:11 1998
+++ ./nntp.c	Wed Jul 31 04:31:32 2002
@@ -33,7 +33,7 @@
 {
 	/* dummy read to flush input */
 	readNNTPdata();
-	fprintf(socket_fp[0],"MODE READER\n");
+	fprintf(socket_fp[0],"MODE READER\r\n");
 	readNNTPdata();
 return(get_error(command_buf));
 }
@@ -151,7 +151,7 @@
 int first_art, last_art, total_art, tmp ;
 
 	fprintf(stderr,"%s: ",group);
-	fprintf(socket_fp[0],"GROUP %s\n",group);
+	fprintf(socket_fp[0],"GROUP %s\r\n",group);
 	readNNTPdata();
 	
 	#ifdef DEBUG
@@ -180,7 +180,7 @@
 		first_article = last_art - max_article + 1;
 	}
 	
-	fprintf(socket_fp[0],"STAT %d\n",first_article);
+	fprintf(socket_fp[0],"STAT %d\r\n",first_article);
 	readNNTPdata();
 
 	while(!get_error1(command_buf))
@@ -196,7 +196,7 @@
 			return(0); 
 			}
 
-		fprintf(socket_fp[0],"STAT %d\n",first_article);
+		fprintf(socket_fp[0],"STAT %d\r\n",first_article);
 		readNNTPdata();
 		}
 	fprintf(stderr,"articles %d to %d\n",first_article,last_art);
@@ -256,7 +256,7 @@
 		fprintf(stderr,"                                    %c",0xd);
 	}
 
-	fprintf(socket_fp[0],"ARTICLE\n");
+	fprintf(socket_fp[0],"ARTICLE\r\n");
 	readNNTPdata();
 	if(!get_error(command_buf))
 		return(0);	
@@ -275,7 +275,7 @@
 		}
 
 	/* Make it little fast */
-	fprintf(socket_fp[0],"NEXT\n");
+	fprintf(socket_fp[0],"NEXT\r\n");
 
 	article_fetching=1;
 
@@ -329,7 +329,7 @@
 char groupname[100];
 
 	fprintf(stderr, "\nList of NewsGroups:\n"); 
-	fprintf(socket_fp[0],"LIST\n");
+	fprintf(socket_fp[0],"LIST\r\n");
 	readNNTPdata();
 	if(!get_error2(command_buf))
 		exit(1);	
@@ -348,7 +348,7 @@
 sendQuit()
 {
 
-	fprintf(socket_fp[0],"QUIT\n");
+	fprintf(socket_fp[0],"QUIT\r\n");
 	readNNTPdata();
 }
 
--- nntp.c.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207310849.g6V8nuP06946>