mirror of
https://github.com/pissnet/pissircd.git
synced 2025-08-17 23:51:53 +01:00
Support single quotes in spamfilter::rule, for like xyz('bla/bla')
This commit is contained in:
parent
d5e8e8f324
commit
36fc839022
1 changed files with 14 additions and 2 deletions
16
src/crule.c
16
src/crule.c
|
@ -444,7 +444,7 @@ static int crule_gettoken(crule_token *next_tokp, const char **ruleptr)
|
|||
break;
|
||||
default:
|
||||
if ((isalnum(*(--(*ruleptr)))) || (**ruleptr == '*') ||
|
||||
(**ruleptr == '?') || (**ruleptr == '.') || (**ruleptr == '-') || (**ruleptr == '_'))
|
||||
(**ruleptr == '?') || (**ruleptr == '.') || (**ruleptr == '-') || (**ruleptr == '_') || (**ruleptr == '\''))
|
||||
*next_tokp = CR_WORD;
|
||||
else
|
||||
return CR_UNKNWTOK;
|
||||
|
@ -462,18 +462,30 @@ static int crule_gettoken(crule_token *next_tokp, const char **ruleptr)
|
|||
static void crule_getword(char *word, int *wordlenp, size_t maxlen, const char **ruleptr)
|
||||
{
|
||||
char *word_ptr;
|
||||
char quoted = 0;
|
||||
|
||||
word_ptr = word;
|
||||
|
||||
if (**ruleptr == '\'')
|
||||
{
|
||||
*(*ruleptr)++;
|
||||
quoted = 1;
|
||||
}
|
||||
|
||||
while ((size_t)(word_ptr - word) < maxlen
|
||||
&& (isalnum(**ruleptr)
|
||||
|| **ruleptr == '*' || **ruleptr == '?'
|
||||
|| **ruleptr == '.' || **ruleptr == '-'
|
||||
|| **ruleptr == '_'))
|
||||
|| **ruleptr == '_' || (quoted && (**ruleptr != '\''))))
|
||||
{
|
||||
*word_ptr++ = *(*ruleptr)++;
|
||||
}
|
||||
*word_ptr = '\0';
|
||||
*wordlenp = word_ptr - word;
|
||||
|
||||
/* Eat the remaining ' quote, if needed... */
|
||||
if (quoted && (**ruleptr == '\''))
|
||||
*(*ruleptr)++;;
|
||||
}
|
||||
|
||||
/** Parse an entire rule.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue