error(message)
{}
ParserError(size_t pos, const std::string& message)
- : runtime_error("Parsing error at position " + x2str(pos) + ". " + message),
+ : runtime_error("Parsing error at position " + std::to_string(pos) + ". " + message),
position(pos),
error(message)
{}
- virtual ~ParserError() throw() {}
size_t position;
std::string error;
return it->second;
}
-Config::Pairs parseVector(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+Config::Pairs parseVector(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return Config::Pairs();
}
-Config::Authorize parseAuthorize(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+Config::Authorize parseAuthorize(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return Config::Authorize();
}
-Config::ReturnCode parseReturnCode(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+Config::ReturnCode parseReturnCode(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return Config::REJECT;
}
-bool parseBool(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+bool parseBool(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return false;
}
-std::string parseString(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+std::string parseString(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
throw ParserError("Invalid connection type. Should be either 'unix' or 'tcp', got '" + type + "'");
}
-Config::Section parseSection(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+Config::Section parseSection(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return Config::Section();
}
-uid_t parseUID(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+uid_t parseUID(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return -1;
}
-gid_t parseGID(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+gid_t parseGID(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
return -1;
}
-mode_t parseMode(const std::string& paramName, const std::vector<PARAM_VALUE>& params)
+mode_t parseMode(const std::string& paramName, const std::vector<STG::ParamValue>& params)
{
for (size_t i = 0; i < params.size(); ++i)
if (params[i].param == paramName)
} // namespace anonymous
-bool Config::Authorize::check(const USER& user, const Config::Pairs& radiusData) const
+bool Config::Authorize::check(const User& user, const Config::Pairs& radiusData) const
{
if (!m_auth)
return false; // No flag - no authorization.
return true;
}
-Config::Config(const MODULE_SETTINGS& settings)
+Config::Config(const ModuleSettings& settings)
: autz(parseSection("autz", settings.moduleParams)),
auth(parseSection("auth", settings.moduleParams)),
postauth(parseSection("postauth", settings.moduleParams)),