]> granicus.if.org Git - php/commitdiff
- More safe_mode nuking
authorAndi Gutmans <andi@php.net>
Sun, 19 Feb 2006 03:07:39 +0000 (03:07 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 19 Feb 2006 03:07:39 +0000 (03:07 +0000)
ext/curl/interface.c
ext/openssl/openssl.c
ext/standard/file.c
ext/standard/ftok.c
ext/standard/iptc.c

index 032c4a85f391d85da8654d369e04c55ed51c1493..66d2379630e9abc200ed94053d44ea7f2ca46c82 100644 (file)
@@ -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;
                                                }
index 40f4a70caa3f11573854f86a3cd6f2c3d36cde1b..a07c50cd24364163770f405966cf6d52286aff5d 100644 (file)
@@ -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;
        }
 
index 02496ec0bfded54bda3935e8c1ad8fcc2fe00191..81bd0f2b776748f458798be1601add9f8e2a0f46 100644 (file)
@@ -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;
        }
index 95767343f7b6275fbc9f00e644d8e34198a2ee82..3213808169895f86f389cd778846b42c414ca649 100644 (file)
@@ -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));
index 640137a74bc89ff1dc716a820ea6b0a87ca89c67..51d7ab77adcd19589f06f80ea1e10028cd432f76 100644 (file)
@@ -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;
        }