diff --git a/server/authoriz.cpp b/server/authoriz.cpp index 9bac49d6c..ab88bf8ad 100755 --- a/server/authoriz.cpp +++ b/server/authoriz.cpp @@ -52,17 +52,19 @@ size_t TUserTable::GetLicenses() const { THostSet hsHosts; for( TUsersHashMap::const_iterator it = begin(); it != end(); ++it ) - hsHosts.insert(it->first); + { + TUserInfo* ui = it->second; + if (ui != NULL) + hsHosts.insert(ui->m_strHost); + } return hsHosts.size(); } wxString TUserTable::BuildKey(wxSocketBase& sock, const wxChar* user, int session) const { wxIPV4address peer; sock.GetPeer(peer); - wxString host; - host.Printf("%s:%d", peer.Hostname().c_str(), session); wxString strUserAtHost; - strUserAtHost.Printf("%s@%s", user, host.c_str()); + strUserAtHost.Printf("%s@%s:%d", user, peer.Hostname().c_str(), session); return strUserAtHost; } @@ -110,6 +112,8 @@ bool TUserTable::Kill(TUserInfo* ui) if (it->second == ui) { erase(it); + if (GetLicenses() == 0) + clear(); return true; } }