diff options
author | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-09-26 23:49:15 +0000 |
---|---|---|
committer | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-09-26 23:49:15 +0000 |
commit | 2be86e1958ca8de8aaad54f75a8d6afec59d49af (patch) | |
tree | 72bfb8ac3a4f013bf4e82cc8cdbdac6369b7946f | |
parent | 3283fa835e592b72a8638102af99b8d572cf4c8c (diff) |
Fixed bug #404; this was caused by recieving multiple OPERTYPEs from a remote server, which eventually resulted in bad pointers inside the all_opers list
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8084 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/inspircd.h | 3 | ||||
-rw-r--r-- | src/cmd_who.cpp | 2 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 2 | ||||
-rw-r--r-- | src/snomasks.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 13 |
5 files changed, 8 insertions, 14 deletions
diff --git a/include/inspircd.h b/include/inspircd.h index 567b172c2..c44325a02 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -28,6 +28,7 @@ #include <time.h> #include <string> #include <sstream> +#include <list> #include "inspircd_config.h" #include "uid.h" #include "users.h" @@ -440,7 +441,7 @@ class CoreExport InspIRCd : public classbase /** Oper list, a vector containing all local and remote opered users */ - std::vector<userrec*> all_opers; + std::list<userrec*> all_opers; /** Map of local ip addresses for clone counting */ diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 07370f31e..93855dce2 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -295,7 +295,7 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) if (opt_viewopersonly) { /* Showing only opers */ - for (std::vector<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) + for (std::list<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) { userrec* oper = *i; diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 1defef047..1cad143c5 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -114,7 +114,7 @@ void InspIRCd::WriteOpers(const char* text, ...) void InspIRCd::WriteOpers(const std::string &text) { - for (std::vector<userrec*>::iterator i = this->all_opers.begin(); i != this->all_opers.end(); i++) + for (std::list<userrec*>::iterator i = this->all_opers.begin(); i != this->all_opers.end(); i++) { userrec* a = *i; if (IS_LOCAL(a) && a->IsModeSet('s')) diff --git a/src/snomasks.cpp b/src/snomasks.cpp index e447cd637..df524b51f 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -53,7 +53,7 @@ void SnomaskManager::WriteToSnoMask(char letter, const std::string &text) if (n != SnoMasks.end()) { /* Only opers can receive snotices, so we iterate the oper list */ - for (std::vector<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) + for (std::list<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++) { userrec* a = *i; if (IS_LOCAL(a) && a->IsModeSet('s') && a->IsModeSet('n') && a->IsNoticeMaskSet(n->first)) diff --git a/src/users.cpp b/src/users.cpp index b357fd149..4f5c567d2 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -830,16 +830,9 @@ void userrec::UnOper() // unset their oper type (what IS_OPER checks), and remove +o *this->oper = 0; this->modes[UM_OPERATOR] = 0; - - // remove them from the opers list. - for (std::vector<userrec*>::iterator a = ServerInstance->all_opers.begin(); a < ServerInstance->all_opers.end(); a++) - { - if (*a == this) - { - ServerInstance->all_opers.erase(a); - return; - } - } + + // remove the user from the oper list. Will remove multiple entries as a safeguard against bug #404 + ServerInstance->all_opers.remove(this); } } |