Skip to content
Snippets Groups Projects
Commit 0999c475 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Fixed various case-sensitivily-related issues.

parent 30c8cf2e
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,6 @@
#define IS_DIGIT(c) ( c >= '0' && c <= '9' )
#define DIGIT_VAL(c) ( c - '0' )
#define IS_ALPHA(c) ( (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') )
#define IS_QUANTIFIER(c) (c == 'K' || c == 'M' || c =='G')
/*
* Forward declarations
......@@ -466,14 +465,17 @@ static bool sieve_lexer_scan_raw_token(struct sieve_lexer *lexer)
}
switch ( sieve_lexer_curchar(lexer) ) {
case 'k':
case 'K': /* Kilo */
value *= 1024;
sieve_lexer_shift(lexer);
break;
break;
case 'm':
case 'M': /* Mega */
value *= 1024*1024;
sieve_lexer_shift(lexer);
break;
case 'g':
case 'G': /* Giga */
value *= 1024*1024*1024;
sieve_lexer_shift(lexer);
......
......@@ -121,7 +121,7 @@ struct sieve_validator *sieve_validator_create
/* Setup command registry */
validator->commands = hash_create
(default_pool, pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
(default_pool, pool, 0, strcase_hash, (hash_cmp_callback_t *)strcasecmp);
sieve_validator_register_core_commands(validator);
sieve_validator_register_core_tests(validator);
......@@ -990,7 +990,7 @@ const struct sieve_object *sieve_validator_object_registry_find
for ( i = 0; i < array_count(&regs->registrations); i++ ) {
const struct sieve_object * const *obj = array_idx(&regs->registrations, i);
if ( strcmp((*obj)->identifier, identifier) == 0)
if ( strcasecmp((*obj)->identifier, identifier) == 0)
return *obj;
}
......
# Commands must be case-insensitive
keep;
Keep;
KEEP;
discard;
stop;
DisCaRD;
# Tags must be case-insensitive
if size :UNDER 34 {
}
if header :Is "from" "tukker@rename-it.n" {
}
# Numbers must be case-insensitive
if anyof( size :UNDER 34m, size :oVeR 50M ) {
}
......@@ -18,7 +18,7 @@ test "Invalid set command invocations (FIXME: count only)" {
test_fail "compile should have failed";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "5" {
if not test_error :count "eq" :comparator "i;ascii-numeric" "6" {
test_fail "wrong number of errors reported";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.