summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormanu <manu@unknown>2022-11-09 01:12:26 +0000
committermanu <manu@unknown>2022-11-09 01:12:26 +0000
commita677aeef1b0922863e87c9ec4453d06224a78133 (patch)
treeace52ac8b76d8ae4a9df0ce1089c1d291433706e /modules
parent693415b6b3f828c0d28d8c2413c63f93ef9863b6 (diff)
downloadhttpd-a677aeef1b0922863e87c9ec4453d06224a78133.tar.gz
Turn DavLockDiscovery into a flag
As requested on dev@httpd.apache.org, turn DavLockDiscovery into a Flag. Expressions can still be used by enclosing the directive by <If "expr">...</If> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1905170 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r--modules/dav/main/mod_dav.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c
index be63f3a5b7..f470d1fa9b 100644
--- a/modules/dav/main/mod_dav.c
+++ b/modules/dav/main/mod_dav.c
@@ -83,7 +83,7 @@ typedef struct {
const char *dir;
int locktimeout;
int allow_depthinfinity;
- ap_expr_info_t *allow_lockdiscovery;
+ int allow_lockdiscovery;
} dav_dir_conf;
@@ -160,6 +160,8 @@ static void *dav_create_dir_config(apr_pool_t *p, char *dir)
conf = (dav_dir_conf *)apr_pcalloc(p, sizeof(*conf));
+ conf->allow_lockdiscovery = DAV_ENABLED_ON;
+
/* clean up the directory to remove any trailing slash */
if (dir != NULL) {
char *d;
@@ -304,26 +306,17 @@ static const char *dav_cmd_davdepthinfinity(cmd_parms *cmd, void *config,
}
/*
- * Command handler for the DAVLockDiscovery directive, which is TAKE1.
+ * Command handler for the DAVLockDiscovery directive, which is FLAG.
*/
static const char *dav_cmd_davlockdiscovery(cmd_parms *cmd, void *config,
- const char *arg)
+ int arg)
{
dav_dir_conf *conf = (dav_dir_conf *)config;
- if (strncasecmp(arg, "expr=", 5) == 0) {
- const char *err;
- if ((arg[5] == '\0'))
- return "missing condition";
- conf->allow_lockdiscovery = ap_expr_parse_cmd(cmd, &arg[5],
- AP_EXPR_FLAG_DONT_VARY,
- &err, NULL);
- if (err)
- return err;
- } else {
- return "error in condition clause";
- }
-
+ if (arg)
+ conf->allow_lockdiscovery = DAV_ENABLED_ON;
+ else
+ conf->allow_lockdiscovery = DAV_ENABLED_OFF;
return NULL;
}
@@ -2098,18 +2091,8 @@ static dav_error * dav_propfind_walker(dav_walk_resource *wres, int calltype)
}
conf = ap_get_module_config(ctx->r->per_dir_config, &dav_module);
- if (conf && conf->allow_lockdiscovery) {
- const char *errstr = NULL;
- int eval = ap_expr_exec(ctx->r, conf->allow_lockdiscovery, &errstr);
- if (errstr) {
- ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(10403)
- "Failed to evaluate expression (%s) - ignoring",
- errstr);
- } else {
- if (!eval)
- flags |= DAV_PROPDB_DISABLE_LOCKDISCOVERY;
- }
- }
+ if (conf && conf->allow_lockdiscovery == DAV_ENABLED_OFF)
+ flags |= DAV_PROPDB_DISABLE_LOCKDISCOVERY;
/*
** Note: ctx->doc can only be NULL for DAV_PROPFIND_IS_ALLPROP. Since
@@ -5265,9 +5248,9 @@ static const command_rec dav_cmds[] =
"allow Depth infinity PROPFIND requests"),
/* per directory/location, or per server */
- AP_INIT_TAKE1("DAVLockDiscovery", dav_cmd_davlockdiscovery, NULL,
- ACCESS_CONF|RSRC_CONF,
- "allow lock discovery by PROPFIND requests"),
+ AP_INIT_FLAG("DAVLockDiscovery", dav_cmd_davlockdiscovery, NULL,
+ ACCESS_CONF|RSRC_CONF,
+ "allow lock discovery by PROPFIND requests"),
{ NULL }
};