From nobody@FreeBSD.org  Wed Jan  3 05:58:14 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 37EF337B400
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  3 Jan 2001 05:58:14 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f03DwE069552;
	Wed, 3 Jan 2001 05:58:14 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200101031358.f03DwE069552@freefall.freebsd.org>
Date: Wed, 3 Jan 2001 05:58:14 -0800 (PST)
From: alo@iki.fi
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: natd/libalias doesn't always properly modify FTP PORT command
X-Send-Pr-Version: www-1.0

>Number:         24048
>Category:       misc
>Synopsis:       natd/libalias doesn't always properly modify FTP PORT command
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 03 06:00:06 PST 2001
>Closed-Date:    Wed May 30 07:24:34 PDT 2001
>Last-Modified:  Wed May 30 07:28:02 PDT 2001
>Originator:     Antti Louko
>Release:        4.1-RELEASE
>Organization:
>Environment:
(modified)
FreeBSD xxx.aaa.com 4.1-RELEASE FreeBSD 4.1-RELEASE #1: Thu Nov 16 15:24:02 EET 2000     root@xxx.aaa.com:/usr/src/sys/compile/FOOBAR  i386
>Description:
natd (actually libalias/alias_db.c) only modifies FTP PORT commands
if they are immediately in the beginning of a new line.
This is implemented by having a flag which is set when a CR/LF
pair is detected.  This works well except when PORT command
happens to be first command in the FTP session.
This is the case eg. with certain banking related application.
>How-To-Repeat:
Use ftp client which send PORT command as its first command over
the command channel.

>Fix:
Initialize CRLF flag in the beginnig of the alias association.
Flag name should be modified to something like
"IN_THE_BEGINNING_OF_A_LINE".

*** /usr/src/lib/libalias/alias_db.c    Tue Jun 27 19:44:13 2000
--- /home/alo/src/libalias/alias_db.c   Tue Jan  2 11:28:29 2001
***************
*** 901,907 ****
          link->server            = NULL;
          link->link_type         = link_type;
          link->sockfd            = -1;
!         link->flags             = 0;
          link->timestamp         = timeStamp;
  
      /* Expiration time */
--- 901,907 ----
          link->server            = NULL;
          link->link_type         = link_type;
          link->sockfd            = -1;
!         link->flags             = LINK_LAST_LINE_CRLF_TERMED;
          link->timestamp         = timeStamp;
  
      /* Expiration time */


>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.org>
To: alo@iki.fi
Cc: bug-followup@FreeBSD.org
Subject: Re: misc/24048: natd/libalias doesn't always properly modify FTP PORT command
Date: Fri, 12 Jan 2001 10:22:40 +0200

 On Wed, Jan 03, 2001 at 05:58:14AM -0800, alo@iki.fi wrote:
 > 
 > natd (actually libalias/alias_db.c) only modifies FTP PORT commands
 > if they are immediately in the beginning of a new line.
 > This is implemented by having a flag which is set when a CR/LF
 > pair is detected.  This works well except when PORT command
 > happens to be first command in the FTP session.
 > 
 I don't see the major problem with this change, but is this allowed
 by FTP protocol specs?  (The first command being a PORT command.)
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age
 

From: alo@iki.fi (Antti Louko)
To: ru@FreeBSD.org
Cc: bug-followup@FreeBSD.org
Subject: Re: misc/24048: natd/libalias doesn't always properly modify FTP PORT command
Date: Wed, 17 Jan 2001 01:04:45 +0200 (EET)

    > natd (actually libalias/alias_db.c) only modifies FTP PORT commands
    > if they are immediately in the beginning of a new line.
    > This is implemented by having a flag which is set when a CR/LF
    > pair is detected.  This works well except when PORT command
    > happens to be first command in the FTP session.
    > 
    I don't see the major problem with this change, but is this allowed
    by FTP protocol specs?  (The first command being a PORT command.)
 
 I would guess so.
 
 In RFC959, page 45, there is an example of a client transferring data
 between two servers.  In that example, the first command to one of the
 servers is a PORT command. 
 
 Of course one could argue that the authentication has been left out of
 the example but I cannot see any place where the authentication would
 be required.
 
 Regards,
 
 	Antti Louko
 
Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Tue Feb 27 00:12:50 PST 2001 
Responsible-Changed-Why:  
I will take a look at it a bit later. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=24048 
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Wed May 30 07:24:34 PDT 2001 
State-Changed-Why:  
Fixed in 5.0-CURRENT, MFC into 4.3-STABLE planned within a week. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=24048 
>Unformatted:
