diff options
author | Michael Stewart <vericgar@gentoo.org> | 2006-04-01 02:53:36 +0000 |
---|---|---|
committer | Michael Stewart <vericgar@gentoo.org> | 2006-04-01 02:53:36 +0000 |
commit | 578e846162776a5aee6987d58601192a2ab742f2 (patch) | |
tree | c76f20d082d93af4a668a2c60b575580a9478053 /2.0 | |
parent | fix patch name (diff) | |
download | apache-578e846162776a5aee6987d58601192a2ab742f2.tar.gz apache-578e846162776a5aee6987d58601192a2ab742f2.tar.bz2 apache-578e846162776a5aee6987d58601192a2ab742f2.zip |
Rewritten patch for AddDirectoryIndex that fixes the segfaults from bug 106808.
Diffstat (limited to '2.0')
-rw-r--r-- | 2.0/patches/07_all_mod_dir_incremental.patch | 140 |
1 files changed, 44 insertions, 96 deletions
diff --git a/2.0/patches/07_all_mod_dir_incremental.patch b/2.0/patches/07_all_mod_dir_incremental.patch index 5abd7f1..9cedc84 100644 --- a/2.0/patches/07_all_mod_dir_incremental.patch +++ b/2.0/patches/07_all_mod_dir_incremental.patch @@ -1,20 +1,22 @@ -diff -ur httpd-2.0.54.orig/modules/mappers/mod_dir.c httpd-2.0.54/modules/mappers/mod_dir.c ---- httpd-2.0.54.orig/modules/mappers/mod_dir.c 2005-02-04 12:21:18.000000000 -0800 -+++ httpd-2.0.54/modules/mappers/mod_dir.c 2005-09-17 16:29:52.000000000 -0700 +diff -ur httpd-2.0.55.orig/modules/mappers/mod_dir.c httpd-2.0.55/modules/mappers/mod_dir.c +--- httpd-2.0.55.orig/modules/mappers/mod_dir.c 2005-02-04 12:21:18.000000000 -0800 ++++ httpd-2.0.55/modules/mappers/mod_dir.c 2006-03-31 17:56:16.000000000 -0800 @@ -39,6 +39,7 @@ typedef struct dir_config_struct { apr_array_header_t *index_names; -+ apr_array_header_t *index_names_incr; ++ apr_array_header_t *index_names_incr; slash_cfg do_slash; } dir_config_rec; -@@ -55,6 +56,57 @@ +@@ -55,6 +56,17 @@ return NULL; } -+static const char *addincr_index(cmd_parms *cmd, dir_config_rec *d, const char *arg) ++static const char *add_index_incr(cmd_parms *cmd, void *dummy, const char *arg) +{ ++ dir_config_rec *d = dummy; ++ + if (!d->index_names_incr) { + d->index_names_incr = apr_array_make(cmd->pool, 2, sizeof(char *)); + } @@ -22,63 +24,19 @@ diff -ur httpd-2.0.54.orig/modules/mappers/mod_dir.c httpd-2.0.54/modules/mapper + return NULL; +} + -+static const char *rem_index(cmd_parms *cmd, dir_config_rec *d, const char *arg) -+{ -+ -+ apr_array_header_t *keep; -+ apr_array_header_t *keep_incr; -+ char **names_ptr; -+ int num_names; -+ -+ keep = apr_array_make(cmd->pool, 2, sizeof(char *)); -+ keep_incr = apr_array_make(cmd->pool, 2, sizeof(char *)); -+ -+ if (d->index_names) { -+ names_ptr = (char **)d->index_names->elts; -+ num_names = d->index_names->nelts; -+ -+ for (; num_names; ++names_ptr, --num_names) { -+ char *name_ptr = *names_ptr; -+ -+ if (strcmp(name_ptr, arg) != 0 ) { -+ *(char **)apr_array_push(keep) = name_ptr; -+ } -+ } -+ d->index_names = keep; -+ } -+ -+ if (d->index_names_incr) { -+ names_ptr = (char **)d->index_names_incr->elts; -+ num_names = d->index_names_incr->nelts; -+ -+ for (; num_names; ++names_ptr, --num_names) { -+ char *name_ptr = *names_ptr; -+ -+ if (strcmp(name_ptr, arg) != 0 ) { -+ *(char **)apr_array_push(keep_incr) = name_ptr; -+ } -+ } -+ d->index_names_incr = keep_incr; -+ } -+ -+ return NULL; -+} -+ static const char *configure_slash(cmd_parms *cmd, void *d_, int arg) { dir_config_rec *d = d_; -@@ -67,6 +119,10 @@ +@@ -67,6 +79,8 @@ { AP_INIT_ITERATE("DirectoryIndex", add_index, NULL, DIR_CMD_PERMS, "a list of file names"), -+ AP_INIT_ITERATE("AddDirectoryIndex", addincr_index, NULL, DIR_CMD_PERMS, -+ "a list of file names"), -+ AP_INIT_ITERATE("RemoveDirectoryIndex", rem_index, NULL, DIR_CMD_PERMS, ++ AP_INIT_ITERATE("AddDirectoryIndex", add_index_incr, NULL, DIR_CMD_PERMS, + "a list of file names"), AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, DIR_CMD_PERMS, "On or Off"), {NULL} -@@ -77,6 +133,7 @@ +@@ -77,6 +91,7 @@ dir_config_rec *new = apr_pcalloc(p, sizeof(dir_config_rec)); new->index_names = NULL; @@ -86,56 +44,46 @@ diff -ur httpd-2.0.54.orig/modules/mappers/mod_dir.c httpd-2.0.54/modules/mapper new->do_slash = SLASH_UNSET; return (void *) new; } -@@ -90,16 +147,17 @@ - new->index_names = add->index_names ? add->index_names : base->index_names; +@@ -87,7 +102,26 @@ + dir_config_rec *base = (dir_config_rec *)basev; + dir_config_rec *add = (dir_config_rec *)addv; + +- new->index_names = add->index_names ? add->index_names : base->index_names; ++ ++ if (add->index_names) { ++ new->index_names = add->index_names; ++ } else { ++ new->index_names = base->index_names; ++ if (base->index_names_incr) { ++ if (!new->index_names) { ++ new->index_names = apr_array_make(p, 2, sizeof(char *)); ++ } ++ apr_array_cat(new->index_names, base->index_names_incr); ++ } ++ } ++ ++ if (add->index_names_incr) { ++ if (!new->index_names) { ++ new->index_names = apr_array_make(p, 2, sizeof(char *)); ++ } ++ apr_array_cat(new->index_names, add->index_names_incr); ++ } ++ new->do_slash = (add->do_slash == SLASH_UNSET) ? base->do_slash : add->do_slash; -+ new->index_names_incr = apr_array_append(p, base->index_names, add->index_names); return new; - } - - static int fixup_dir(request_rec *r) - { - dir_config_rec *d; -- char *dummy_ptr[1]; - char **names_ptr; - int num_names; - int error_notfound = 0; -+ apr_array_header_t *index_names; - - /* only handle requests against directories */ - if (r->finfo.filetype != APR_DIR) { -@@ -155,16 +213,23 @@ +@@ -155,6 +189,14 @@ return DECLINED; } -- if (d->index_names) { -- names_ptr = (char **)d->index_names->elts; -- num_names = d->index_names->nelts; -- } -- else { -- dummy_ptr[0] = AP_DEFAULT_INDEX; -- names_ptr = dummy_ptr; -- num_names = 1; -- } -- -+ /* Merge index_names and index_names_incr */ -+ if (d->index_names) { -+ if (d->index_names_incr) { -+ index_names = apr_array_append(r->pool, d->index_names, d->index_names_incr); ++ if (d->index_names_incr) { ++ if (!d->index_names) { ++ d->index_names = d->index_names_incr; + } else { -+ index_names = d->index_names; ++ apr_array_cat(d->index_names, d->index_names_incr); + } -+ } else if (d->index_names_incr) { -+ index_names = d->index_names_incr; -+ } else { -+ index_names = apr_array_make(r->pool, 2, sizeof(char *)); -+ *(const char **)apr_array_push(index_names) = AP_DEFAULT_INDEX; + } + -+ names_ptr = (char **)index_names->elts; -+ num_names = index_names->nelts; -+ - for (; num_names; ++names_ptr, --num_names) { - /* XXX: Is this name_ptr considered escaped yet, or not??? */ - char *name_ptr = *names_ptr; + if (d->index_names) { + names_ptr = (char **)d->index_names->elts; + num_names = d->index_names->nelts; |