mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-01 16:06:37 +02:00
- Redid glob matching. Escaping is now ripped out for normal bans (as it should be), this
means no longer weird issues with +b *\* etc not banning nicks with \ in it. ExtBan ~c/~r get special treatment and will use our match_esc [match with escaping] routine, that way you can ban channels such as "#f*ck" via "+b ~c:#f\*ck". Fix triggered by bugreport of vonitsanet (#0002782).
This commit is contained in:
+4
-3
@@ -60,9 +60,10 @@ NOTE: This is a Release Candidate. This is NOT an (official) STABLE release yet
|
||||
they forgot to recompile everything.
|
||||
- More modulizing: another 200 lines of code / 20 functions have been moved to modules.
|
||||
- Multiple allow channel::channel items are now permitted again
|
||||
- ExtBan ~c now can deal properly with channels with "?" and "*" in their name, such
|
||||
as "#*test*" which you can ban via: "+b ~c:#\*test\*" (though +b ~c:#*test* will work
|
||||
too but will match all channels with test in their name).
|
||||
- Redid glob matching. Escaping is now ripped out for normal bans (as it should be), this
|
||||
means no longer weird issues with +b *\* etc not banning nicks with \ in it.
|
||||
ExtBan ~c/~r get special treatment and will use our match_esc [match with escaping]
|
||||
routine, that way you can ban channels such as "#f*ck" via "+b ~c:#f\*ck".
|
||||
- Spamfilter: regexes and reasons are now more limited in size, this is to combat the
|
||||
"I set a spamfilter, but cannot remove it" problem. In practice this means - depending
|
||||
on the length of the spamfilter reason - that spamfilter will max ~300 characters.
|
||||
|
||||
@@ -1024,3 +1024,8 @@
|
||||
- Updated help.ru.conf (corrections by CS-Help / Bock)
|
||||
- Updated example.bg.conf (by Peace)
|
||||
- Added Dutch unreal32docs.nl.html, translated/maintained by Mark.
|
||||
- Redid glob matching. Escaping is now ripped out for normal bans (as it should be), this
|
||||
means no longer weird issues with +b *\* etc not banning nicks with \ in it.
|
||||
ExtBan ~c/~r get special treatment and will use our match_esc [match with escaping]
|
||||
routine, that way you can ban channels such as "#f*ck" via "+b ~c:#f\*ck".
|
||||
Fix triggered by bugreport of vonitsanet (#0002782).
|
||||
|
||||
@@ -773,3 +773,4 @@ extern void unrealdns_gethostbyname_link(char *name, ConfigItem_link *conf);
|
||||
extern void unrealdns_delasyncconnects(void);
|
||||
extern int is_autojoin_chan(char *chname);
|
||||
extern void unreal_free_hostent(struct hostent *he);
|
||||
extern int match_esc(const char *mask, const char *name);
|
||||
|
||||
+3
-2
@@ -230,7 +230,7 @@ char *p = ban+3, symbol = '\0';
|
||||
}
|
||||
for (lp = sptr->user->channel; lp; lp = lp->next)
|
||||
{
|
||||
if (!match(p, lp->chptr->chname))
|
||||
if (!match_esc(p, lp->chptr->chname))
|
||||
{
|
||||
/* Channel matched, check symbol if needed (+/%/@/etc) */
|
||||
if (symbol)
|
||||
@@ -323,10 +323,11 @@ static char retbuf[REALLEN + 8];
|
||||
mask[REALLEN + 3] = '\0';
|
||||
return retbuf;
|
||||
}
|
||||
|
||||
int extban_moder_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type)
|
||||
{
|
||||
char *ban = banin+3;
|
||||
if (!match(ban, sptr->info))
|
||||
if (!match_esc(ban, sptr->info))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+56
-16
@@ -45,7 +45,7 @@ u_char touppertab[], tolowertab[];
|
||||
#endif
|
||||
|
||||
|
||||
/* Internal ('real') match routine: match2().
|
||||
/* Match routine for special cases where escaping is needed in a normal fashion.
|
||||
* Checks a string ('name') against a globbing(+more) pattern ('mask').
|
||||
* Original by Douglas A Lewis (dalewis@acsu.buffalo.edu).
|
||||
* Code based on hybrid7's version (match_esc()).
|
||||
@@ -58,7 +58,7 @@ u_char touppertab[], tolowertab[];
|
||||
* - Support for '_'.
|
||||
* - Rip out support for '#'.
|
||||
*/
|
||||
static inline int match2(const char *mask, const char *name)
|
||||
int match_esc(const char *mask, const char *name)
|
||||
{
|
||||
const u_char *m = mask;
|
||||
const u_char *n = name;
|
||||
@@ -97,20 +97,8 @@ const u_char *na = name;
|
||||
if (*m != '?')
|
||||
{
|
||||
if (*m == '\\')
|
||||
{
|
||||
switch(m[1])
|
||||
{
|
||||
case '\0':
|
||||
return 1; /* unfinished escape sequence */
|
||||
case '*':
|
||||
case '?':
|
||||
m++; /* valid escape sequence: \* -> * and \? -> ? */
|
||||
break;
|
||||
default:
|
||||
/* Invalid, take it as literal */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!*++m)
|
||||
return 1; /* unfinished escape sequence */
|
||||
if ((lc(*m) != lc(*n)) && !((*m == '_') && (*n == ' ')))
|
||||
{
|
||||
if (!ma)
|
||||
@@ -131,6 +119,58 @@ const u_char *na = name;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Same credit/copyright as match_esc() applies, except escaping removed.. ;p */
|
||||
static inline int match2(const char *mask, const char *name)
|
||||
{
|
||||
const u_char *m = mask;
|
||||
const u_char *n = name;
|
||||
const u_char *ma = NULL;
|
||||
const u_char *na = name;
|
||||
|
||||
while(1)
|
||||
{
|
||||
if (*m == '*')
|
||||
{
|
||||
while (*m == '*') /* collapse.. */
|
||||
m++;
|
||||
ma = m;
|
||||
na = n;
|
||||
}
|
||||
|
||||
if (!*m)
|
||||
{
|
||||
if (!*n)
|
||||
return 0;
|
||||
if (!ma)
|
||||
return 1;
|
||||
for (m--; (m > (const u_char *)mask) && (*m == '?'); m--);
|
||||
if (*m == '*')
|
||||
return 0;
|
||||
m = ma;
|
||||
n = ++na;
|
||||
} else
|
||||
if (!*n)
|
||||
{
|
||||
while (*m == '*') /* collapse.. */
|
||||
m++;
|
||||
return (*m != 0);
|
||||
}
|
||||
|
||||
if ((lc(*m) != lc(*n)) && !((*m == '_') && (*n == ' ')))
|
||||
{
|
||||
if (!ma)
|
||||
return 1;
|
||||
m = ma;
|
||||
n = ++na;
|
||||
} else
|
||||
{
|
||||
m++;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* collapse a pattern string into minimal components.
|
||||
* This particular version is "in place", so that it changes the pattern
|
||||
|
||||
Reference in New Issue
Block a user