fixed allowed_servers

This commit is contained in:
HanzZ 2012-04-09 09:33:14 +02:00
parent 996a48005b
commit 775c2a2e17
2 changed files with 3 additions and 3 deletions

View file

@ -70,7 +70,7 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
("service.protocol", value<std::string>()->default_value(""), "Protocol")
("service.pidfile", value<std::string>()->default_value("/var/run/spectrum2/$jid.pid"), "Full path to pid file")
("service.working_dir", value<std::string>()->default_value("/var/lib/spectrum2/$jid"), "Working dir")
("service.allowed_servers", value<std::string>()->default_value(""), "Only users from these servers can connect")
("service.allowed_servers", value<std::vector<std::string> >()->multitoken(), "Only users from these servers can connect")
("service.server_mode", value<bool>()->default_value(false), "True if Spectrum should behave as server")
("service.users_per_backend", value<int>()->default_value(100), "Number of users per one legacy network backend")
("service.backend_host", value<std::string>()->default_value("localhost"), "Host to bind backend server to")

View file

@ -168,7 +168,7 @@ bool UserRegistration::handleGetRequest(const Swift::JID& from, const Swift::JID
std::string barejid = from.toBare().toString();
if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) {
std::list<std::string> const &x = CONFIG_LIST(m_config,"service.allowed_servers");
std::vector<std::string> const &x = CONFIG_VECTOR(m_config,"service.allowed_servers");
if (std::find(x.begin(), x.end(), from.getDomain()) == x.end()) {
LOG4CXX_INFO(logger, barejid << ": This user has no permissions to register an account")
sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify);
@ -275,7 +275,7 @@ bool UserRegistration::handleSetRequest(const Swift::JID& from, const Swift::JID
std::string barejid = from.toBare().toString();
if (!CONFIG_BOOL(m_config,"registration.enable_public_registration")) {
std::list<std::string> const &x = CONFIG_LIST(m_config,"service.allowed_servers");
std::vector<std::string> const &x = CONFIG_VECTOR(m_config,"service.allowed_servers");
if (std::find(x.begin(), x.end(), from.getDomain()) == x.end()) {
LOG4CXX_INFO(logger, barejid << ": This user has no permissions to register an account")
sendError(from, id, ErrorPayload::BadRequest, ErrorPayload::Modify);