[mod_auth] save letter-case diff in require config

(thx dirk4000)

Storing the config list into a data structure with case-insensitive keys
meant that if the config list contained multiple entries which differed
in case-only, then only one entry would survive.  Case-sensitivity of
username matters for HTTP Digest auth.  Store config list in value list.

x-ref:
  "mod_auth (configuration): Change of behavior in user name handling"
  https://redmine.lighttpd.net/boards/2/topics/10275
personal/stbuehler/tests-path
Glenn Strauss 2022-02-19 16:48:55 -05:00
parent 3ee5b84017
commit 8b29653131
2 changed files with 4 additions and 5 deletions

View File

@ -392,12 +392,12 @@ static int mod_auth_require_parse (http_auth_require_t * const require, const bu
case 4:
if (0 == memcmp(str, CONST_STR_LEN("user"))) {
/*("user=" is 5)*/
array_set_key_value(&require->user, str+5, len-5, CONST_STR_LEN(""));
array_insert_value(&require->user, str+5, len-5);
continue;
}
else if (0 == memcmp(str, CONST_STR_LEN("host"))) {
/*("host=" is 5)*/
array_set_key_value(&require->host, str+5, len-5, CONST_STR_LEN(""));
array_insert_value(&require->host, str+5, len-5);
log_error(errh, __FILE__, __LINE__,
"warning parsing auth.require 'require' field: "
"'host' not implemented; field value: %s", b->ptr);
@ -407,7 +407,7 @@ static int mod_auth_require_parse (http_auth_require_t * const require, const bu
case 5:
if (0 == memcmp(str, CONST_STR_LEN("group"))) {
/*("group=" is 6)*/
array_set_key_value(&require->group, str+6, len-6, CONST_STR_LEN(""));
array_insert_value(&require->group, str+6, len-6);
#if 0/*(supported by mod_authn_ldap, but not all other backends)*/
log_error(errh, __FILE__, __LINE__,
"warning parsing auth.require 'require' field: "

View File

@ -87,9 +87,8 @@ __attribute_pure__
static int http_auth_array_contains (const array * const a, const char * const k, const size_t klen)
{
for (size_t i = 0, used = a->used; i < used; ++i) {
if (buffer_is_equal_string(&a->data[i]->key, k, klen)) {
if (buffer_eq_slen(&((data_string *)a->data[i])->value, k, klen))
return 1;
}
}
return 0;
}