mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
MFB(r-1.74.2.8) Bug #14369. ftp extension allows circumvention of safe_mode restrictions. HEAD version of this patch uses the simpler open_wrapper approach to applying safe mode restrictions. Also allows writting to/from wrappers this way.
This commit is contained in:
parent
8924395720
commit
c9651182c6
@ -649,9 +649,9 @@ PHP_FUNCTION(ftp_get)
|
||||
}
|
||||
|
||||
if (ftp->autoseek && resumepos) {
|
||||
outstream = php_stream_fopen(local, "rb+", NULL);
|
||||
outstream = php_stream_open_wrapper(local, "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
|
||||
if (outstream == NULL) {
|
||||
outstream = php_stream_fopen(local, "wb", NULL);
|
||||
outstream = php_stream_open_wrapper(local, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
|
||||
}
|
||||
if (outstream != NULL) {
|
||||
/* if autoresume is wanted seek to end */
|
||||
@ -663,7 +663,7 @@ PHP_FUNCTION(ftp_get)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
outstream = php_stream_fopen(local, "wb", NULL);
|
||||
outstream = php_stream_open_wrapper(local, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
|
||||
}
|
||||
|
||||
if (outstream == NULL) {
|
||||
@ -707,9 +707,9 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
}
|
||||
|
||||
if (ftp->autoseek && resumepos) {
|
||||
outstream = php_stream_fopen(local, "rb+", NULL);
|
||||
outstream = php_stream_open_wrapper(local, "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
|
||||
if (outstream == NULL) {
|
||||
outstream = php_stream_fopen(local, "wb", NULL);
|
||||
outstream = php_stream_open_wrapper(local, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
|
||||
}
|
||||
if (outstream != NULL) {
|
||||
/* if autoresume is wanted seek to end */
|
||||
@ -721,7 +721,7 @@ PHP_FUNCTION(ftp_nb_get)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
outstream = php_stream_fopen(local, "wb", NULL);
|
||||
outstream = php_stream_open_wrapper(local, "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
|
||||
}
|
||||
|
||||
if (outstream == NULL) {
|
||||
@ -902,7 +902,7 @@ PHP_FUNCTION(ftp_put)
|
||||
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
|
||||
XTYPE(xtype, mode);
|
||||
|
||||
if (!(instream = php_stream_fopen(local, "rb", NULL))) {
|
||||
if (!(instream = php_stream_open_wrapper(local, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@ -955,7 +955,7 @@ PHP_FUNCTION(ftp_nb_put)
|
||||
ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
|
||||
XTYPE(xtype, mode);
|
||||
|
||||
if (!(instream = php_stream_fopen(local, "rb", NULL))) {
|
||||
if (!(instream = php_stream_open_wrapper(local, "rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user