This commit is contained in:
parent
94337d703e
commit
75f0f75077
4 changed files with 6 additions and 27 deletions
|
@ -59,7 +59,7 @@ void AdminInterface::handleMessageReceived(Swift::Message::ref message) {
|
|||
if (!message->getTo().getNode().empty())
|
||||
return;
|
||||
|
||||
std::list<std::string> const &x = CONFIG_LIST(m_component->getConfig(),"service.admin_jid");
|
||||
std::vector<std::string> const &x = CONFIG_VECTOR(m_component->getConfig(),"service.admin_jid");
|
||||
if (std::find(x.begin(), x.end(), message->getFrom().toBare().toString()) == x.end()) {
|
||||
LOG4CXX_WARN(logger, "Message not from admin user, but from " << message->getFrom().toBare().toString());
|
||||
return;
|
||||
|
|
|
@ -77,7 +77,7 @@ bool Config::load(std::istream &ifs, boost::program_options::options_description
|
|||
("service.backend_port", value<std::string>()->default_value("0"), "Port to bind backend server to")
|
||||
("service.cert", value<std::string>()->default_value(""), "PKCS#12 Certificate.")
|
||||
("service.cert_password", value<std::string>()->default_value(""), "PKCS#12 Certificate password.")
|
||||
("service.admin_jid", value<std::string>()->default_value(""), "Administrator jid.")
|
||||
("service.admin_jid", value<std::vector<std::string> >()->multitoken(), "Administrator jid.")
|
||||
("service.admin_password", value<std::string>()->default_value(""), "Administrator password.")
|
||||
("service.reuse_old_backends", value<bool>()->default_value(true), "True if Spectrum should use old backends which were full in the past.")
|
||||
("service.idle_reconnect_time", value<int>()->default_value(0), "Time in seconds after which idle users are reconnected to let their backend die.")
|
||||
|
|
|
@ -150,29 +150,8 @@ void UserManager::handlePresence(Swift::Presence::ref presence) {
|
|||
// Create user class if it's not there
|
||||
if (!user) {
|
||||
// Admin user is not legacy network user, so do not create User class instance for him
|
||||
/*
|
||||
if (m_component->inServerMode() && CONFIG_STRING(m_component->getConfig(), "service.admin_jid") == presence->getFrom().toBare().toString()) {
|
||||
// Send admin contact to the user.
|
||||
Swift::RosterPayload::ref payload = Swift::RosterPayload::ref(new Swift::RosterPayload());
|
||||
Swift::RosterItemPayload item;
|
||||
item.setJID(m_component->getJID());
|
||||
item.setName("Admin");
|
||||
item.setSubscription(Swift::RosterItemPayload::Both);
|
||||
payload->addItem(item);
|
||||
|
||||
Swift::SetRosterRequest::ref request = Swift::SetRosterRequest::create(payload, presence->getFrom(), m_component->getIQRouter());
|
||||
request->send();
|
||||
|
||||
Swift::Presence::ref response = Swift::Presence::create();
|
||||
response->setTo(presence->getFrom());
|
||||
response->setFrom(m_component->getJID());
|
||||
m_component->getStanzaChannel()->sendPresence(response);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
if (m_component->inServerMode()) {
|
||||
// && CONFIG_STRING(m_component->getConfig(), "service.admin_jid") == presence->getFrom().toBare().toString()) {
|
||||
std::list<std::string> const &x = CONFIG_LIST(m_component->getConfig(),"service.admin_jid");
|
||||
std::vector<std::string> const &x = CONFIG_VECTOR(m_component->getConfig(),"service.admin_jid");
|
||||
if (std::find(x.begin(), x.end(), presence->getFrom().toBare().toString()) != x.end()) {
|
||||
|
||||
// Send admin contact to the user.
|
||||
|
|
|
@ -39,8 +39,8 @@ UserRegistry::~UserRegistry() { m_removeTimer->stop(); }
|
|||
|
||||
void UserRegistry::isValidUserPassword(const Swift::JID& user, Swift::ServerFromClientSession *session, const Swift::SafeByteArray& password) {
|
||||
|
||||
if (!CONFIG_STRING(config, "service.admin_jid").empty() ) {
|
||||
std::list<std::string> const &x = CONFIG_LIST(config,"service.admin_jid");
|
||||
// if (!CONFIG_STRING(config, "service.admin_jid").empty() ) {
|
||||
std::vector<std::string> const &x = CONFIG_VECTOR(config,"service.admin_jid");
|
||||
if (std::find(x.begin(), x.end(), user.toBare().toString()) != x.end()) {
|
||||
if (Swift::safeByteArrayToString(password) == CONFIG_STRING(config, "service.admin_password")) {
|
||||
session->handlePasswordValid();
|
||||
|
@ -50,7 +50,7 @@ void UserRegistry::isValidUserPassword(const Swift::JID& user, Swift::ServerFrom
|
|||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// }
|
||||
std::string key = user.toBare().toString();
|
||||
|
||||
// Users try to connect twice
|
||||
|
|
Loading…
Add table
Reference in a new issue