extensions/extb_extgecos: Fix breakage
This commit returns $x's old behavior as long as the mask does not contain a #, otherwise it uses the new behavior that supports CIDR notation. This fixes `$x:*badword*` not matching realnames containing "badword".
This commit is contained in:
parent
309e1e624e
commit
0ca18d072a
1 changed files with 10 additions and 6 deletions
|
@ -47,10 +47,10 @@ static int eb_extended(const char *data, struct Client *client_p,
|
||||||
*/
|
*/
|
||||||
return EXTBAN_INVALID;
|
return EXTBAN_INVALID;
|
||||||
|
|
||||||
if (idx != NULL)
|
|
||||||
{
|
|
||||||
char buf[BUFSIZE];
|
char buf[BUFSIZE];
|
||||||
|
|
||||||
|
if (idx != NULL)
|
||||||
|
{
|
||||||
// Copy the nick!user@host part of the ban
|
// Copy the nick!user@host part of the ban
|
||||||
memcpy(buf, data, (idx - data));
|
memcpy(buf, data, (idx - data));
|
||||||
buf[(idx - data)] = '\0';
|
buf[(idx - data)] = '\0';
|
||||||
|
@ -60,12 +60,16 @@ static int eb_extended(const char *data, struct Client *client_p,
|
||||||
|
|
||||||
if (client_matches_mask(client_p, buf) && match(idx, client_p->info))
|
if (client_matches_mask(client_p, buf) && match(idx, client_p->info))
|
||||||
return EXTBAN_MATCH;
|
return EXTBAN_MATCH;
|
||||||
|
|
||||||
return EXTBAN_NOMATCH;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Treat data as a pattern to match against the full nick!user@host#gecos.
|
||||||
|
snprintf(buf, sizeof buf, "%s!%s@%s#%s",
|
||||||
|
client_p->name, client_p->username, client_p->host, client_p->info);
|
||||||
|
|
||||||
if (client_matches_mask(client_p, data))
|
if (match(data, buf))
|
||||||
return EXTBAN_MATCH;
|
return EXTBAN_MATCH;
|
||||||
|
}
|
||||||
|
|
||||||
return EXTBAN_NOMATCH;
|
return EXTBAN_NOMATCH;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue