From: Maxim Mamontov Date: Sun, 18 Oct 2015 15:05:41 +0000 (+0300) Subject: Skip port number parsing when UNIX socket is specified. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/02efb4e1196ca467e796f65ef1d49db27a5254f8?ds=sidebyside Skip port number parsing when UNIX socket is specified. --- 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)