diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-01-13 16:14:57 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-01-13 16:14:57 +0000 |
commit | a436c0371dd9c013e523b18e86e19e5631f4970f (patch) | |
tree | 0dcb7bec7f73d5d357e725ed684ab1f47a557d35 /src | |
parent | a07216c652a45cbf1003af2e988464b462498766 (diff) |
Added extra safety check for a condition that should NOT happen (in theory, but still)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2785 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree.cpp | 97 |
1 files changed, 51 insertions, 46 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index d8f4821ba..0ecc595fc 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -927,56 +927,61 @@ class TreeSocket : public InspSocket { /* process one channel at a time, applying modes. */ char* usr = (char*)params[usernum].c_str(); - char permissions = *usr; - switch (permissions) - { - case '@': - usr++; - mode_users[modectr++] = usr; - strlcat(modestring,"o",MAXBUF); - break; - case '%': - usr++; - mode_users[modectr++] = usr; - strlcat(modestring,"h",MAXBUF); - break; - case '+': - usr++; - mode_users[modectr++] = usr; - strlcat(modestring,"v",MAXBUF); - break; - } - who = Srv->FindNick(usr); - if (who) - { - Srv->JoinUserToChannel(who,channel,key); - if (modectr >= (MAXMODES-1)) - { - /* theres a mode for this user. push them onto the mode queue, and flush it - * if there are more than MAXMODES to go. - */ - if ((ourTS >= TS) || (Srv->IsUlined(who->server))) - { - /* We also always let u-lined clients win, no matter what the TS value */ - log(DEBUG,"Our our channel newer than theirs, accepting their modes"); - Srv->SendMode(mode_users,modectr,who); - } - else + /* Safety check just to make sure someones not sent us an FJOIN full of spaces + * (is this even possible?) */ + if (usr && *usr) + { + char permissions = *usr; + switch (permissions) + { + case '@': + usr++; + mode_users[modectr++] = usr; + strlcat(modestring,"o",MAXBUF); + break; + case '%': + usr++; + mode_users[modectr++] = usr; + strlcat(modestring,"h",MAXBUF); + break; + case '+': + usr++; + mode_users[modectr++] = usr; + strlcat(modestring,"v",MAXBUF); + break; + } + who = Srv->FindNick(usr); + if (who) + { + Srv->JoinUserToChannel(who,channel,key); + if (modectr >= (MAXMODES-1)) { - log(DEBUG,"Their channel newer than ours, bouncing their modes"); - /* bouncy bouncy! */ - std::deque<std::string> params; - /* modes are now being UNSET... */ - *mode_users[1] = '-'; - for (unsigned int x = 0; x < modectr; x++) + /* theres a mode for this user. push them onto the mode queue, and flush it + * if there are more than MAXMODES to go. + */ + if ((ourTS >= TS) || (Srv->IsUlined(who->server))) + { + /* We also always let u-lined clients win, no matter what the TS value */ + log(DEBUG,"Our our channel newer than theirs, accepting their modes"); + Srv->SendMode(mode_users,modectr,who); + } + else { - params.push_back(mode_users[x]); + log(DEBUG,"Their channel newer than ours, bouncing their modes"); + /* bouncy bouncy! */ + std::deque<std::string> params; + /* modes are now being UNSET... */ + *mode_users[1] = '-'; + for (unsigned int x = 0; x < modectr; x++) + { + params.push_back(mode_users[x]); + } + // tell everyone to bounce the modes. bad modes, bad! + DoOneToMany(Srv->GetServerName(),"FMODE",params); } - // tell everyone to bounce the modes. bad modes, bad! - DoOneToMany(Srv->GetServerName(),"FMODE",params); + strcpy(mode_users[1],"+"); + modectr = 2; } - strcpy(mode_users[1],"+"); - modectr = 2; } } } |