'Undifined commands' on FTP Server, when using FTP 'put' and 'quit' in Client

A

Asaf Sinai

Hi,

I use WFTPD as an FTP Server on WIN XP.
I wrote the following perl program:

#!/usr/bin/perl -w
use strict;
use Net::FTP;

my $ftp_site = "1.100.100.10";
my $username = "test";
my $password = "test";
my $local_dir = "T:\\temp";
my $local_file = "ftp_test_file";
my $remote_dir = "C:\\temp";
my $remote_file = "remote_ftp_test_file";

# Change to local directory
chdir $local_dir
or die "\nFailed to cd to '$local_dir': $! $@\n";

# Start FTP: connect, login and go to target directory
print "\nConnecting to target at '$ftp_site'...\n";
my $ftp = Net::FTP->new($ftp_site, Debug => 0)
or die "\nFailed to connect to '$ftp_site': $! $@";

print "\nLogin to target...\n";
$ftp->login($username, $password)
or die "\nFailed to login with username-$username and
password-$password:\n FTP: ",
$ftp->message, " $! $@";

$ftp->cwd($remote_dir)
or die "\nFailed to cd to '$remote_dir' on target:\n FTP: ",
$ftp->message, " $! $@";

# Transfer file
print "\nUploading file...\n";
$ftp->put($local_file, $remote_file)
or die "\nFailed to put '$local_file' to '$remote_file' on target:\n
FTP: ",
$ftp->message, " $! $@";

# Close connection
print "\nClosing connection...\n";
$ftp->quit;


On the FTP Server I got the following:
[L 4423] 07/04/06 12:13:00 Connection accepted from 1.100.100.10
[C 4423] 07/04/06 12:13:00 Command "user test" received
[C 4423] 07/04/06 12:13:00 PASSword accepted
[L 4423] 07/04/06 12:13:00 User test logged in.
[C 4423] 07/04/06 12:13:00 Command "CWD C:\temp" received
[C 4423] 07/04/06 12:13:00 CWD C:\temp successful
[! 4423] 07/04/06 12:13:00 Unidentified command ALLO 7150209
[C 4423] 07/04/06 12:13:00 Command "PASV" received
[C 4423] 07/04/06 12:13:00 Entering Passive Mode (1,100,100,10,12,92)
[C 4423] 07/04/06 12:13:00 Command "STOR remote_ftp_test_file" received
[P 4423] 07/04/06 12:13:00 STORe started on file remote_ftp_test_file
[C 4423] 07/04/06 12:13:01 Transfer finished
[P 4423] 07/04/06 12:13:01 Put file C:\temp\remote_ftp_test_file
successfully
[! -001] 07/04/06 12:13:01 Received data signal FD_READ on socket 508
which I can't find
[C 4423] 07/04/06 12:13:01 Command "QUIT" received
[C 4423] 07/04/06 12:13:01 QUIT or close - user test logged out
[! -001] 07/04/06 12:13:01 Received a command on socket 408 which I
can't find

As you can see, when the 'put' command was performed, the FTP Server
did not recognize command ALLO (is it allocate space?).
Also after transfer finished successfully, an data signal was received
???
Also after 'quit' command, unknown command was received ???


When I performed the FTP session from the command line:
ftp 1.100.100.10
Connected to 1.100.100.10.
220-
220 WFTPD 2.0 service (by Texas Imperial Software) ready for new user
User (1.100.100.10:(none)): test
331 Give me your password, please
Password:
230 Logged in successfully
ftp> cd c:\temp
250 "C:\temp" is current directory
ftp> put ftp_test_file remote_ftp_test_file
200 PORT command okay
150 "C:\temp\remote_ftp_test_file" file ready to receive in ASCII mode
226 Transfer finished successfully.
ftp: 7150209 bytes sent in 0.33Seconds 21733.16Kbytes/sec.
ftp> quit
221-
221 Windows FTP Server (WFTPD, by Texas Imperial Software) says goodbye

Everything was OK, as follows:
[L 4425] 07/04/06 12:19:15 Connection accepted from 1.100.100.10
[C 4425] 07/04/06 12:19:18 Command "USER test" received
[C 4425] 07/04/06 12:19:19 PASSword accepted
[L 4425] 07/04/06 12:19:19 User test logged in.
[C 4425] 07/04/06 12:19:27 Command "CWD c:\temp" received
[C 4425] 07/04/06 12:19:27 CWD C:\temp successful
[C 4425] 07/04/06 12:19:32 Command "PORT 1,100,100,10,12,104" received
[C 4425] 07/04/06 12:19:32 PORT set to 1.100.100.10 - 3176 (12,104)
[C 4425] 07/04/06 12:19:32 Command "STOR remote_ftp_test_file" received
[P 4425] 07/04/06 12:19:32 STORe started on file remote_ftp_test_file
[C 4425] 07/04/06 12:19:33 Transfer finished
[P 4425] 07/04/06 12:19:33 Put file C:\temp\remote_ftp_test_file
successfully
[C 4425] 07/04/06 12:19:35 Command "QUIT" received
[C 4425] 07/04/06 12:19:35 QUIT or close - user test logged out


As you can see, instead of command 'PASV' there is command 'PORT', and
no undifined commands/signals.

Does anyone know why this happens, and what's wrong in the perl program
?

Regards,
Asaf
 
C

Chris Davies

Asaf Sinai said:
I use WFTPD as an FTP Server on WIN XP.
I wrote the following perl program:
[...deleted...]

As you can see, when the 'put' command was performed, the FTP Server
did not recognize command ALLO (is it allocate space?).

Read RFC 959 for details of the ALLOCATE command. The server is supposed
to ignore this command if it's not required, which it correctly appears
to do.
Also after transfer finished successfully, a data signal was received
???

I have no idea. Maybe Texas Imperial Software can tell you what triggers
that error message in its software.

Also after 'quit' command, unknown command was received ???

There isn't anything sent after the QUIT command, so all I can surmise
is that maybe the ftp server isn't processing CR/LF pairs correctly.
Perhaps Texas Imperial Software can give you a better idea.

When I performed the FTP session from the command line:
ftp 1.100.100.10

This is a different client, using a different subset of ftp commands, so
it's not necessarily a fair comparison.

If you have access to a network sniffer such as "ethereal" you can dump
the TCP stream and inspect it visually for further clues.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top