1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 09:16:38 +02:00

Fix crash caused by trying to add an akick to a channel when certain types of exceptions are set, this also fixes entry_match to match with case insensitivity, as bans/excepts/invexs arent case sensitive

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2738 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Adam-
2010-01-06 22:55:21 +00:00
parent e34448092e
commit 0761d4f74b
5 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ E Entry *entry_create(char *mask);
E Entry *entry_add(EList *list, const char *mask);
E void entry_delete(EList *list, Entry *e);
E EList *list_create();
E int entry_match(Entry *e, const std::string &nick, const std::string &user, const std::string &host, uint32 ip);
E int entry_match(Entry *e, const ci::string &nick, const ci::string &user, const ci::string &host, uint32 ip);
E int entry_match_mask(Entry *e, const char *mask, uint32 ip);
E Entry *elist_match(EList *list, const char *nick, const char *user, const char *host, uint32 ip);
E Entry *elist_match_mask(EList *list, const char *mask, uint32 ip);
+1 -1
View File
@@ -158,7 +158,7 @@ void common_unban(ChannelInfo *ci, const std::string &nick)
for (ban = ci->c->bans->entries; ban; ban = next)
{
next = ban->next;
if (entry_match(ban, u->nick, u->GetIdent(), u->host, ip) || entry_match(ban, u->nick, u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip))
if (entry_match(ban, u->nick.c_str(), u->GetIdent().c_str(), u->host, ip) || entry_match(ban, u->nick.c_str(), u->GetIdent().c_str(), u->GetDisplayedHost().c_str(), ip))
ci->c->RemoveMode(NULL, CMODE_BAN, ban->mask);
}
}
+1 -1
View File
@@ -630,7 +630,7 @@ void bot_join(ChannelInfo * ci)
{
next = ban->next;
if (entry_match(ban, ci->bi->nick, ci->bi->user, ci->bi->host, 0))
if (entry_match(ban, ci->bi->nick.c_str(), ci->bi->user.c_str(), ci->bi->host.c_str(), 0))
{
ci->c->RemoveMode(NULL, CMODE_BAN, ban->mask);
}
+6 -6
View File
@@ -2309,7 +2309,7 @@ EList *list_create()
* @param ip IP to match against, set to 0 to not match this
* @return 1 for a match, 0 for no match
*/
int entry_match(Entry *e, const std::string &nick, const std::string &user, const std::string &host, uint32 ip)
int entry_match(Entry *e, const ci::string &nick, const ci::string &user, const ci::string &host, uint32 ip)
{
/* If we don't get an entry, or it s an invalid one, no match ~ Viper */
if (!e || !e->FlagCount())
@@ -2324,11 +2324,11 @@ int entry_match(Entry *e, const std::string &nick, const std::string &user, cons
return 0;
if (e->HasFlag(ENTRYTYPE_HOST) && (host.empty() || host != e->host))
return 0;
if (e->HasFlag(ENTRYTYPE_NICK_WILD) && !Anope::Match(nick, e->nick, false))
if (e->HasFlag(ENTRYTYPE_NICK_WILD) && !Anope::Match(nick, e->nick))
return 0;
if (e->HasFlag(ENTRYTYPE_USER_WILD) && !Anope::Match(user, e->user, false))
if (e->HasFlag(ENTRYTYPE_USER_WILD) && !Anope::Match(user, e->user))
return 0;
if (e->HasFlag(ENTRYTYPE_HOST_WILD) && !Anope::Match(host, e->host, false))
if (e->HasFlag(ENTRYTYPE_HOST_WILD) && !Anope::Match(host, e->host))
return 0;
return 1;
@@ -2365,7 +2365,7 @@ int entry_match_mask(Entry * e, const char *mask, uint32 ip)
host = hostmask;
}
res = entry_match(e, nick, user, host, ip);
res = entry_match(e, nick ? nick : "", user ? user : "", host ? host : "", ip);
/* Free the destroyed mask. */
delete [] hostmask;
@@ -2391,7 +2391,7 @@ Entry *elist_match(EList * list, const char *nick, const char *user, const char
return NULL;
for (e = list->entries; e; e = e->next) {
if (entry_match(e, nick, user, host, ip))
if (entry_match(e, nick ? nick : "", user ? user : "", host ? host : "", ip))
return e;
}
+1 -1
View File
@@ -241,7 +241,7 @@ void ChannelModeBan::AddMask(Channel *chan, const char *mask)
{
BotInfo *bi = chan->ci->bi;
if (entry_match(ban, bi->nick, bi->user, bi->host, 0))
if (entry_match(ban, bi->nick.c_str(), bi->user.c_str(), bi->host.c_str(), 0))
{
ircdproto->SendMode(bi, chan, "-b %s", mask);
entry_delete(chan->bans, ban);