summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorStefan Fritsch <sf@sfritsch.de>2012-04-15 19:45:13 +0200
committerStefan Fritsch <sf@sfritsch.de>2012-04-15 19:45:13 +0200
commit8f9c15530d0bc387af114619b3ff3f930eb23d3c (patch)
treef1d28a9206f9e18ed11c9d2bf302f0fb924b79c0 /server
parent212cb6c2dcb419aaa6c848406136ec05e98c8632 (diff)
downloadapache2-8f9c15530d0bc387af114619b3ff3f930eb23d3c.tar.gz
Import httpd-2.4.2.tar.bz2upstream/2.4.2
Diffstat (limited to 'server')
-rw-r--r--server/config.c20
-rw-r--r--server/core.c61
-rw-r--r--server/listen.c12
-rw-r--r--server/mpm_common.c22
-rw-r--r--server/mpm_unix.c24
-rw-r--r--server/request.c9
-rw-r--r--server/scoreboard.c5
-rw-r--r--server/util.c6
-rw-r--r--server/util_script.c5
9 files changed, 112 insertions, 52 deletions
diff --git a/server/config.c b/server/config.c
index 96ab9c9d..75857046 100644
--- a/server/config.c
+++ b/server/config.c
@@ -59,6 +59,7 @@
AP_DECLARE_DATA const char *ap_server_argv0 = NULL;
AP_DECLARE_DATA const char *ap_server_root = NULL;
+AP_DECLARE_DATA const char *ap_runtime_dir = NULL;
AP_DECLARE_DATA server_rec *ap_server_conf = NULL;
AP_DECLARE_DATA apr_pool_t *ap_pglobal = NULL;
@@ -1560,6 +1561,25 @@ AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *file)
}
}
+AP_DECLARE(char *) ap_runtime_dir_relative(apr_pool_t *p, const char *file)
+{
+ char *newpath = NULL;
+ apr_status_t rv;
+ const char *runtime_dir = ap_runtime_dir ? ap_runtime_dir : ap_server_root_relative(p, DEFAULT_REL_RUNTIMEDIR);
+
+ rv = apr_filepath_merge(&newpath, runtime_dir, file,
+ APR_FILEPATH_TRUENAME, p);
+ if (newpath && (rv == APR_SUCCESS || APR_STATUS_IS_EPATHWILD(rv)
+ || APR_STATUS_IS_ENOENT(rv)
+ || APR_STATUS_IS_ENOTDIR(rv))) {
+ return newpath;
+ }
+ else {
+ return NULL;
+ }
+}
+
+
AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive)
{
struct ap_varbuf vb;
diff --git a/server/core.c b/server/core.c
index e96eaa3c..541f6e8e 100644
--- a/server/core.c
+++ b/server/core.c
@@ -247,7 +247,7 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
conf->override_opts = new->override_opts;
}
- if (conf->override_list == NULL) {
+ if (new->override_list != NULL) {
conf->override_list = new->override_list;
}
@@ -274,7 +274,7 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
conf->hostname_lookups = new->hostname_lookups;
}
- if (new->content_md5 == AP_CONTENT_MD5_UNSET) {
+ if (new->content_md5 != AP_CONTENT_MD5_UNSET) {
conf->content_md5 = new->content_md5;
}
@@ -314,8 +314,6 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv)
if (new->limit_xml_body != AP_LIMIT_UNSET)
conf->limit_xml_body = new->limit_xml_body;
- else
- conf->limit_xml_body = base->limit_xml_body;
if (!conf->sec_file) {
conf->sec_file = new->sec_file;
@@ -1661,28 +1659,45 @@ static const char *set_override_list(cmd_parms *cmd, void *d_, int argc, char *c
/* Throw a warning if we're in <Location> or <Files> */
if (ap_check_cmd_context(cmd, NOT_IN_LOCATION | NOT_IN_FILES)) {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00115)
- "Useless use of AllowOverrideList in line %d of %s.",
- cmd->directive->line_num, cmd->directive->filename);
+ "Useless use of AllowOverrideList at %s:%d",
+ cmd->directive->filename, cmd->directive->line_num);
}
if ((err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS)) != NULL)
return err;
- d->override_list = apr_table_make(cmd->pool, 1);
+ d->override_list = apr_table_make(cmd->pool, argc);
for (i=0;i<argc;i++){
if (!strcasecmp(argv[i], "None")) {
+ if (argc != 1) {
+ return "'None' not allowed with other directives in "
+ "AllowOverrideList";
+ }
return NULL;
}
else {
const command_rec *result = NULL;
module *mod = ap_top_module;
result = ap_find_command_in_modules(argv[i], &mod);
- if (result)
+ if (result == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
+ APLOGNO(00116) "Discarding unrecognized "
+ "directive `%s' in AllowOverrideList at %s:%d",
+ argv[i], cmd->directive->filename,
+ cmd->directive->line_num);
+ continue;
+ }
+ else if ((result->req_override & (OR_ALL|ACCESS_CONF)) == 0) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
+ APLOGNO(02304) "Discarding directive `%s' not "
+ "allowed in AllowOverrideList at %s:%d",
+ argv[i], cmd->directive->filename,
+ cmd->directive->line_num);
+ continue;
+ }
+ else {
apr_table_set(d->override_list, argv[i], "1");
- else
- ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(00116)
- "Discarding unrecognized directive `%s' in AllowOverrideList.",
- argv[i]);
+ }
}
}
@@ -2775,6 +2790,24 @@ static const char *set_server_root(cmd_parms *cmd, void *dummy,
return NULL;
}
+static const char *set_runtime_dir(cmd_parms *cmd, void *dummy, const char *arg)
+{
+ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
+
+ if (err != NULL) {
+ return err;
+ }
+
+ if ((apr_filepath_merge((char**)&ap_runtime_dir, NULL,
+ ap_server_root_relative(cmd->pool, arg),
+ APR_FILEPATH_TRUENAME, cmd->pool) != APR_SUCCESS)
+ || !ap_is_directory(cmd->temp_pool, ap_runtime_dir)) {
+ return "DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot";
+ }
+
+ return NULL;
+}
+
static const char *set_timeout(cmd_parms *cmd, void *dummy, const char *arg)
{
const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
@@ -3928,6 +3961,8 @@ AP_INIT_TAKE1("ServerSignature", set_signature_flag, NULL, OR_ALL,
"En-/disable server signature (on|off|email)"),
AP_INIT_TAKE1("ServerRoot", set_server_root, NULL, RSRC_CONF | EXEC_ON_READ,
"Common directory of server-related files (logs, confs, etc.)"),
+AP_INIT_TAKE1("DefaultRuntimeDir", set_runtime_dir, NULL, RSRC_CONF | EXEC_ON_READ,
+ "Common directory for run-time files (shared memory, locks, etc.)"),
AP_INIT_TAKE1("ErrorLog", set_server_string_slot,
(void *)APR_OFFSETOF(server_rec, error_fname), RSRC_CONF,
"The filename of the error log"),
@@ -4059,7 +4094,7 @@ AP_INIT_TAKE1("MaxConnectionsPerChild", ap_mpm_set_max_requests, NULL, RSRC_CONF
AP_INIT_TAKE1("CoreDumpDirectory", ap_mpm_set_coredumpdir, NULL, RSRC_CONF,
"The location of the directory Apache changes to before dumping core"),
AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL, RSRC_CONF,
- "Maximum number of 1k blocks a particular childs allocator may hold."),
+ "Maximum number of 1k blocks a particular child's allocator may hold."),
AP_INIT_TAKE1("ThreadStackSize", ap_mpm_set_thread_stacksize, NULL, RSRC_CONF,
"Size in bytes of stack used by threads handling client connections"),
#if AP_ENABLE_EXCEPTION_HOOK
diff --git a/server/listen.c b/server/listen.c
index a4935aaa..a85095d4 100644
--- a/server/listen.c
+++ b/server/listen.c
@@ -238,7 +238,7 @@ static apr_status_t close_listeners_on_exec(void *v)
static const char *alloc_listener(process_rec *process, char *addr,
apr_port_t port, const char* proto,
- void *dummy)
+ void *slave)
{
ap_listen_rec **walk, *last;
apr_status_t status;
@@ -273,7 +273,7 @@ static const char *alloc_listener(process_rec *process, char *addr,
}
if (found_listener) {
- if (ap_listeners->slave != dummy) {
+ if (ap_listeners->slave != slave) {
return "Cannot define a slave on the same IP:port as a Listener";
}
return NULL;
@@ -333,7 +333,7 @@ static const char *alloc_listener(process_rec *process, char *addr,
last->next = new;
last = new;
}
- new->slave = dummy;
+ new->slave = slave;
}
return NULL;
@@ -612,10 +612,6 @@ AP_DECLARE(void) ap_listen_pre_config(void)
ap_listenbacklog = DEFAULT_LISTENBACKLOG;
}
-/* Hack: populate an extra field
- * When this gets called from a Listen directive, dummy is null.
- * So we can use non-null dummy to pass a data pointer without conflict
- */
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
int argc, char *const argv[])
{
@@ -662,7 +658,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
ap_str_tolower(proto);
}
- return alloc_listener(cmd->server->process, host, port, proto, dummy);
+ return alloc_listener(cmd->server->process, host, port, proto, NULL);
}
AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd,
diff --git a/server/mpm_common.c b/server/mpm_common.c
index 0cd65e5c..4448ec60 100644
--- a/server/mpm_common.c
+++ b/server/mpm_common.c
@@ -139,13 +139,13 @@ static struct mpm_gen_info_head_t *geninfo, *unused_geninfo;
static int gen_head_init; /* yuck */
/* variables representing config directives implemented here */
-const char *ap_pid_fname;
-int ap_max_requests_per_child;
-char ap_coredump_dir[MAX_STRING_LEN];
-int ap_coredumpdir_configured;
-int ap_graceful_shutdown_timeout;
+AP_DECLARE_DATA const char *ap_pid_fname;
+AP_DECLARE_DATA int ap_max_requests_per_child;
+AP_DECLARE_DATA char ap_coredump_dir[MAX_STRING_LEN];
+AP_DECLARE_DATA int ap_coredumpdir_configured;
+AP_DECLARE_DATA int ap_graceful_shutdown_timeout;
AP_DECLARE_DATA apr_uint32_t ap_max_mem_free;
-apr_size_t ap_thread_stacksize;
+AP_DECLARE_DATA apr_size_t ap_thread_stacksize;
#define ALLOCATOR_MAX_FREE_DEFAULT (2048*1024)
@@ -170,8 +170,9 @@ void mpm_common_pre_config(apr_pool_t *pconf)
#endif
static int wait_or_timeout_counter;
-void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret,
- apr_pool_t *p, server_rec *s)
+AP_DECLARE(void) ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode,
+ apr_proc_t *ret, apr_pool_t *p,
+ server_rec *s)
{
apr_status_t rv;
@@ -356,8 +357,9 @@ const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
return NULL;
}
-const char * ap_mpm_set_graceful_shutdown(cmd_parms *cmd, void *dummy,
- const char *arg)
+AP_DECLARE(const char *)ap_mpm_set_graceful_shutdown(cmd_parms *cmd,
+ void *dummy,
+ const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
diff --git a/server/mpm_unix.c b/server/mpm_unix.c
index 6b1d6ee1..87df8f57 100644
--- a/server/mpm_unix.c
+++ b/server/mpm_unix.c
@@ -73,7 +73,7 @@ typedef struct extra_process_t {
static extra_process_t *extras;
-void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen)
+AP_DECLARE(void) ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen)
{
extra_process_t *p = (extra_process_t *)ap_malloc(sizeof(extra_process_t));
@@ -83,7 +83,7 @@ void ap_register_extra_mpm_process(pid_t pid, ap_generation_t gen)
extras = p;
}
-int ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *gen)
+AP_DECLARE(int) ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *old_gen)
{
extra_process_t *cur = extras;
extra_process_t *prev = NULL;
@@ -100,7 +100,7 @@ int ap_unregister_extra_mpm_process(pid_t pid, ap_generation_t *gen)
else {
extras = cur->next;
}
- *gen = cur->gen;
+ *old_gen = cur->gen;
free(cur);
return 1; /* found */
}
@@ -173,8 +173,8 @@ static int reclaim_one_pid(pid_t pid, action_t action)
return 0;
}
-void ap_reclaim_child_processes(int terminate,
- ap_reclaim_callback_fn_t *mpm_callback)
+AP_DECLARE(void) ap_reclaim_child_processes(int terminate,
+ ap_reclaim_callback_fn_t *mpm_callback)
{
apr_time_t waittime = 1024 * 16;
int i;
@@ -270,7 +270,7 @@ void ap_reclaim_child_processes(int terminate,
action_table[cur_action].action != GIVEUP);
}
-void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback)
+AP_DECLARE(void) ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback)
{
int i;
extra_process_t *cur_extra;
@@ -313,7 +313,7 @@ void ap_relieve_child_processes(ap_reclaim_callback_fn_t *mpm_callback)
* the pid is a member of the current process group; either using
* apr_proc_wait(), where waitpid() guarantees to fail for non-child
* processes; or by using getpgid() directly, if available. */
-apr_status_t ap_mpm_safe_kill(pid_t pid, int sig)
+AP_DECLARE(apr_status_t) ap_mpm_safe_kill(pid_t pid, int sig)
{
#ifndef HAVE_GETPGID
apr_proc_t proc;
@@ -368,7 +368,8 @@ apr_status_t ap_mpm_safe_kill(pid_t pid, int sig)
}
-int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status)
+AP_DECLARE(int) ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why,
+ int status)
{
int signum = status;
const char *sigdesc;
@@ -569,6 +570,8 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
ap_log_error(APLOG_MARK, log_level, rv, ap_server_conf, APLOGNO(00056)
"connect to listener on %pI", lp->bind_addr);
+ apr_pool_destroy(p);
+ return rv;
}
/* Create the request string. We include a User-Agent so that
@@ -867,13 +870,14 @@ static void sig_coredump(int sig)
*/
}
-apr_status_t ap_fatal_signal_child_setup(server_rec *s)
+AP_DECLARE(apr_status_t) ap_fatal_signal_child_setup(server_rec *s)
{
my_pid = getpid();
return APR_SUCCESS;
}
-apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *in_pconf)
+AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s,
+ apr_pool_t *in_pconf)
{
#ifndef NO_USE_SIGACTION
struct sigaction sa;
diff --git a/server/request.c b/server/request.c
index 37cffdde..c2fdd89e 100644
--- a/server/request.c
+++ b/server/request.c
@@ -1094,9 +1094,9 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r)
}
else if (APR_STATUS_IS_EACCES(rv)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00035)
- "access to %s denied because search "
- "permissions are missing on a component "
- "of the path", r->uri);
+ "access to %s denied (filesystem path '%s') "
+ "because search permissions are missing on a "
+ "component of the path", r->uri, r->filename);
return r->status = HTTP_FORBIDDEN;
}
else if ((rv != APR_SUCCESS && rv != APR_INCOMPLETE)
@@ -1105,7 +1105,8 @@ AP_DECLARE(int) ap_directory_walk(request_rec *r)
* rather than assume not found.
*/
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(00036)
- "access to %s failed", r->uri);
+ "access to %s failed (filesystem path '%s')",
+ r->uri, r->filename);
return r->status = HTTP_FORBIDDEN;
}
diff --git a/server/scoreboard.c b/server/scoreboard.c
index 42019955..344dc5ae 100644
--- a/server/scoreboard.c
+++ b/server/scoreboard.c
@@ -143,7 +143,7 @@ AP_DECLARE(int) ap_calc_scoreboard_size(void)
return scoreboard_size;
}
-void ap_init_scoreboard(void *shared_score)
+AP_DECLARE(void) ap_init_scoreboard(void *shared_score)
{
char *more_storage;
int i;
@@ -251,7 +251,8 @@ static apr_status_t open_scoreboard(apr_pool_t *pconf)
/* If detach is non-zero, this is a separate child process,
* if zero, it is a forked child.
*/
-apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached)
+AP_DECLARE(apr_status_t) ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm,
+ int detached)
{
#if APR_HAS_SHARED_MEMORY
if (!detached) {
diff --git a/server/util.c b/server/util.c
index 3c38fa90..177f3780 100644
--- a/server/util.c
+++ b/server/util.c
@@ -437,15 +437,13 @@ static apr_status_t regsub_core(apr_pool_t *p, char **result,
src = input;
while ((c = *src++) != '\0') {
- if (c == '&')
- no = 0;
- else if (c == '$' && apr_isdigit(*src))
+ if (c == '$' && apr_isdigit(*src))
no = *src++ - '0';
else
no = AP_MAX_REG_MATCH;
if (no >= AP_MAX_REG_MATCH) { /* Ordinary character. */
- if (c == '\\' && (*src == '$' || *src == '&'))
+ if (c == '\\' && *src)
c = *src++;
*dst++ = c;
}
diff --git a/server/util_script.c b/server/util_script.c
index 3f7d847a..18c4aea4 100644
--- a/server/util_script.c
+++ b/server/util_script.c
@@ -682,6 +682,7 @@ static int getsfunc_BRIGADE(char *buf, int len, void *arg)
rv = apr_bucket_read(e, &bucket_data, &bucket_data_len,
APR_BLOCK_READ);
if (rv != APR_SUCCESS || (bucket_data_len == 0)) {
+ *dst = '\0';
return APR_STATUS_IS_TIMEUP(rv) ? -1 : 0;
}
src = bucket_data;
@@ -738,8 +739,10 @@ static int getsfunc_STRING(char *w, int len, void *pvastrs)
const char *p;
int t;
- if (!strs->curpos || !*strs->curpos)
+ if (!strs->curpos || !*strs->curpos) {
+ w[0] = '\0';
return 0;
+ }
p = ap_strchr_c(strs->curpos, '\n');
if (p)
++p;