Route auth lookup through RedisStore when [REDIS] is configured
This commit is contained in:
1 parent
0de78c459b
commit
2a3515247c
2 files changed
+20
No files matched your search
@@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
****************************************************************************/
|
||||
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
#include <algorithm>
|
||||
@@ -450,6 +451,16 @@ bool Reflector::initialize(Async::Config &cfg)
|
||||
<< "Aborting startup." << std::endl;
|
||||
return false;
|
||||
}
|
||||
auto warn_if_nonempty = [this](const char* section) {
|
||||
std::list<std::string> keys = m_cfg->listSection(section);
|
||||
if (!keys.empty()) {
|
||||
std::cerr << "WARN: [" << section << "] in svxreflector.conf is "
|
||||
"ignored because [REDIS] is configured. "
|
||||
<< "Run --import-conf-to-redis to migrate." << std::endl;
|
||||
}
|
||||
};
|
||||
warn_if_nonempty("USERS");
|
||||
warn_if_nonempty("PASSWORDS");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "ReflectorClient.h"
|
||||
#include "Reflector.h"
|
||||
#include "TGHandler.h"
|
||||
#include "RedisStore.h"
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1290,6 +1291,14 @@ void ReflectorClient::handleHeartbeat(Async::Timer *t)
|
||||
|
||||
std::string ReflectorClient::lookupUserKey(const std::string& callsign)
|
||||
{
|
||||
if (m_reflector->redisStore() != nullptr) {
|
||||
std::string key = m_reflector->redisStore()->lookupUserKey(callsign);
|
||||
if (key.empty()) {
|
||||
cout << "*** WARNING: Redis lookup failed for user \""
|
||||
<< callsign << "\"" << endl;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
string auth_group;
|
||||
if (!m_cfg->getValue("USERS", callsign, auth_group) || auth_group.empty())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user