mirror of
https://github.com/znc/znc.git
synced 2026-05-09 14:54:53 +02:00
Fix a crash with WebMods and deleting User
If a user who is currently logged in to WebMods is deleted, his CWebSession still kept a stale CUser pointer around. The next time he loaded a web page, Bad Things(tm) happened. This is fixed by deleting all of a user's sessions when that user is deleted. Thanks to DarthGandalf for spotting the bug and writing the patch. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1827 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+12
-1
@@ -12,7 +12,7 @@
|
||||
#include <sstream>
|
||||
|
||||
// Sessions are valid for a day, (24h, ...)
|
||||
TCacheMap<CString, CSmartPtr<CWebSession> > CWebSock::m_mspSessions(24 * 60 * 60 * 1000);
|
||||
CWebSessionMap CWebSock::m_mspSessions(24 * 60 * 60 * 1000);
|
||||
|
||||
CZNCTagHandler::CZNCTagHandler(CWebSock& WebSock) : CTemplateTagHandler(), m_WebSock(WebSock) {
|
||||
}
|
||||
@@ -66,6 +66,17 @@ size_t CWebSession::AddSuccess(const CString& sMessage) {
|
||||
return m_vsSuccessMsgs.size();
|
||||
}
|
||||
|
||||
void CWebSessionMap::FinishUserSessions(const CUser& User) {
|
||||
iterator it = m_mItems.begin();
|
||||
|
||||
while (it != m_mItems.end()) {
|
||||
if (it->second.second->GetUser() == &User) {
|
||||
m_mItems.erase(it++);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CWebAuth::AcceptedLogin(CUser& User) {
|
||||
if (m_pWebSock) {
|
||||
|
||||
Reference in New Issue
Block a user