From: Andi Gutmans Date: Sun, 19 Feb 2006 03:07:39 +0000 (+0000) Subject: - More safe_mode nuking X-Git-Tag: RELEASE_1_2~175 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac1e7362b3ea6ab3d021863fea901613fd26fb94;p=php - More safe_mode nuking --- diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 032c4a85f3..66d2379630 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1281,7 +1281,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu * use since curl needs a long not an int. */ if (*postval == '@') { ++postval; - /* safe_mode / open_basedir check */ + /* open_basedir check */ if (php_check_open_basedir(postval TSRMLS_CC)) { RETURN_FALSE; } diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 40f4a70caa..a07c50cd24 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -179,17 +179,6 @@ static void php_csr_free(zend_rsrc_list_entry *rsrc TSRMLS_DC) } /* }}} */ -/* {{{ openssl open_basedir checks */ -inline static int php_openssl_safe_mode_chk(char *filename TSRMLS_DC) -{ - if (php_check_open_basedir(filename TSRMLS_CC)) { - return -1; - } - - return 0; -} -/* }}} */ - /* {{{ openssl -> PHP "bridging" */ /* true global; readonly after module startup */ static char default_ssl_conf_filename[MAXPATHLEN]; @@ -439,7 +428,7 @@ static int php_openssl_parse_config( /* read in the oids */ str = CONF_get_string(req->req_config, NULL, "oid_file"); - if (str && !php_openssl_safe_mode_chk(str TSRMLS_CC)) { + if (str && !php_check_open_basedir(str TSRMLS_CC)) { BIO *oid_bio = BIO_new_file(str, "r"); if (oid_bio) { OBJ_create_objects(oid_bio); @@ -748,7 +737,7 @@ static X509 * php_openssl_x509_from_zval(zval ** val, int makeresource, long * r /* read cert from the named file */ BIO *in; - if (php_openssl_safe_mode_chk(Z_STRVAL_PP(val) + (sizeof("file://") - 1) TSRMLS_CC)) { + if (php_check_open_basedir(Z_STRVAL_PP(val) + (sizeof("file://") - 1) TSRMLS_CC)) { return NULL; } @@ -800,7 +789,7 @@ PHP_FUNCTION(openssl_x509_export_to_file) return; } - if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { return; } @@ -1000,7 +989,7 @@ static STACK_OF(X509) * load_all_certs_from_file(char *certfile) goto end; } - if (php_openssl_safe_mode_chk(certfile TSRMLS_CC)) { + if (php_check_open_basedir(certfile TSRMLS_CC)) { goto end; } @@ -1400,7 +1389,7 @@ static X509_REQ * php_openssl_csr_from_zval(zval ** val, int makeresource, long filename = Z_STRVAL_PP(val) + (sizeof("file://") - 1); } if (filename) { - if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { return NULL; } in = BIO_new_file(filename, "r"); @@ -1436,7 +1425,7 @@ PHP_FUNCTION(openssl_csr_export_to_file) return; } - if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { return; } @@ -1833,7 +1822,7 @@ static EVP_PKEY * php_openssl_evp_from_zval(zval ** val, int public_key, char * BIO *in; if (filename) { - if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { return NULL; } in = BIO_new_file(filename, "r"); @@ -2002,7 +1991,7 @@ PHP_FUNCTION(openssl_pkey_export_to_file) RETURN_FALSE; } - if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { RETURN_FALSE; } @@ -2188,7 +2177,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) if (!store) { goto clean_exit; } - if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { + if (php_check_open_basedir(filename TSRMLS_CC)) { goto clean_exit; } @@ -2206,7 +2195,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) if (datafilename) { - if (php_openssl_safe_mode_chk(datafilename TSRMLS_CC)) { + if (php_check_open_basedir(datafilename TSRMLS_CC)) { goto clean_exit; } @@ -2226,7 +2215,7 @@ PHP_FUNCTION(openssl_pkcs7_verify) if (signersfilename) { BIO *certout; - if (php_openssl_safe_mode_chk(signersfilename TSRMLS_CC)) { + if (php_check_open_basedir(signersfilename TSRMLS_CC)) { goto clean_exit; } @@ -2286,7 +2275,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt) return; - if (php_openssl_safe_mode_chk(infilename TSRMLS_CC) || php_openssl_safe_mode_chk(outfilename TSRMLS_CC)) { + if (php_check_open_basedir(infilename TSRMLS_CC) || php_check_open_basedir(outfilename TSRMLS_CC)) { return; } @@ -2463,7 +2452,7 @@ PHP_FUNCTION(openssl_pkcs7_sign) goto clean_exit; } - if (php_openssl_safe_mode_chk(infilename TSRMLS_CC) || php_openssl_safe_mode_chk(outfilename TSRMLS_CC)) { + if (php_check_open_basedir(infilename TSRMLS_CC) || php_check_open_basedir(outfilename TSRMLS_CC)) { goto clean_exit; } @@ -2557,7 +2546,7 @@ PHP_FUNCTION(openssl_pkcs7_decrypt) goto clean_exit; } - if (php_openssl_safe_mode_chk(infilename TSRMLS_CC) || php_openssl_safe_mode_chk(outfilename TSRMLS_CC)) { + if (php_check_open_basedir(infilename TSRMLS_CC) || php_check_open_basedir(outfilename TSRMLS_CC)) { goto clean_exit; } diff --git a/ext/standard/file.c b/ext/standard/file.c index 02496ec0bf..81bd0f2b77 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1742,10 +1742,6 @@ PHP_FUNCTION(copy) convert_to_string_ex(source); convert_to_string_ex(target); - if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(source), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { - RETURN_FALSE; - } - if (php_check_open_basedir(Z_STRVAL_PP(source) TSRMLS_CC)) { RETURN_FALSE; } diff --git a/ext/standard/ftok.c b/ext/standard/ftok.c index 95767343f7..3213808169 100644 --- a/ext/standard/ftok.c +++ b/ext/standard/ftok.c @@ -51,10 +51,6 @@ PHP_FUNCTION(ftok) RETURN_LONG(-1); } - if ((PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(pathname), NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(Z_STRVAL_PP(pathname) TSRMLS_CC)) { - RETURN_LONG(-1); - } - k = ftok(Z_STRVAL_PP(pathname),Z_STRVAL_PP(proj)[0]); if (k == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftok() failed - %s", strerror(errno)); diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c index 640137a74b..51d7ab77ad 100644 --- a/ext/standard/iptc.c +++ b/ext/standard/iptc.c @@ -208,10 +208,6 @@ PHP_FUNCTION(iptcembed) break; } - if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(jpeg_file), NULL, CHECKUID_CHECK_FILE_AND_DIR))) { - RETURN_FALSE; - } - if (php_check_open_basedir(Z_STRVAL_PP(jpeg_file) TSRMLS_CC)) { RETURN_FALSE; }