From daver@solidcore.com  Sat Jan 24 23:30:32 2004
Return-Path: <daver@solidcore.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AF58A16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 24 Jan 2004 23:30:32 -0800 (PST)
Received: from solidcore.com (solidcore2.fibernoc.net [66.201.45.194])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 026C243D58
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 24 Jan 2004 23:30:23 -0800 (PST)
	(envelope-from daver@solidcore.com)
Received: from keen.paloalto.solidcore.com (localhost [127.0.0.1])
	by solidcore.com (8.12.9p2/8.12.9) with ESMTP id i0P7UO1P075008
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 24 Jan 2004 23:30:24 -0800 (PST)
	(envelope-from daver@keen.paloalto.solidcore.com)
Received: (from daver@localhost)
	by keen.paloalto.solidcore.com (8.12.9p2/8.12.9/Submit) id i0P7UOti075007;
	Sat, 24 Jan 2004 23:30:24 -0800 (PST)
	(envelope-from daver)
Message-Id: <200401250730.i0P7UOti075007@keen.paloalto.solidcore.com>
Date: Sat, 24 Jan 2004 23:30:24 -0800 (PST)
From: "David P. Reese Jr." <daver@solidcore.com>
Reply-To: "David P. Reese Jr." <daver@gomerbud.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] mail/akpop3d fails to authenticate when using an authfile
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         61872
>Category:       ports
>Synopsis:       [PATCH] mail/akpop3d fails to authenticate when using an authfile
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 24 23:40:07 PST 2004
>Closed-Date:    Sun Jan 25 04:54:54 PST 2004
>Last-Modified:  Sun Jan 25 04:54:54 PST 2004
>Originator:     David P. Reese Jr.
>Release:        FreeBSD 4.9-RELEASE i386
>Organization:
Solidcore Systems
>Environment:
System: FreeBSD keen.paloalto.solidcore.com 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Sat Jan 24 08:44:54 PST 2004 daver@keen.paloalto.solidcore.com:/usr/src/sys/compile/KEEN i386


	
>Description:
	akpop3d fails to authenticate when using an external authfile.
>How-To-Repeat:
	Install mail/akpop3d.

	Create the authfile /tmp/authfile with the following contents:
	--- begin authfile ---
	daver:foobar:daver:/var/mail/daver
	--- end authfile ---

	Start akpop3d:
	# akpop3d -a /tmp/authfile

	Telnet to the pop3 server and try to authenticate:
	$ telnet localhost pop3
	Trying ::1...
	Trying 127.0.0.1...
	Connected to localhost.
	Escape character is '^]'.
	+OK
	USER daver
	+OK
	PASS foobar
	-ERR authentication failed
	Connection closed by foreign host.

>Fix:

	There is a bug in the loop that reads in the authfile line by line.

--- authenticate.c.orig 2004-01-24 22:19:02.000000000 -0800
+++ authenticate.c      2004-01-24 22:19:11.000000000 -0800
@@ -195,7 +195,7 @@
       syslog(LOG_ERR,"%s: %s: %s","failed to read auth file",authfile,strerror(errno));
       return 0;
     }
-    while ((0!=ferror(fptr)) && (0!=feof(fptr))) {
+    while ((!ferror(fptr)) && (!feof(fptr))) {
       linebuf[0] = '\0';
       if (fgets(linebuf, sizeof(linebuf), fptr) == NULL) {
         fclose(fptr);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: krion 
State-Changed-When: Sun Jan 25 04:54:49 PST 2004 
State-Changed-Why:  
Committed, thanks! 

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