Re: Indy10: TIdFTPServer.CommandCWD(ASender: TIdCommand) - HomeDir Question

Giganews Newsgroups
Subject: Re: Indy10: TIdFTPServer.CommandCWD(ASender: TIdCommand) - HomeDir Question
Posted by:  Remy Lebeau (Indy Team) (no.spam@no.spam.com)
Date: Thu, 12 Oct 2006

"Gordon Kästner" <Meta7…@arcor.de> wrote in message
news:04FDE785510BE340Meta7…@arcor.de...

> I have problem determining if my client FTP apps calls ChangeDir('.')

Why do you need to know that?  Indy tells you the specific folder that the
client is trying to navigate to.  If you write your event handler properly,
you don't need to know that the client sent '.', because it really is
functionaly the same as the CurrentDir from the FTP protocol's perspective.

> the VDirectory parameter is the CurrentDir + s (which is also the
> CurrentDir) so that s is twice the CurrentDir.

If that is really happening, then that is a bug in TIdFTPServer's path
handling.  Assuming that IdGlobalProtocols.ProcessPath() can handle '.' (it
already handles '..'), then yes, '.' should be passed as-is to
TIdFTPServer.DoProcessPath(), which will pass it as-is to
IdGlobalProtocols.ProcessPath().  However, if ProcessPath() cannot handle
'.', then CommandCWD() should not be calling DoProcessPath() at all when s
is set to '.'

> If s would be '.' i.e. VDirectory would also be '.'

No, it should be set to the CurrentDir.

> I could check for that and could set VDirectory to the clients homedir.

That would be the wrong thing to do.  You should only be setting the
VDirectory to the HomeDir if the client requested the '/' folder.  Otherwise
the path has to be relative to the HomeDir.

Gambit

Replies

In response to

Indy10: TIdFTPServer.CommandCWD(ASender: TIdCommand) - HomeDir Question posted by Gordon_Kästner on Thu, 12 Oct 2006