From njyoder@topcat.mine.nu  Wed Jul 31 01:42:20 2002
Return-Path: <njyoder@topcat.mine.nu>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id DE9BF37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 31 Jul 2002 01:42:20 -0700 (PDT)
Received: from topcat.mine.nu (pool-141-156-128-24.res.east.verizon.net [141.156.128.24])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DBC1143E3B
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 31 Jul 2002 01:42:19 -0700 (PDT)
	(envelope-from njyoder@topcat.mine.nu)
Received: (from root@localhost)
	by topcat.mine.nu (8.11.6/8.11.1) id g6V8nuP06946;
	Wed, 31 Jul 2002 04:49:56 -0400 (EDT)
	(envelope-from njyoder)
Message-Id: <200207310849.g6V8nuP06946@topcat.mine.nu>
Date: Wed, 31 Jul 2002 04:49:56 -0400 (EDT)
From: "Nathan J. Yoder" <njyoder@gummibears.nu>
Reply-To: "Nathan J. Yoder" <njyoder@gummibears.nu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: newsfetch fails to fetch any news on certain news servers
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         41197
>Category:       ports
>Synopsis:       newsfetch fails to fetch any news on certain news servers
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    knu
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 31 01:50:01 PDT 2002
>Closed-Date:    Sat Aug 03 19:34:24 JST 2002
>Last-Modified:  Sat Aug 03 19:34:24 JST 2002
>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:
Responsible-Changed-From-To: freebsd-ports->knu 
Responsible-Changed-By: ijliao 
Responsible-Changed-When: Wed Jul 31 02:49:13 PDT 2002 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41197 
State-Changed-From-To: open->closed 
State-Changed-By: knu 
State-Changed-When: Sat Aug 3 19:33:50 JST 2002 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=41197 
>Unformatted:
