X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..fa277e91e547868196f37e982d0fe496ad1f10ee:/include/user_ips.h diff --git a/include/user_ips.h b/include/user_ips.h index d3e640c1..250520b2 100644 --- a/include/user_ips.h +++ b/include/user_ips.h @@ -27,16 +27,19 @@ #ifndef USER_IPS_H #define USER_IPS_H +#ifdef FREE_BSD +#include +#endif + +#include +#include +#include + +#include #include -//#include #include #include #include -#include -///////////////////////// -#include -#include -#include #include "common.h" #include "os_int.h" @@ -202,8 +205,7 @@ std::vector ipMask; std::string err; if (ipsStr.empty()) { - err = "Incorrect IP address."; - throw(err); + return ips; } if (ipsStr[0] == '*' && ipsStr.size() == 1) @@ -235,7 +237,7 @@ for (unsigned int i = 0; i < ipMask.size(); i++) if (strIp == NULL) { err = "Incorrect IP address " + ipsStr; - throw(err); + return ips; } strMask = strtok(NULL, "/"); @@ -243,7 +245,7 @@ for (unsigned int i = 0; i < ipMask.size(); i++) if (im.ip == INADDR_NONE) { err = "Incorrect IP address: " + std::string(strIp); - throw(err); + return ips; } im.mask = 32; @@ -253,20 +255,20 @@ for (unsigned int i = 0; i < ipMask.size(); i++) if (str2x(strMask, m) != 0) { err = "Incorrect mask: " + std::string(strMask); - throw(err); + return ips; } im.mask = m; if (im.mask > 32) { err = "Incorrect mask: " + std::string(strMask); - throw(err); + return ips; } if ((im.ip & ips.CalcMask(im.mask)) != im.ip) { err = "Address does'n match mask: " + std::string(strIp) + "/" + std::string(strMask); - throw(err); + return ips; } } ips.ips.push_back(im); @@ -276,5 +278,3 @@ return ips; } //------------------------------------------------------------------------- #endif //USER_IPS_H - -