ReflectorLogic: Don't allow empty config variables

The following configuration variables are not allowed to be set to an
empty string: HOST, CALLSIGN, AUTH_KEY and EVENT_HANDLER.
This commit is contained in:
Tobias Blomberg 2022-01-27 19:47:50 +01:00
parent 4c4218df51
commit 449537598b
2 changed files with 15 additions and 12 deletions

View File

@ -181,26 +181,28 @@ bool ReflectorLogic::initialize(void)
{
cfg().getValue(name(), "VERBOSE", m_verbose);
if (!cfg().getValue(name(), "HOST", m_reflector_host))
if (!cfg().getValue(name(), "HOST", m_reflector_host) ||
m_reflector_host.empty())
{
cerr << "*** ERROR: " << name() << "/HOST missing in configuration" << endl;
std::cerr << "*** ERROR: " << name()
<< "/HOST missing in configuration or is empty" << std::endl;
return false;
}
m_reflector_port = 5300;
cfg().getValue(name(), "PORT", m_reflector_port);
if (!cfg().getValue(name(), "CALLSIGN", m_callsign))
if (!cfg().getValue(name(), "CALLSIGN", m_callsign) || m_callsign.empty())
{
cerr << "*** ERROR: " << name() << "/CALLSIGN missing in configuration"
<< endl;
std::cerr << "*** ERROR: " << name()
<< "/CALLSIGN missing in configuration or is empty" << std::endl;
return false;
}
if (!cfg().getValue(name(), "AUTH_KEY", m_auth_key))
if (!cfg().getValue(name(), "AUTH_KEY", m_auth_key) || m_auth_key.empty())
{
cerr << "*** ERROR: " << name() << "/AUTH_KEY missing in configuration"
<< endl;
std::cerr << "*** ERROR: " << name()
<< "/AUTH_KEY missing in configuration or is empty" << std::endl;
return false;
}
if (m_auth_key == "Change this key now!")
@ -211,10 +213,11 @@ bool ReflectorLogic::initialize(void)
}
string event_handler_str;
if (!cfg().getValue(name(), "EVENT_HANDLER", event_handler_str))
if (!cfg().getValue(name(), "EVENT_HANDLER", event_handler_str) ||
event_handler_str.empty())
{
cerr << "*** ERROR: Config variable " << name()
<< "/EVENT_HANDLER not set\n";
std::cerr << "*** ERROR: Config variable " << name()
<< "/EVENT_HANDLER not set or empty" << std::endl;
return false;
}

View File

@ -11,7 +11,7 @@ LIBECHOLIB=1.3.3.99.0
LIBASYNC=1.6.99.17
# SvxLink versions
SVXLINK=1.7.99.56
SVXLINK=1.7.99.57
MODULE_HELP=1.0.0
MODULE_PARROT=1.1.1
MODULE_ECHO_LINK=1.5.99.2