diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2023-04-21 00:08:44 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2023-05-03 23:11:35 -0400 |
commit | 58080f3382cebeadcbbef582e3a1470569e09365 (patch) | |
tree | 96c17ea03725d51d1ad387a312ab80d18b4280a4 | |
parent | 478d5d2f62923aa0438d4ac38e3d59c954d4591e (diff) | |
download | lighttpd-git-58080f3382cebeadcbbef582e3a1470569e09365.tar.gz |
[mod_auth] warn if auth.require path never matches
warn if auth.require path never matches due to an earlier, shorter path
-rw-r--r-- | src/mod_auth.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mod_auth.c b/src/mod_auth.c index 11cee1e1..d176fdbe 100644 --- a/src/mod_auth.c +++ b/src/mod_auth.c @@ -531,6 +531,18 @@ static handler_t mod_auth_require_parse_array(const array *value, array * const return HANDLER_ERROR; } + for (uint32_t o = 0; o < n; ++o) { + const buffer *k = &((data_array *)value->data[o])->key; + if (buffer_clen(&da_file->key) >= buffer_clen(k) + && 0 == strncmp(da_file->key.ptr, k->ptr, buffer_clen(k))) { + log_error(errh, __FILE__, __LINE__, + "auth.require path (\"%s\") will never match due to " + "earlier match (\"%s\"); fix by sorting longer paths " + "before shorter paths", da_file->key.ptr, k->ptr); + break; + } + } + if (require) { /*(always true at this point)*/ data_auth * const dauth = data_auth_init(); buffer_copy_buffer(&dauth->key, &da_file->key); |