From: Maxim Mamontov Date: Sun, 28 Jul 2013 12:32:47 +0000 (+0300) Subject: Allow to assign 0.0.0.0 to multiple users. X-Git-Tag: 2.409~348 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/a903ce1ab463173c9a0af322c4c2f23076d21310?ds=sidebyside;hp=-c Allow to assign 0.0.0.0 to multiple users. --- a903ce1ab463173c9a0af322c4c2f23076d21310 diff --git a/include/stg/user_ips.h b/include/stg/user_ips.h index 264b5896..e55f99fa 100644 --- a/include/stg/user_ips.h +++ b/include/stg/user_ips.h @@ -70,6 +70,7 @@ public: std::string GetIpStr() const; bool IsIPInIPS(uint32_t ip) const; bool OnlyOneIP() const; + bool IsAnyIP() const; size_t Count() const; void Add(const IP_MASK &im); void Erase(); @@ -172,6 +173,12 @@ return false; } //----------------------------------------------------------------------------- inline +bool USER_IPS::IsAnyIP() const +{ + return !ips.empty() && ips.front().ip == 0; +} +//----------------------------------------------------------------------------- +inline void USER_IPS::Add(const IP_MASK &im) { ips.push_back(im); diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index dfdc8634..c4f63c64 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -702,7 +702,9 @@ std::list::const_iterator iter; iter = users.begin(); while (iter != users.end()) { - if (iter->GetLogin() != login && iter->GetProperty().ips.Get().IsIPInIPS(ip)) + if (iter->GetLogin() != login && + !iter->GetProperty().ips.Get().IsAnyIP() && + iter->GetProperty().ips.Get().IsIPInIPS(ip)) { if (user != NULL) *user = &(*iter);