From 9517adab7481acbd258dcba4b235c633760749b2 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 13 Apr 2005 03:48:39 +0000 Subject: Fixed m_park stuff git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1068 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands.cpp | 4 ++-- src/inspircd.cpp | 14 ++++++++------ src/modules/m_park.cpp | 9 ++++++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/commands.cpp b/src/commands.cpp index 726f71e9a..ca387d4cf 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -388,8 +388,8 @@ void handle_kill(char **parameters, int pcnt, userrec *user) log(DEBUG,"deleting user hash value %d",iter->second); if ((iter->second) && (user->registered == 7)) { delete iter->second; - } - clientlist.erase(iter); + } + clientlist.erase(iter); } purge_empty_chans(); } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index db198e601..27dfe9364 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -1235,7 +1235,8 @@ void purge_empty_chans(void) if (i != chanlist.end()) { log(DEBUG,"del_channel: destroyed: %s",i->second->name); - if (i->second) delete i->second; + if (i->second) + delete i->second; chanlist.erase(i); go_again = 1; purge++; @@ -2051,7 +2052,7 @@ void kill_link(userrec *user,const char* r) if (user->registered == 7) { purge_empty_chans(); } - user = NULL; + //user = NULL; } void kill_link_silent(userrec *user,const char* r) @@ -3766,6 +3767,7 @@ int InspIRCd(void) expire_lines(); FOREACH_MOD OnBackgroundTimer(TIME); expire_run = true; + continue; } if ((TIME % 5) == 1) expire_run = false; @@ -3900,9 +3902,9 @@ int InspIRCd(void) } if ((TIME > count2->second->signon) && (count2->second->registered == 3)) { - count2->second->dns_done = true; - FullConnectUser(count2->second); - goto label; + count2->second->dns_done = true; + FullConnectUser(count2->second); + goto label; } if ((count2->second->dns_done) && (count2->second->registered == 3)) // both NICK and USER... and DNS { @@ -4086,7 +4088,7 @@ int InspIRCd(void) } } label: - if(0) {}; // "Label must be followed by a statement"... so i gave it one. + if (0) {}; } /* not reached */ close (incomingSockfd); diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 5f0ce13c1..e08327bd3 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -46,6 +46,7 @@ parkinfo pinfo; long ParkMaxTime; long ConcurrentParks; long ParkMaxMsgs; +parkedinfo pi; void handle_park(char **parameters, int pcnt, userrec *user) { @@ -65,8 +66,7 @@ void handle_park(char **parameters, int pcnt, userrec *user) } else { - awaylog* aw = new awaylog; - parkedinfo pi; + awaylog* aw; char msg[MAXBUF]; long key = abs(random() * 12345); snprintf(msg,MAXBUF,"You are now parked. To unpark use /UNPARK %s %d",user->nick,key); @@ -268,9 +268,12 @@ class ModulePark : public Module if (time(NULL) >= (j->parktime+ParkMaxTime)) { userrec* thisnick = Srv->FindNick(j->nick); + // THIS MUST COME BEFORE THE QuitUser - QuitUser can + // create a recursive call to OnUserQuit in this module + // and then corrupt the pointer! + pinfo.erase(j); if (thisnick) Srv->QuitUser(thisnick,"PARK timeout"); - pinfo.erase(j); go_again = true; break; } -- cgit v1.2.3