-std::map<uint32_t, user_iter>::const_iterator it(ipIndex.find(ip));
-
-return it != ipIndex.end();
+return ipIndex.find(ip) != ipIndex.end();
+}
+//-----------------------------------------------------------------------------
+bool UsersImpl::IsIPInUse(uint32_t ip, const std::string & login, ConstUserPtr * user) const
+{
+std::lock_guard<std::mutex> lock(m_mutex);
+auto iter = users.begin();
+while (iter != users.end())
+ {
+ if (iter->GetLogin() != login &&
+ !iter->GetProperties().ips.Get().isAnyIP() &&
+ iter->GetProperties().ips.Get().find(ip))
+ {
+ if (user != nullptr)
+ *user = &(*iter);
+ return true;
+ }
+ ++iter;
+ }
+return false;