--- embedaddon/php/ext/imap/php_imap.c 2012/02/21 23:47:56 1.1.1.1 +++ embedaddon/php/ext/imap/php_imap.c 2014/06/15 20:03:49 1.1.1.5 @@ -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 | @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.1.1.1 2012/02/21 23:47:56 misho Exp $ */ +/* $Id: php_imap.c,v 1.1.1.5 2014/06/15 20:03:49 misho Exp $ */ #define IMAP41 @@ -1153,7 +1153,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMET zval *params = NULL; int argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, "sss|lla", &mailbox, &mailbox_len, &user, &user_len, + if (zend_parse_parameters(argc TSRMLS_CC, "pss|lla", &mailbox, &mailbox_len, &user, &user_len, &passwd, &passwd_len, &flags, &retries, ¶ms) == FAILURE) { return; } @@ -1191,7 +1191,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMET if (zend_hash_index_find(Z_ARRVAL_PP(disabled_auth_method), i, (void **) &z_auth_method) == SUCCESS) { if (Z_TYPE_PP(z_auth_method) == IS_STRING) { if (Z_STRLEN_PP(z_auth_method) > 1) { - mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(disabled_auth_method)); + mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(z_auth_method)); } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings"); @@ -1218,15 +1218,9 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMET IMAPG(imap_password) = 0; } - /* local filename, need to perform open_basedir and safe_mode checks */ - if (mailbox[0] != '{') { - if (strlen(mailbox) != mailbox_len) { - RETURN_FALSE; - } - if (php_check_open_basedir(mailbox TSRMLS_CC) || - (PG(safe_mode) && !php_checkuid(mailbox, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { - RETURN_FALSE; - } + /* local filename, need to perform open_basedir check */ + if (mailbox[0] != '{' && php_check_open_basedir(mailbox TSRMLS_CC)) { + RETURN_FALSE; } IMAPG(imap_user) = estrndup(user, user_len); @@ -1276,7 +1270,6 @@ PHP_FUNCTION(imap_reopen) int mailbox_len; long options = 0, retries = 0; pils *imap_le_struct; - MAILSTREAM *imap_stream; long flags=NIL; long cl_flags=NIL; @@ -1299,19 +1292,17 @@ PHP_FUNCTION(imap_reopen) mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) retries); } #endif - /* local filename, need to perform open_basedir and safe_mode checks */ - if (mailbox[0] != '{' && - (php_check_open_basedir(mailbox TSRMLS_CC) || - (PG(safe_mode) && !php_checkuid(mailbox, NULL, CHECKUID_CHECK_FILE_AND_DIR)))) { + /* local filename, need to perform open_basedir check */ + if (mailbox[0] != '{' && php_check_open_basedir(mailbox TSRMLS_CC)) { RETURN_FALSE; } - imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags); - if (imap_stream == NIL) { + imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, mailbox, flags); + if (imap_le_struct->imap_stream == NIL) { + zend_list_delete(Z_RESVAL_P(streamind)); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't re-open stream"); RETURN_FALSE; } - imap_le_struct->imap_stream = imap_stream; RETURN_TRUE; } /* }}} */ @@ -2441,7 +2432,7 @@ PHP_FUNCTION(imap_savebody) default: convert_to_string_ex(out); - writer = php_stream_open_wrapper(Z_STRVAL_PP(out), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); + writer = php_stream_open_wrapper(Z_STRVAL_PP(out), "wb", REPORT_ERRORS, NULL); break; }