--- embedaddon/php/ext/posix/posix.c 2012/02/21 23:48:00 1.1.1.1 +++ embedaddon/php/ext/posix/posix.c 2014/06/15 20:03:54 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | + | Copyright (c) 1997-2014 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: posix.c,v 1.1.1.1 2012/02/21 23:48:00 misho Exp $ */ +/* $Id: posix.c,v 1.1.1.4 2014/06/15 20:03:54 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -310,7 +310,7 @@ const zend_function_entry posix_functions[] = { static PHP_MINFO_FUNCTION(posix) { php_info_print_table_start(); - php_info_print_table_row(2, "Revision", "$Revision: 1.1.1.1 $"); + php_info_print_table_row(2, "Revision", "$Id: posix.c,v 1.1.1.4 2014/06/15 20:03:54 misho Exp $"); php_info_print_table_end(); } /* }}} */ @@ -838,19 +838,14 @@ PHP_FUNCTION(posix_mkfifo) long mode; int result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &path, &path_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl", &path, &path_len, &mode) == FAILURE) { RETURN_FALSE; } - if (strlen(path) != path_len) { + if (php_check_open_basedir_ex(path, 0 TSRMLS_CC)) { RETURN_FALSE; } - if (php_check_open_basedir_ex(path, 0 TSRMLS_CC) || - (PG(safe_mode) && (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR)))) { - RETURN_FALSE; - } - result = mkfifo(path, mode); if (result < 0) { POSIX_G(last_error) = errno; @@ -876,20 +871,15 @@ PHP_FUNCTION(posix_mknod) php_dev = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ll", &path, &path_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pl|ll", &path, &path_len, &mode, &major, &minor) == FAILURE) { RETURN_FALSE; } - if (strlen(path) != path_len) { + if (php_check_open_basedir_ex(path, 0 TSRMLS_CC)) { RETURN_FALSE; } - if (php_check_open_basedir_ex(path, 0 TSRMLS_CC) || - (PG(safe_mode) && (!php_checkuid(path, NULL, CHECKUID_ALLOW_ONLY_DIR)))) { - RETURN_FALSE; - } - if ((mode & S_IFCHR) || (mode & S_IFBLK)) { if (ZEND_NUM_ARGS() == 2) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "For S_IFCHR and S_IFBLK you need to pass a major device kernel identifier"); @@ -961,22 +951,17 @@ PHP_FUNCTION(posix_access) int filename_len, ret; char *filename, *path; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &mode) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &mode) == FAILURE) { RETURN_FALSE; } - if (strlen(filename) != filename_len) { - RETURN_FALSE; - } - path = expand_filepath(filename, NULL TSRMLS_CC); if (!path) { POSIX_G(last_error) = EIO; RETURN_FALSE; } - if (php_check_open_basedir_ex(path, 0 TSRMLS_CC) || - (PG(safe_mode) && (!php_checkuid_ex(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR, CHECKUID_NO_ERRORS)))) { + if (php_check_open_basedir_ex(path, 0 TSRMLS_CC)) { efree(path); POSIX_G(last_error) = EPERM; RETURN_FALSE;