]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/radius/config.cpp
Skip port number parsing when UNIX socket is specified.
[stg.git] / projects / stargazer / plugins / other / radius / config.cpp
index 6742f8111e1be21a732818908a2093a5a5fe63ef..68b8760f1347c29f240d08e97e5abfdd1342cfc1 100644 (file)
@@ -169,6 +169,8 @@ T toInt(const std::vector<std::string>& values)
 
 uint16_t toPort(const std::string& value)
 {
+    if (value.empty())
+        return 0;
     uint16_t res = 0;
     if (str2x(value, res) == 0)
         return res;
@@ -257,7 +259,7 @@ std::string parsePort(Config::Type connectionType, const std::string& value)
     if (pos == std::string::npos)
         throw ParserError(0, "Connection type is not specified. Should be either 'unix' or 'tcp'.");
     if (connectionType == Config::UNIX)
-        return value.substr(pos + 1);
+        return "";
     std::string address(value.substr(pos + 1));
     pos = address.find_first_of(':', pos + 1);
     if (pos == std::string::npos)