Bric::Util::FTP::Server - Virtual FTP Server


use Bric::Util::FTP::Server;


This module provides an FTP interface to Bricolage templates. The directory tree is the category tree created in Bricolage. The first directory level selects the output channel. The files are the template files in the output channels and categories. When a user downloads a template file they recieve the most recent checked-in version of the template. When a file is uploaded it is automatically checked-in and deployed.

For installation and configuration instructions see Bric::Admin.


Only GET, PUT and DELETE are implemented for templates. No modification of categories is supported.

The system doesn't deal with the possibility of having more than one active template for a given filename. This probably won't be fixed here - rather, Bricolage will soon prevent this situation.


This module inherits from Net::FTPServer and doesn't override any public methods. See Net::FTPServer for details.


Private Instance Methods


This is called by Net:FTPServer before configuration begins. It's used in this class to add our name and version to the version string displayed by the server.

authenticaton_hook($user, $pass, $user_is_anon)

When a user logs in authentication_hook() is called to check their username and password. This method calls Bric::Biz::Person::User->lookup() using the given username and then checks the password. Returns -1 on login failure or 0 on success. As a side-effect this method stashes the Bric::Biz::Person::User object into $self->{user_obj}.


Net::FTPServer calls this method to get a DirHandle for the root directory. This method just calls Bric::Util::FTP::DirHandle->new().


This method is called when an error is signaled elsewhere in the server. It looks for a key called "error" in $self and returns that if it's available. This allows for an OO version of the ever-popular $! mechanism. (Or, at least, that's the idea. As far as I can tell it never really gets called!)


This method is called after the control port is bound but before starting the accept infinite loop block. It's used in this class to become the Bricolage system user (but only if the FTP server was started by the root user).


Overrides FTP::Server's implementation to ensure no limits are set. Better to just let the OS set them.


Sam Tregar <>

See Also