From: Ilia Alshanetsky Date: Tue, 7 Mar 2006 14:43:16 +0000 (+0000) Subject: Nuke safe_mode from sapi/* X-Git-Tag: RELEASE_1_3~502 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87c4a01b87608b7abc12c8258aad8b052b8c5a67;p=php Nuke safe_mode from sapi/* # only main/ remains at this point, this is the next step --- diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index 3fe6f0f0b3..24e68dd7a7 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -514,7 +514,7 @@ static void init_request_info(TSRMLS_D) SG(request_info).auth_password = NULL; SG(request_info).auth_digest = NULL; - if (authorization && (!PG(safe_mode) || (PG(safe_mode) && !auth_type(r)))) { + if (authorization) { char *p = getword(r->pool, &authorization, ' '); if (!strcasecmp(p, "Basic")) { tmp = uudecode(r->pool, authorization); diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index 854ea18401..ebc7902564 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -275,7 +275,7 @@ PHP_MINFO_FUNCTION(apache) env_arr = table_elts(r->headers_in); env = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { - if (env[i].key && (!PG(safe_mode) || (PG(safe_mode) && strncasecmp(env[i].key, "authorization", 13)))) { + if (env[i].key) { php_info_print_table_row(2, env[i].key, env[i].val); } } @@ -353,9 +353,7 @@ PHP_FUNCTION(apache_request_headers) env_arr = table_elts(((request_rec *) SG(server_context))->headers_in); tenv = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { - if (!tenv[i].key || - (PG(safe_mode) && - !strncasecmp(tenv[i].key, "authorization", 13))) { + if (!tenv[i].key) { continue; } if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) { @@ -541,11 +539,6 @@ PHP_FUNCTION(apache_get_modules) Reset the Apache write timer */ PHP_FUNCTION(apache_reset_timeout) { - if (PG(safe_mode)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot reset the Apache timeout in safe mode"); - RETURN_FALSE; - } - ap_reset_timeout((request_rec *)SG(server_context)); RETURN_TRUE; } diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 060a8fd685..ba3e50f362 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -406,13 +406,8 @@ static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx TSRMLS_DC) apr_table_unset(f->r->headers_out, "Last-Modified"); apr_table_unset(f->r->headers_out, "Expires"); apr_table_unset(f->r->headers_out, "ETag"); - if (!PG(safe_mode) || (PG(safe_mode) && !ap_auth_type(f->r))) { - auth = apr_table_get(f->r->headers_in, "Authorization"); - php_handle_auth_data(auth TSRMLS_CC); - } else { - SG(request_info).auth_user = NULL; - SG(request_info).auth_password = NULL; - } + auth = apr_table_get(f->r->headers_in, "Authorization"); + php_handle_auth_data(auth TSRMLS_CC); php_request_startup(TSRMLS_C); } diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index ce120f3544..9cf3766fd7 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -427,14 +427,9 @@ static int php_apache_request_ctor(request_rec *r, php_struct *ctx TSRMLS_DC) apr_table_unset(r->headers_out, "Last-Modified"); apr_table_unset(r->headers_out, "Expires"); apr_table_unset(r->headers_out, "ETag"); - 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); - ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user); - } else { - SG(request_info).auth_user = NULL; - SG(request_info).auth_password = NULL; - } + auth = apr_table_get(r->headers_in, "Authorization"); + php_handle_auth_data(auth TSRMLS_CC); + ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user); return php_request_startup(TSRMLS_C); } diff --git a/sapi/apache_hooks/php_apache.c b/sapi/apache_hooks/php_apache.c index aaeaa76d6c..0e9fc4d5f7 100644 --- a/sapi/apache_hooks/php_apache.c +++ b/sapi/apache_hooks/php_apache.c @@ -44,7 +44,7 @@ extern module **ap_loaded_modules; static int le_apachereq; static zend_class_entry *apacherequest_class_entry; -static void apache_table_to_zval(table *, int safe_mode, zval *return_value); +static void apache_table_to_zval(table *, zval *return_value); PHP_FUNCTION(virtual); PHP_FUNCTION(apache_request_headers); @@ -1682,7 +1682,7 @@ PHP_MINFO_FUNCTION(apache) env_arr = table_elts(r->headers_in); env = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { - if (env[i].key && (!PG(safe_mode) || (PG(safe_mode) && strncasecmp(env[i].key, "authorization", 13)))) { + if (env[i].key) { php_info_print_table_row(2, env[i].key, env[i].val); } } @@ -1746,9 +1746,9 @@ PHP_FUNCTION(virtual) /* }}} */ -/* {{{ apache_table_to_zval(table *, int safe_mode, zval *return_value) +/* {{{ apache_table_to_zval(table *, zval *return_value) Fetch all HTTP request headers */ -static void apache_table_to_zval(table *t, int safe_mode, zval *return_value) +static void apache_table_to_zval(table *t, zval *return_value) { array_header *env_arr; table_entry *tenv; @@ -1758,8 +1758,7 @@ static void apache_table_to_zval(table *t, int safe_mode, zval *return_value) env_arr = table_elts(t); tenv = (table_entry *)env_arr->elts; for (i = 0; i < env_arr->nelts; ++i) { - if (!tenv[i].key || - (safe_mode && !strncasecmp(tenv[i].key, "authorization", 13))) { + if (tenv[i].key) { continue; } if (add_assoc_string(return_value, tenv[i].key, (tenv[i].val==NULL) ? "" : tenv[i].val, 1)==FAILURE) { @@ -1780,7 +1779,7 @@ static void apache_table_to_zval(table *t, int safe_mode, zval *return_value) Fetch all HTTP request headers */ PHP_FUNCTION(apache_request_headers) { - apache_table_to_zval(((request_rec *)SG(server_context))->headers_in, PG(safe_mode), return_value); + apache_table_to_zval(((request_rec *)SG(server_context))->headers_in, return_value); } /* }}} */ diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index 811647f9a8..03d310e4d0 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -410,7 +410,7 @@ PHP_FUNCTION(nsapi_request_headers) for (i=0; i < rc->rq->headers->hsize; i++) { entry=rc->rq->headers->ht[i]; while (entry) { - if (!PG(safe_mode) || strncasecmp(entry->param->name, "authorization", 13)) { + if (strncasecmp(entry->param->name, "authorization", 13)) { add_assoc_string(return_value, entry->param->name, entry->param->value, 1); } entry=entry->next; @@ -602,7 +602,7 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D for (i=0; i < rc->rq->headers->hsize; i++) { entry=rc->rq->headers->ht[i]; while (entry) { - if (!PG(safe_mode) || strncasecmp(entry->param->name, "authorization", 13)) { + if (strncasecmp(entry->param->name, "authorization", 13)) { if (strcasecmp(entry->param->name, "content-length")==0 || strcasecmp(entry->param->name, "content-type")==0) { strlcpy(buf, entry->param->name, NS_BUF_SIZE); pos = 0; @@ -941,7 +941,7 @@ int NSAPI_PUBLIC php5_execute(pblock *pb, Session *sn, Request *rq) nsapi_php_ini_entries(NSLS_C TSRMLS_CC); - if (!PG(safe_mode)) php_handle_auth_data(pblock_findval("authorization", rq->headers) TSRMLS_CC); + php_handle_auth_data(pblock_findval("authorization", rq->headers) TSRMLS_CC); file_handle.type = ZEND_HANDLE_FILENAME; file_handle.filename = SG(request_info).path_translated;