Subject: | proftpd-1.2.6rc1 and STOU command |
v5.6.1 built for sparc-solaris-64int
SunOS lm6042 5.6 Generic_105181-28 sun4u sparc
can't get unique name using STOU command when connecting to a proftpd-1.2.6rc1 ftp server. This is the first release of proftpd supporting the STOU command. In their code they refer to RFC 1123:
/* Format of 150 responses for STOU is explicitly dictated by
* RFC 1123:
*
* 4.1.2.9 STOU Command: RFC-959 Section 4.1.3
*
* The STOU command stores into a uniquely named file. When it
* receives an STOU command, a Server-FTP MUST return the
* actual file name in the "125 Transfer Starting" or the "150
* Opening Data Connection" message that precedes the transfer
* (the 250 reply code mentioned in RFC-959 is incorrect). The
* exact format of these messages is hereby defined to be as
* follows:
*
* 125 FILE: pppp
* 150 FILE: pppp
*
* where pppp represents the unique pathname of the file that
* will be written.
*/
Included a patch allowing both styles to work.
--- libnet-1.12/Net/FTP.pm.org Thu Aug 15 08:48:30 2002
+++ libnet-1.12/Net/FTP.pm Thu Aug 15 08:56:40 2002
@@ -756,7 +756,8 @@
$sock->close() or
return undef;
- if ('STOU' eq uc $cmd and $ftp->message =~ m/unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/)
+ if ('STOU' eq uc $cmd and
+ $ftp->message =~ m/unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"|FILE:\s*(.*)/)
{
require File::Basename;
$remote = File::Basename::basename($+)
@@ -1126,10 +1127,12 @@
unless $ftp->ok() && $non_pasv->ok();
return $1
- if $ftp->message =~ /unique file name:\s*(\S*)\s*\)/;
+ if ( $ftp->message =~ /unique file name:\s*(\S*)\s*\)/ or
+ $ftp->message =~ /FILE: (.*)/ );
return $1
- if $non_pasv->message =~ /unique file name:\s*(\S*)\s*\)/;
+ if ( $non_pasv->message =~ /unique file name:\s*(\S*)\s*\)/ or
+ $non_pasv->message =~ /FILE: (.*)/ );
return 1;
}
--- libnet-1.12/Net/FTP/dataconn.pm.org Thu Aug 15 08:48:37 2002
+++ libnet-1.12/Net/FTP/dataconn.pm Thu Aug 15 08:49:01 2002
@@ -69,7 +69,8 @@
$data->_close;
$ftp->response() == CMD_OK &&
- $ftp->message =~ /unique file name:\s*(\S*)\s*\)/ &&
+ ($ftp->message =~ /unique file name:\s*(\S*)\s*\)/ ||
+ $ftp->message =~ /FILE:\s(.*)/) &&
(${*$ftp}{'net_ftp_unique'} = $1);
$ftp->status == CMD_OK;