mina-ftpserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklas Gustavsson" <nik...@protocol7.com>
Subject Re: Configuring FTP commands
Date Thu, 15 May 2008 12:02:00 GMT
On Thu, May 15, 2008 at 12:23 PM, Zorgan <lazreg@gmail.com> wrote:
> Is it possible to add a way to enable or disable some FTP commands supported
> by the Apache FTP server ?
> For example : disable the EPSV command to make the passive mode possible
> only with the PASV command!
> I found very interesting the fact that Hermes FTP
> server<http://hermesftp.sourceforge.net/> contains
> a configuration file : tarara with a section that defines the list of FTP
> commands handled by it. You can disable a command by commenting the defining
> line or change the attribute defining the Java class name implementing it by
> cmdNotImpl

Yes, you can add, replace or remove commands as you see fit. This will
be available from the Spring configuration (and already is from the
properties config as well). If you have an embedded server, you can do
something like this:

    public static class NotSupportedCommand implements Command {
        public void execute(FtpIoSession session, FtpServerContext
context, FtpRequest request) throws IOException,
                FtpException {
DefaultFtpReply(FtpReply.REPLY_502_COMMAND_NOT_IMPLEMENTED, "Not

    public static void main(String[] args) throws Exception {
        DefaultFtpServerContext context = new DefaultFtpServerContext();
        DefaultCommandFactory commandFactory = new DefaultCommandFactory();

        Map<String, Command> customCommands = new HashMap<String, Command>();
        customCommands.put("EPSV", new NotSupportedCommand());


        FtpServer server = new FtpServer(context);

This will overwrite the default implementation.

Maybe we should add the NotSupportedCommand to our implementation to
make this a bit easier?


View raw message