🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1292

BCB6 Pro, Indy 9, IdFTPServer LIST problems

#1292
From: Paul at NCF
Date: Sun, 18 Feb 2007 12:01
69 lines
3365 bytes
Hi,

I'm trying to understand how the IdFTPServer works and starting to build up 
a small application, using windows xp FTP client to test it.  I can get the 
event handlers for connection, disconnection, login activities processed, 
but DIR or LS seems to be very troublesome.

In the IdFTPServerAfterUserLogin handler I set the directories as follows (I 
presume this is ok, or should be doing this some other way):

    ASender->HomeDir = "C:\\MOS\\";
    ASender->CurrentDir = "C:\\MOS\\Log\\"; or "C:\\MOS\\";

In the IdFTPServerListDirectory handler I print out the home, current, and 
parameter APath.  The APath seems to be rubbish, or has something appended. 
I'm emulating DOS and the component properties seem to indicate this is in 
use.  Am I missing something or is this a known problem?

    C:\MOS\
    C:\MOS\Log\
    C:\MOS\Log\//

The PAS file has a call to ProcessPath, is this a problem?

        ListDirectory(TIdFTPServerThread(ASender.Thread), 
ProcessPath(FCurrentDir
         , ASender.UnparsedParams), LStream, ASender.CommandHandler = 
FCmdHandlerList);

The ListDirectory does this, what is the Copy function doing?

      LPathSep := '/';    {Do not Localize}
      // Emulated System
      case FEmulateSystem of
        ftpsOther: begin
          if Assigned(OnGetCustomListFormat) then begin
            LDirectoryList.ListFormat := flfCustom;
            LDirectoryList.OnGetCustomListFormat := DoGetCustomListFormat;
          end else begin
            LDirectoryList.ListFormat := flfNone;
          end;
        end;
        ftpsDOS: begin
          LDirectoryList.ListFormat := flfDos;
          LPathSep := '\';    {Do not Localize}
        end;
        ftpsUNIX: begin
          LDirectoryList.ListFormat := flfUnix;
        end;
        ftpsVAX: begin
          LDirectoryList.ListFormat := flfVax;
        end;
      end;
      if Copy(ADirectory, Length(LPathSep), 1) <> LPathSep then begin
        ADirectory := ADirectory + LPathSep;
      end;
      // Event
      FOnListDirectory(ASender, ADirectory, LDirectoryList);


Finally, whilst on this topic (althoug I'm sure it won't be my last, where 
is the client IP connection data recorded, I can't see it in the 
TIdFTPServerThread *ASender and TIdPeerThread *AThread parameters?  Is it 
accessible as I would like to validate client IP addresses, not just the 
user accounts?

Regards,

Paul
Technical Details
Message-ID: <45d83fd9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4582a45f81472bd4,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Paul at NCF" <notplmacca@clara.co.uk>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: BCB6 Pro, Indy 9, IdFTPServer LIST problems
Date: Sun, 18 Feb 2007 12:01:02 -0000
Lines: 71
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 86.139.29.14
Message-ID: <45d83fd9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1171800025 86.139.29.14 (18 Feb 2007 04:00:25 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail