From 02efb4e1196ca467e796f65ef1d49db27a5254f8 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Sun, 18 Oct 2015 18:05:41 +0300 Subject: [PATCH] Skip port number parsing when UNIX socket is specified. --- projects/stargazer/plugins/other/radius/config.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/stargazer/plugins/other/radius/config.cpp b/projects/stargazer/plugins/other/radius/config.cpp index 6742f811..68b8760f 100644 --- a/projects/stargazer/plugins/other/radius/config.cpp +++ b/projects/stargazer/plugins/other/radius/config.cpp @@ -169,6 +169,8 @@ T toInt(const std::vector& 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) -- 2.43.2