#include "Ftp.h" Ftp::var_map Ftp::VariableMap; bool Ftp::initializeVariableMap() { VariableMap["Ftp"] = &Ftp::setExecutable; VariableMap["Owner"] = &Ftp::setUser; VariableMap["P4FTPPORT"] = &Ftp::setPort; VariableMap["P4PORT"] = &Ftp::setTargetPort; return true; } Ftp::Ftp(const std::string& name, const std::string& type, Configuration * config) : Executable(name, type, config) { } Ftp::~Ftp() { } void Ftp::changeUser() { if( _user != "root" ) { Executable::changeUser(); } // Ftp is allowed to run as root // to be able to access port 21 } void Ftp::verifyVariables() throw(VerificationException) { static bool initialized = initializeVariableMap(); env_map::iterator pos; var_map::const_iterator iter; for (iter = VariableMap.begin(); iter != VariableMap.end(); ++iter) { pos = _variables.find(iter->first); if (pos != _variables.end()) { (this->*iter->second)(pos->second); _variables.erase(pos); } else { std::string err = _type + " " + _name + ". No " + iter->first + " defined"; throw VerificationException(err); } } } void Ftp::prepareArgs(arg_vec& args) { std::string procname = _executable + " [" + _port + "]"; args.push_back(procname); args.push_back("-l"); args.push_back(_port); addOption("P4LOG", "-L", args); addOption("Options", NULL, args); args.push_back("-p"); args.push_back(_targetPort); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 8041 | Sven Erik Knop | rollback to 8039, using -u does not seem to work | ||
#4 | 8040 | Sven Erik Knop | Graceful downgrading of p4ftpd through -u option. | ||
#3 | 8039 | Sven Erik Knop |
P4FTPD is allowed to run as root. This also fixes an overloaded method that could cause confusion in the code. |
||
#2 | 5987 | Sven Erik Knop |
Few minor changes: All commands now accept variable called "Options". This can be used to collect all options for which Perforce has not defined an environment variable - for example the undocumented "-C1" for p4d to start a case insensitive server. p4d also accepts the variables P4USER and P4PASSWD. These are only used for stopping the service, which is done first via "p4 admin stop". Note that if the stop via the admin command fails, p4dcfg will stop the service via a kill |
||
#1 | 5882 | Sven Erik Knop | initial publish |