bugftp.proxy - FTP Proxy Server - Bugs: bug #1832, Recognise multi-line 220 and 331...

 
 

bug #1832: Recognise multi-line 220 and 331 responses

Submitted by:  Andreas Schoenberg <asg>
Submitted on:  Fri 29 Nov 2002 04:13:24 PM UTC  
 
Severity: 2 - MinorPriority: 3 - Low
Item Group: Incompatibility ReportStatus: Fixed
Privacy: PublicAssigned to: Andreas Schoenberg <asg>
Originator Name: Mike FleetwoodOpen/Closed: Closed
Release: 1.1.6.betaOperating System: All
Fixed Release: Planned Release: 

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 10 Feb 2003 04:17:36 PM UTC, comment #1:

Problem is fixed through a complete rewrite of the multiline server response handling in ftpproxy-1.1.6.beta7.

Andreas Schoenberg <asg>
Project AdministratorIn charge of this item.
Fri 29 Nov 2002 04:13:24 PM UTC, original submission:

I found that ftp.proxy 1.1.5 and 1.1.6.beta4 do not correctly handle multi-line responses from an FTP server in some circumstances.

The example output in the explanations below are from my dummy FTP server shell script I threw together. It is really crude but run from Inetd/XInetd it works well enough to reveal the 2 problems I have found so far with ftp.proxy. My dummy FTP server shell script reflects how MultiNet FTP Server V4.1(16) on a VMS box behaves which ftp.proxy wouldn't work with.

Muilt-line 200 greeting
-----------------------

First ftp.proxy does not handle some multi-line 200 greetings correctly.
If there is a space in the 4th character it assumes that that line is the last in the multi-line 200 greeting whether or not it is preceded by 3 digit status code marking the end of the multi-line response or not.
For example the following greeting causes ftp.proxy to exit:
220-Welcome to Dummy.COM.
Activity will be monitored.
220 Dummy FTP server ready.
The following syslog messages were recorded:
rockover ftp.proxy[15714]: connected to client: localhost
rockover ftp.proxy[15714]: info: monitor mode: off, ccp: <unset>
rockover ftp.proxy[15714]: connected to server: 127.0.0.1
rockover ftp.proxy[15714]: -ERR: unexpected server greeting:
Activity will be monitored.
And with debugging enabled (-d -d) stderr reported the following:
>>> CLI: 220 server ready - login please
select max= 0
>>> CLI: 530 login first
select max= 0
>>> CLI: 530 login first
select max= 0
>>> CLI: 331 password required
select max= 0
select max= 6
SVR >>>: 220-Welcome to Dummy.COM.
SVR >>>: Activity will be monitored.
>>> CLI: 500 service unavailable
The fault is in ftp.c:dologin() where it is skipping lines looking for the 200 Server ready greeting. My fix is to skip lines until a line starting with 3 digits and a space rather than just a space in the 4th column.

Multi-line 331 password request
-------------------------------

Secondly ftp.proxy totally confuses the ftp client if the server sends a multi-line 331 password required response. After the proxy asks the the client for the password it sends part of the 331 multi-line password required response to the client along with a 230 login successful. The ftp client is confuses, just sits there and eventually times out. In the ftp client you see the following:
[mike@rockover mike]# ftp localhost 1200
Connected to localhost.
220 server ready - login please
530 login first
530 login first
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): username
331 password required
Password:
331-Connected at Sun Aug 11 11:30:16 BST 2002
230 login accepted
421 Service not available, remote server has closed connection
Login failed.
No control connection for command: No such file or directory
ftp> quit
The system log shows:
rockover ftp.proxy-1.1.5+1fix.exe[15841]: connected to client:
localhost
rockover ftp.proxy-1.1.5+1fix.exe[15841]: info: monitor mode: off,
ccp: <unset>
rockover ftp.proxy-1.1.5+1fix.exe[15841]: connected to server:
127.0.0.1
rockover ftp.proxy-1.1.5+1fix.exe[15841]: login accepted:
username@127.0.0.1
rockover ftp.proxy-1.1.5+1fix.exe[15841]: connection timedout:
client= localhost, server= 127.0.0.1:21
rockover ftp.proxy-1.1.5+1fix.exe[15841]: +OK: proxy terminating
And the stderr recorded:
>>> CLI: 220 server ready - login please
select max= 0
>>> CLI: 530 login first
select max= 0
>>> CLI: 530 login first
select max= 0
>>> CLI: 331 password required
select max= 0
select max= 6
SVR >>>: 220-Welcome to Dummy.COM.
SVR >>>: Activity will be monitored.
SVR >>>: 220 Dummy FTP server ready.
>>> SVR: USER username
select max= 6
SVR >>>: 331-Connected at Sun Aug 11 11:30:16 BST 2002
>>> CLI: 331-Connected at Sun Aug 11 11:30:16 BST 2002
select max= 6
SVR >>>: 331 User "username" OK. Password, please.
>>> SVR: PASS password
select max= 6
SVR >>>: 230 Login successful. Have fun.
>>> CLI: 230 login accepted
select max= 0
My fix is to change ftp.c:sfputc() so that multi-line 331 password
required response are not sent to the client. All single line responses
are already not sent to the client by sfputc(). I don't particularly
like this fix but it is the best I can do without full understanding
which functions implement which bits of the FTP protocol.

For patch see 741

Andreas Schoenberg <asg>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 4 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Mon 10 Feb 2003 04:26:18 PM UTCasgOpen/ClosedOpen=>(Error - Not Found)
Mon 10 Feb 2003 04:17:36 PM UTCasgStatusNone=>(Error - Not Found)
  Assigned toNone=>NA
  Fixed ReleaseNone=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1