Mailing List Archive

Incorrect PWD with bric_ftpd
Hi,

Ran into this today where some FTP clients (Filezilla being one), will
do a PWD after doing a CWD. This revealed a bug where bric_ftpd was
returning the path without the site name as the root directory. The
following patch (also attached in case of wrapping issues) fixes this:

--- lib/Bric/Util/FTP/DirHandle.pm.orig 2010-10-26 16:17:41.000000000 -0700
+++ lib/Bric/Util/FTP/DirHandle.pm 2010-10-26 16:21:11.000000000 -0700
@@ -163,8 +163,9 @@
# Find the root category.
my ($cid) = Bric::Biz::Category->list_ids({ site_id => $site_id,
uri => '/' });
+ my $site = Bric::Biz::Site->lookup({ id => $site_id });
return Bric::Util::FTP::DirHandle->new($self->{ftps},
- "/" . $filename . "/",
+ "/" . $site->get_name
. "/" . $filename . "/",
$site_id,
$id,
$cid,
@@ -384,6 +385,10 @@
my @ocs = Bric::Biz::OutputChannel->list({name => ($like || '%'),
site_id => $site_id,
active => 1});
+
+ my $site = Bric::Biz::Site->lookup({ id => $site_id });
+ my $site_name = $site->get_name;
+
foreach my $oc (@ocs) {
next unless $self->{ftps}{user_obj}->can_do($oc, READ);

@@ -392,7 +397,7 @@
uri => '/' });

my $dirh = Bric::Util::FTP::DirHandle->new($self->{ftps},
- "/" .
$oc->get_name . "/",
+ "/$site_name/" .
$oc->get_name . "/",
$site_id,
$oc->get_id(),
$cid);


Adrian
Re: Incorrect PWD with bric_ftpd [ In reply to ]
On Oct 26, 2010, at 4:48 PM, Adrian Yee wrote:

> Hi,
>
> Ran into this today where some FTP clients (Filezilla being one), will do a PWD after doing a CWD. This revealed a bug where bric_ftpd was returning the path without the site name as the root directory. The following patch (also attached in case of wrapping issues) fixes this:

Thanks. Do you have a git fork?

David