summaryrefslogtreecommitdiff
path: root/sapi/apache2handler
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
committerSean Finney <seanius@debian.org>2009-04-10 14:09:48 +0200
commitcd0b49c72aee33b3e44a9c589fcd93b9e1c7a64f (patch)
tree1315c623bb7d9dfa8d366fa9cd2c6834ceeb5da5 /sapi/apache2handler
parent9ea47aab740772adf0c69d8c94b208a464e599ea (diff)
downloadphp-upstream/5.2.9.dfsg.1.tar.gz
Imported Upstream version 5.2.9.dfsg.1upstream/5.2.9.dfsg.1
Diffstat (limited to 'sapi/apache2handler')
-rw-r--r--sapi/apache2handler/apache_config.c32
-rw-r--r--sapi/apache2handler/mod_php5.c4
-rw-r--r--sapi/apache2handler/php_apache.h4
-rw-r--r--sapi/apache2handler/php_functions.c4
-rw-r--r--sapi/apache2handler/sapi_apache2.c7
5 files changed, 37 insertions, 14 deletions
diff --git a/sapi/apache2handler/apache_config.c b/sapi/apache2handler/apache_config.c
index c3e040b7f..1e961083d 100644
--- a/sapi/apache2handler/apache_config.c
+++ b/sapi/apache2handler/apache_config.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apache_config.c,v 1.7.2.1.2.5 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: apache_config.c,v 1.7.2.1.2.7 2008/12/31 11:17:48 sebastian Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -117,6 +117,23 @@ static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const ch
return NULL;
}
+static zend_bool should_overwrite_per_dir_entry(HashTable *target_ht, php_dir_entry *new_per_dir_entry, zend_hash_key *hash_key, void *pData)
+{
+ php_dir_entry *orig_per_dir_entry;
+
+ if (zend_hash_find(target_ht, hash_key->arKey, hash_key->nKeyLength, (void **) &orig_per_dir_entry)==FAILURE) {
+ return 1; /* does not exist in dest, copy from source */
+ }
+
+ if (new_per_dir_entry->status >= orig_per_dir_entry->status) {
+ /* use new entry */
+ phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", hash_key->arKey, new_per_dir_entry->status, orig_per_dir_entry->status));
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
{
@@ -128,9 +145,12 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
ulong num_index;
n = create_php_config(p, "merge_php_config");
- zend_hash_copy(&n->config, &e->config, NULL, NULL, sizeof(php_dir_entry));
-
+ /* copy old config */
+ zend_hash_copy(&n->config, &d->config, NULL, NULL, sizeof(php_dir_entry));
+ /* merge new config */
phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)\n", base_conf, new_conf, n));
+ zend_hash_merge_ex(&n->config, &e->config, NULL, sizeof(php_dir_entry), (merge_checker_func_t) should_overwrite_per_dir_entry, NULL);
+#if STAS_0
for (zend_hash_internal_pointer_reset(&d->config);
zend_hash_get_current_key_ex(&d->config, &str, &str_len,
&num_index, 0, NULL) == HASH_KEY_IS_STRING;
@@ -140,10 +160,10 @@ void *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf)
if (zend_hash_find(&n->config, str, str_len, (void **) &pe) == SUCCESS) {
if (pe->status >= data->status) continue;
}
- zend_hash_update(&n->config, str, str_len, data, sizeof(*data), NULL);
phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)\n", str, data->status, pe?pe->status:-1));
+ zend_hash_update(&n->config, str, str_len, data, sizeof(*data), NULL);
}
-
+#endif
return n;
}
diff --git a/sapi/apache2handler/mod_php5.c b/sapi/apache2handler/mod_php5.c
index e9b66da21..0a3ed7a22 100644
--- a/sapi/apache2handler/mod_php5.c
+++ b/sapi/apache2handler/mod_php5.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php5.c,v 1.5.2.1.2.2 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: mod_php5.c,v 1.5.2.1.2.3 2008/12/31 11:17:48 sebastian Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
diff --git a/sapi/apache2handler/php_apache.h b/sapi/apache2handler/php_apache.h
index 8ad66500c..c1c9474a6 100644
--- a/sapi/apache2handler/php_apache.h
+++ b/sapi/apache2handler/php_apache.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_apache.h,v 1.8.2.1.2.3 2007/12/31 07:20:15 sebastian Exp $ */
+/* $Id: php_apache.h,v 1.8.2.1.2.4 2008/12/31 11:17:48 sebastian Exp $ */
#ifndef PHP_APACHE_H
#define PHP_APACHE_H
diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c
index 034051e40..7db52a5b7 100644
--- a/sapi/apache2handler/php_functions.c
+++ b/sapi/apache2handler/php_functions.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_functions.c,v 1.18.2.6.2.6 2007/12/31 07:20:16 sebastian Exp $ */
+/* $Id: php_functions.c,v 1.18.2.6.2.7 2008/12/31 11:17:48 sebastian Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index 5fa6cdf75..c7733b443 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2008 The PHP Group |
+ | Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sapi_apache2.c,v 1.57.2.10.2.17 2008/01/16 15:50:37 iliaa Exp $ */
+/* $Id: sapi_apache2.c,v 1.57.2.10.2.19 2008/12/31 11:17:48 sebastian Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -456,6 +456,9 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC)
if (!PG(safe_mode) || (PG(safe_mode) && !ap_auth_type(r))) {
auth = apr_table_get(r->headers_in, "Authorization");
php_handle_auth_data(auth TSRMLS_CC);
+ if (SG(request_info).auth_user == NULL && r->user) {
+ SG(request_info).auth_user = estrdup(r->user);
+ }
ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user);
} else {
SG(request_info).auth_user = NULL;