Skip to content

Commit

Permalink
fixed #34 Check the patch build results of each version
Browse files Browse the repository at this point in the history
  • Loading branch information
Joungkyun committed Feb 2, 2022
1 parent e73b3d3 commit 7717633
Show file tree
Hide file tree
Showing 36 changed files with 2,213 additions and 312 deletions.
4 changes: 2 additions & 2 deletions patches/php-5.4.25-execdir.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ diff -urNp php-5.4.25.org/configure.in php-5.4.25/configure.in

+AC_MSG_CHECKING([for exec dir])
+PHP_ARG_WITH(exec-dir,,
+[ --with-exec-dir[=DIR] Only allow executables in DIR
+ [/var/lib/php/bin]], no, no)
+[ --with-exec-dir=DIR Only allow executables in DIR
+ [[Default: /var/lib/php/bin]]], no, no)
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ AC_DEFINE_UNQUOTED(PHP_EXEC_DIR, "$PHP_EXEC_DIR", [ ])
Expand Down
4 changes: 2 additions & 2 deletions patches/php-5.4.40-execdir.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ diff -urNp php-5.4.40.org/configure.in php-5.4.40/configure.in

+AC_MSG_CHECKING([for exec dir])
+PHP_ARG_WITH(exec-dir,,
+[ --with-exec-dir[=DIR] Only allow executables in DIR
+ [/var/lib/php/bin]], no, no)
+[ --with-exec-dir=DIR Only allow executables in DIR
+ [[Default: /var/lib/php/bin]]], no, no)
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ AC_DEFINE_UNQUOTED(PHP_EXEC_DIR, "$PHP_EXEC_DIR", [ ])
Expand Down
4 changes: 2 additions & 2 deletions patches/php-5.4.45-execdir.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ diff -urNp php-5.4.45.org/configure.in php-5.4.45/configure.in

+AC_MSG_CHECKING([for exec dir])
+PHP_ARG_WITH(exec-dir,,
+[ --with-exec-dir[=DIR] Only allow executables in DIR
+ [/var/lib/php/bin]], no, no)
+[ --with-exec-dir=DIR Only allow executables in DIR
+ [[Default: /var/lib/php/bin]]], no, no)
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ AC_DEFINE_UNQUOTED(PHP_EXEC_DIR, "$PHP_EXEC_DIR", [ ])
Expand Down
4 changes: 2 additions & 2 deletions patches/php-5.5.36-execdir.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ diff -urNp php-5.5.36.org/configure.in php-5.5.36/configure.in

+AC_MSG_CHECKING([for exec dir])
+PHP_ARG_WITH(exec-dir,,
+[ --with-exec-dir[=DIR] Only allow executables in DIR
+ [/var/lib/php/bin]], no, no)
+[ --with-exec-dir=DIR Only allow executables in DIR
+ [[Default: /var/lib/php/bin]]], no, no)
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ AC_DEFINE_UNQUOTED(PHP_EXEC_DIR, "$PHP_EXEC_DIR", [ ])
Expand Down
96 changes: 53 additions & 43 deletions patches/php-5.5.38-execdir.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
diff -ruNp php-5.5.38.org/configure php-5.5.38/configure
diff -urNp php-5.5.38.org/configure php-5.5.38/configure
--- php-5.5.38.org/configure 2016-07-20 21:21:48.000000000 +0900
+++ php-5.5.38/configure 2017-09-01 01:38:52.537731227 +0900
@@ -20624,6 +20624,45 @@ $as_echo "$PHP_CONFIG_FILE_SCAN_DIR" >&6
test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"
+++ php-5.5.38/configure 2022-02-02 16:54:02.329970653 +0900
@@ -1798,6 +1798,8 @@ General settings:
Set the path in which to look for php.ini [PREFIX/lib]
--with-config-file-scan-dir=PATH
Set the path where to scan for configuration files
+ --with-exec-dir=DIR Only allow executables in DIR
+ [Default: /var/lib/php/bin]
--enable-sigchild Enable PHP's own SIGCHLD handler
--enable-libgcc Enable explicitly linking against libgcc
--disable-short-tags Disable the short-form <? start tag by default
@@ -20623,6 +20625,46 @@ $as_echo "$PHP_CONFIG_FILE_SCAN_DIR" >&6

test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"

+echo $ac_n "checking for safe mode exec dir""... $ac_c" 1>&6
+echo "configure:20296: checking for safe mode exec dir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exec dir" >&5
+$as_echo_n "checking for exec dir... " >&6; }
+
+php_with_exec_dir=no
+
+
+# Check whether --with-exec-dir or --without-exec-dir was given.
+if test "${with_exec_dir+set}" = set; then
+ withval="$with_exec_dir"
+ PHP_EXEC_DIR=$withval
+
+# Check whether --with-exec-dir was given.
+if test "${with_exec_dir+set}" = set; then :
+ withval=$with_exec_dir; PHP_EXEC_DIR=$withval
+else
+
+ PHP_EXEC_DIR=no
Expand All @@ -30,34 +39,35 @@ diff -ruNp php-5.5.38.org/configure php-5.5.38/configure
+
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ cat >> confdefs.h <<EOF
+
+cat >>confdefs.h <<_ACEOF
+#define PHP_EXEC_DIR "$PHP_EXEC_DIR"
+EOF
+_ACEOF
+
+ echo "$ac_t""$PHP_EXEC_DIR" 1>&6
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PHP_EXEC_DIR" >&5
+$as_echo "$PHP_EXEC_DIR" >&6; }
+else
+ cat >> confdefs.h <<\EOF
+#define PHP_EXEC_DIR "/usr/local/php/bin"
+EOF
+
+ echo "$ac_t""/usr/local/php/bin" 1>&6
+fi
+$as_echo "#define PHP_EXEC_DIR \"/var/lib/php/bin\"" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: /var/lib/php/bin" >&5
+$as_echo "/var/lib/php/bin" >&6; }
+fi
+

php_enable_sigchild=no

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable PHP's own SIGCHLD handler" >&5
diff -ruNp php-5.5.38.org/configure.in php-5.5.38/configure.in
diff -urNp php-5.5.38.org/configure.in php-5.5.38/configure.in
--- php-5.5.38.org/configure.in 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/configure.in 2017-09-01 01:38:52.544731600 +0900
+++ php-5.5.38/configure.in 2022-02-02 16:53:29.354995770 +0900
@@ -914,6 +914,19 @@ AC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR

test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"

+AC_MSG_CHECKING([for exec dir])
+PHP_ARG_WITH(exec-dir,,
+[ --with-exec-dir[=DIR] Only allow executables in DIR
+ [/var/lib/php/bin]], no, no)
+[ --with-exec-dir=DIR Only allow executables in DIR
+ [[Default: /var/lib/php/bin]]], no, no)
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ AC_DEFINE_UNQUOTED(PHP_EXEC_DIR, "$PHP_EXEC_DIR", [ ])
Expand All @@ -70,9 +80,9 @@ diff -ruNp php-5.5.38.org/configure.in php-5.5.38/configure.in
PHP_ARG_ENABLE(sigchild, whether to enable PHP's own SIGCHLD handler,
[ --enable-sigchild Enable PHP's own SIGCHLD handler], no, no)

diff -ruNp php-5.5.38.org/ext/pcntl/pcntl.c php-5.5.38/ext/pcntl/pcntl.c
diff -urNp php-5.5.38.org/ext/pcntl/pcntl.c php-5.5.38/ext/pcntl/pcntl.c
--- php-5.5.38.org/ext/pcntl/pcntl.c 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/ext/pcntl/pcntl.c 2017-09-01 01:38:52.568732882 +0900
+++ php-5.5.38/ext/pcntl/pcntl.c 2022-02-02 16:53:29.354995770 +0900
@@ -46,6 +46,9 @@

#include <errno.h>
Expand Down Expand Up @@ -139,9 +149,9 @@ diff -ruNp php-5.5.38.org/ext/pcntl/pcntl.c php-5.5.38/ext/pcntl/pcntl.c
efree(argv);

RETURN_FALSE;
diff -ruNp php-5.5.38.org/ext/standard/exec.c php-5.5.38/ext/standard/exec.c
diff -urNp php-5.5.38.org/ext/standard/exec.c php-5.5.38/ext/standard/exec.c
--- php-5.5.38.org/ext/standard/exec.c 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/ext/standard/exec.c 2017-09-01 01:39:05.659431858 +0900
+++ php-5.5.38/ext/standard/exec.c 2022-02-02 16:53:29.355995800 +0900
@@ -105,7 +105,7 @@ PHPAPI int php_exec(int type, char *cmd,
FILE *fp;
char *buf;
Expand Down Expand Up @@ -694,9 +704,9 @@ diff -ruNp php-5.5.38.org/ext/standard/exec.c php-5.5.38/ext/standard/exec.c

stream = php_stream_fopen_from_pipe(in, "rb");
total_readbytes = php_stream_copy_to_mem(stream, &ret, PHP_STREAM_COPY_ALL, 0);
diff -ruNp php-5.5.38.org/ext/standard/exec.h php-5.5.38/ext/standard/exec.h
diff -urNp php-5.5.38.org/ext/standard/exec.h php-5.5.38/ext/standard/exec.h
--- php-5.5.38.org/ext/standard/exec.h 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/ext/standard/exec.h 2017-09-01 01:38:52.595734324 +0900
+++ php-5.5.38/ext/standard/exec.h 2022-02-02 16:53:29.355995800 +0900
@@ -35,8 +35,33 @@ PHP_FUNCTION(proc_nice);
PHP_MINIT_FUNCTION(proc_open);
PHP_MINIT_FUNCTION(exec);
Expand Down Expand Up @@ -731,9 +741,9 @@ diff -ruNp php-5.5.38.org/ext/standard/exec.h php-5.5.38/ext/standard/exec.h
PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC);

#endif /* EXEC_H */
diff -ruNp php-5.5.38.org/ext/standard/file.c php-5.5.38/ext/standard/file.c
diff -urNp php-5.5.38.org/ext/standard/file.c php-5.5.38/ext/standard/file.c
--- php-5.5.38.org/ext/standard/file.c 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/ext/standard/file.c 2017-09-01 01:38:52.605734858 +0900
+++ php-5.5.38/ext/standard/file.c 2022-02-02 16:53:29.356995829 +0900
@@ -916,7 +916,7 @@ PHPAPI PHP_FUNCTION(fclose)
Execute a command and open either a read or a write pipe to it */
PHP_FUNCTION(popen)
Expand Down Expand Up @@ -767,9 +777,9 @@ diff -ruNp php-5.5.38.org/ext/standard/file.c php-5.5.38/ext/standard/file.c
if (!fp) {
php_error_docref2(NULL TSRMLS_CC, command, posix_mode, E_WARNING, "%s", strerror(errno));
efree(posix_mode);
diff -ruNp php-5.5.38.org/ext/standard/proc_open.c php-5.5.38/ext/standard/proc_open.c
diff -urNp php-5.5.38.org/ext/standard/proc_open.c php-5.5.38/ext/standard/proc_open.c
--- php-5.5.38.org/ext/standard/proc_open.c 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/ext/standard/proc_open.c 2017-09-01 01:38:52.613735285 +0900
+++ php-5.5.38/ext/standard/proc_open.c 2022-02-02 16:53:29.356995829 +0900
@@ -450,7 +450,7 @@ struct php_proc_open_descriptor_item {
Run a process with more control over it's file descriptors */
PHP_FUNCTION(proc_open)
Expand All @@ -795,9 +805,9 @@ diff -ruNp php-5.5.38.org/ext/standard/proc_open.c php-5.5.38/ext/standard/proc_

#ifdef PHP_WIN32
if (other_options) {
diff -ruNp php-5.5.38.org/main/main.c php-5.5.38/main/main.c
diff -urNp php-5.5.38.org/main/main.c php-5.5.38/main/main.c
--- php-5.5.38.org/main/main.c 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/main/main.c 2017-09-01 01:38:52.619735606 +0900
+++ php-5.5.38/main/main.c 2022-02-02 16:53:29.357995859 +0900
@@ -469,6 +469,10 @@ PHP_INI_MH(OnChangeBrowscap);
* PHP_INCLUDE_PATH
*/
Expand All @@ -817,9 +827,9 @@ diff -ruNp php-5.5.38.org/main/main.c php-5.5.38/main/main.c

STD_PHP_INI_BOOLEAN("file_uploads", "1", PHP_INI_SYSTEM, OnUpdateBool, file_uploads, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("upload_max_filesize", "2M", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLong, upload_max_filesize, php_core_globals, core_globals)
diff -ruNp php-5.5.38.org/main/php_config.h.in php-5.5.38/main/php_config.h.in
diff -urNp php-5.5.38.org/main/php_config.h.in php-5.5.38/main/php_config.h.in
--- php-5.5.38.org/main/php_config.h.in 2016-07-20 21:21:48.000000000 +0900
+++ php-5.5.38/main/php_config.h.in 2017-09-01 01:38:52.620735659 +0900
+++ php-5.5.38/main/php_config.h.in 2022-02-02 16:53:29.358995888 +0900
@@ -2192,6 +2192,9 @@
/* whether pwrite64 is default */
#undef PHP_PWRITE_64
Expand All @@ -830,9 +840,9 @@ diff -ruNp php-5.5.38.org/main/php_config.h.in php-5.5.38/main/php_config.h.in
/* Whether the system supports SHA256 salt */
#undef PHP_SHA256_CRYPT

diff -ruNp php-5.5.38.org/main/php_globals.h php-5.5.38/main/php_globals.h
diff -urNp php-5.5.38.org/main/php_globals.h php-5.5.38/main/php_globals.h
--- php-5.5.38.org/main/php_globals.h 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/main/php_globals.h 2017-09-01 01:38:52.621735713 +0900
+++ php-5.5.38/main/php_globals.h 2022-02-02 16:53:29.358995888 +0900
@@ -160,6 +160,8 @@ struct _php_core_globals {

zend_bool in_error_log;
Expand All @@ -842,9 +852,9 @@ diff -ruNp php-5.5.38.org/main/php_globals.h php-5.5.38/main/php_globals.h
#ifdef PHP_WIN32
zend_bool windows_show_crt_warning;
#endif
diff -ruNp php-5.5.38.org/php.ini-development php-5.5.38/php.ini-development
diff -urNp php-5.5.38.org/php.ini-development php-5.5.38/php.ini-development
--- php-5.5.38.org/php.ini-development 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/php.ini-development 2017-09-01 01:38:52.627736033 +0900
+++ php-5.5.38/php.ini-development 2022-02-02 16:53:29.358995888 +0900
@@ -291,6 +291,11 @@ unserialize_callback_func =
; are decoded with unserialize, the data will remain the same.
serialize_precision = 17
Expand All @@ -857,9 +867,9 @@ diff -ruNp php-5.5.38.org/php.ini-development php-5.5.38/php.ini-development
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
diff -ruNp php-5.5.38.org/php.ini-production php-5.5.38/php.ini-production
diff -urNp php-5.5.38.org/php.ini-production php-5.5.38/php.ini-production
--- php-5.5.38.org/php.ini-production 2016-07-20 17:41:48.000000000 +0900
+++ php-5.5.38/php.ini-production 2017-09-01 01:38:52.634736407 +0900
+++ php-5.5.38/php.ini-production 2022-02-02 16:53:29.359995918 +0900
@@ -291,6 +291,11 @@ unserialize_callback_func =
; are decoded with unserialize, the data will remain the same.
serialize_precision = 17
Expand Down
4 changes: 2 additions & 2 deletions patches/php-5.6.22-execdir.patch
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ diff -urNp php-5.6.22.org/configure.in php-5.6.22/configure.in

+AC_MSG_CHECKING([for exec dir])
+PHP_ARG_WITH(exec-dir,,
+[ --with-exec-dir[=DIR] Only allow executables in DIR
+ [/var/lib/php/bin]], no, no)
+[ --with-exec-dir=DIR Only allow executables in DIR
+ [[Default: /var/lib/php/bin]]], no, no)
+
+if test "$PHP_EXEC_DIR" != "no" && test "$PHP_EXEC_DIR" != "yes" ; then
+ AC_DEFINE_UNQUOTED(PHP_EXEC_DIR, "$PHP_EXEC_DIR", [ ])
Expand Down
Loading

0 comments on commit 7717633

Please sign in to comment.