Changes with Apache 2.0.51
+ *) Recursive Include directives no longer crash. The server stops
+ including configuration files after a certain nesting level (128
+ as distributed). This is configurable at compile time using the
+ -DAP_MAX_INCLUDE_DEPTH switch. PR 28370. [André Malo]
+
*) mod_dir: the trailing-slash behaviour is now configurable using the
DirectorySlash directive. [André Malo]
APACHE 2.0 STATUS: -*-text-*-
-Last modified at [$Date: 2004/08/15 21:59:57 $]
+Last modified at [$Date: 2004/08/15 22:42:13 $]
Release:
server/config.c: r1.175
+1: nd
- *) detect Include directive recursion by counting the nesting level.
- PR 28370.
- server/core.c: r1.275
- os/netware/pre_nw.h: r1.7
- +1: nd, bnicholes, trawick
-
*) mod_headers: Regression from 1.3: There's no ErrorHeader directive.
Since this was always a misnomer, it was dropped in 2.1 and
Header was extended instead. Backport this from 2.1 and document
{
ap_directive_t *current = *conftree;
ap_directive_t *curr_parent = NULL;
- char l[MAX_STRING_LEN];
+ char *l = apr_palloc (temp_pool, MAX_STRING_LEN);
const char *errmsg;
if (current != NULL) {
#define AP_MIN_SENDFILE_BYTES (256)
+/* maximum include nesting level */
+#ifndef AP_MAX_INCLUDE_DEPTH
+#define AP_MAX_INCLUDE_DEPTH (128)
+#endif
+
APR_HOOK_STRUCT(
APR_HOOK_LINK(get_mgmt_items)
)
const char *name)
{
ap_directive_t *conftree = NULL;
- const char* conffile = ap_server_root_relative(cmd->pool, name);
+ const char* conffile;
+ unsigned *recursion;
+ void *data;
+
+ apr_pool_userdata_get(&data, "ap_include_sentinel", cmd->pool);
+ if (data) {
+ recursion = data;
+ }
+ else {
+ data = recursion = apr_palloc(cmd->pool, sizeof(*recursion));
+ *recursion = 0;
+ apr_pool_userdata_setn(data, "ap_include_sentinel", NULL, cmd->pool);
+ }
+ if (++*recursion > AP_MAX_INCLUDE_DEPTH) {
+ *recursion = 0;
+ return apr_psprintf(cmd->pool, "Exceeded maximum include depth of %u. "
+ "You have probably a recursion somewhere.",
+ AP_MAX_INCLUDE_DEPTH);
+ }
+
+ conffile = ap_server_root_relative(cmd->pool, name);
if (!conffile) {
+ *recursion = 0;
return apr_pstrcat(cmd->pool, "Invalid Include path ",
name, NULL);
}
ap_process_resource_config(cmd->server, conffile,
&conftree, cmd->pool, cmd->temp_pool);
*(ap_directive_t **)dummy = conftree;
+
+ /* recursion level done */
+ if (*recursion) {
+ --*recursion;
+ }
+
return NULL;
}