|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
#include "first.h"
|
|
|
|
|
|
|
|
|
|
#include "base.h"
|
|
|
|
|
#include "request.h"
|
|
|
|
|
#include "array.h"
|
|
|
|
|
#include "buffer.h"
|
|
|
|
|
#include "log.h"
|
|
|
|
@ -8,7 +8,6 @@
|
|
|
|
|
#include "plugin.h"
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
const array *access_allow;
|
|
|
|
@ -98,17 +97,18 @@ static handler_t mod_access_reject (request_st * const r, plugin_data * const p)
|
|
|
|
|
return HANDLER_FINISHED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int mod_access_check (const array *allow, const array *deny, const buffer *urlpath, const int lc) {
|
|
|
|
|
__attribute_pure__
|
|
|
|
|
static int mod_access_check (const array * const allow, const array * const deny, const buffer * const urlpath, const int lc) {
|
|
|
|
|
|
|
|
|
|
if (allow && allow->used) {
|
|
|
|
|
const buffer *match = (!lc)
|
|
|
|
|
const buffer * const match = (!lc)
|
|
|
|
|
? array_match_value_suffix(allow, urlpath)
|
|
|
|
|
: array_match_value_suffix_nc(allow, urlpath);
|
|
|
|
|
return (match != NULL); /* allowed if match; denied if none matched */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (deny && deny->used) {
|
|
|
|
|
const buffer *match = (!lc)
|
|
|
|
|
const buffer * const match = (!lc)
|
|
|
|
|
? array_match_value_suffix(deny, urlpath)
|
|
|
|
|
: array_match_value_suffix_nc(deny, urlpath);
|
|
|
|
|
return (match == NULL); /* deny if match; allow if none matched */
|
|
|
|
|