diff --git a/programming/php/php/files/70_mod_php5.conf b/programming/php/php/files/70_mod_php5.conf new file mode 100644 index 0000000000..246e548980 --- /dev/null +++ b/programming/php/php/files/70_mod_php5.conf @@ -0,0 +1,19 @@ +LoadModule php5_module modules/libphp5.so + +AddHandler php5-script .php + +# Set it to handle the files + + AddType application/x-httpd-php .php + AddType application/x-httpd-php .phtml + AddType application/x-httpd-php .php3 + AddType application/x-httpd-php .php4 + AddType application/x-httpd-php .php5 + AddType application/x-httpd-php-source .phps + + +# +# Add index.php to the list of files that will be served as directory +# indexes. +# +DirectoryIndex index.php index.phtml diff --git a/programming/php/php/files/950-Fix-dl-cross-compiling-issue.patch b/programming/php/php/files/950-Fix-dl-cross-compiling-issue.patch new file mode 100644 index 0000000000..02b1f644c1 --- /dev/null +++ b/programming/php/php/files/950-Fix-dl-cross-compiling-issue.patch @@ -0,0 +1,62 @@ +diff -u --recursive php-5.6.6-vanilla/configure.in php-5.6.6/configure.in +--- php-5.6.6-vanilla/configure.in 2015-02-26 22:10:51.865487530 -0500 ++++ php-5.6.6/configure.in 2015-02-26 22:29:59.043102135 -0500 +@@ -453,7 +453,10 @@ + PHP_CHECK_FUNC(gethostbyaddr, nsl) + PHP_CHECK_FUNC(yp_get_default_domain, nsl) + +-PHP_CHECK_FUNC(dlopen, dl) ++PHP_ADD_LIBRARY(dl) ++PHP_DEF_HAVE(dlopen) ++PHP_DEF_HAVE(libdl) ++ac_cv_func_dlopen=yes + if test "$ac_cv_func_dlopen" = "yes"; then + AC_DEFINE(HAVE_LIBDL, 1, [ ]) + fi +diff -u --recursive php-5.6.6-vanilla/ext/fileinfo/config.m4 php-5.6.6/ext/fileinfo/config.m4 +--- php-5.6.6-vanilla/ext/fileinfo/config.m4 2015-02-26 22:10:51.639487135 -0500 ++++ php-5.6.6/ext/fileinfo/config.m4 2015-02-26 22:22:47.645609128 -0500 +@@ -46,6 +46,10 @@ + AC_MSG_RESULT(no) + AC_MSG_NOTICE(using libmagic strcasestr implementation) + libmagic_sources="$libmagic_sources libmagic/strcasestr.c" ++ ],[ ++ dnl cross-compiling; assume not present ++ AC_MSG_NOTICE(using libmagic strcasestr implementation) ++ libmagic_sources="$libmagic_sources libmagic/strcasestr.c" + ]) + + PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic) +diff -u --recursive php-5.6.6-vanilla/ext/opcache/config.m4 php-5.6.6/ext/opcache/config.m4 +--- php-5.6.6-vanilla/ext/opcache/config.m4 2015-02-26 22:10:51.790487399 -0500 ++++ php-5.6.6/ext/opcache/config.m4 2015-02-26 22:34:19.240414394 -0500 +@@ -341,7 +341,14 @@ + flock_type=linux + AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) + AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++], [ ++ AC_MSG_RESULT("no") ++], [ ++ dnl cross-compiling; assume Linux ++ flock_type=linux ++ AC_DEFINE([HAVE_FLOCK_LINUX], [], [Struct flock is Linux-type]) ++ AC_MSG_RESULT("yes") ++]) + + AC_MSG_CHECKING("whether flock struct is BSD ordered") + AC_TRY_RUN([ +@@ -357,7 +364,12 @@ + flock_type=bsd + AC_DEFINE([HAVE_FLOCK_BSD], [], [Struct flock is BSD-type]) + AC_MSG_RESULT("yes") +-], AC_MSG_RESULT("no") ) ++], [ ++ AC_MSG_RESULT("no") ++], [ ++ dnl cross-compiling; assume Linux ++ AC_MSG_RESULT("no") ++]) + + if test "$flock_type" == "unknown"; then + AC_MSG_ERROR([Don't know how to define struct flock on this system[,] set --enable-opcache=no]) diff --git a/programming/php/php/files/denial_of_service_in_getArchiveComment.patch b/programming/php/php/files/denial_of_service_in_getArchiveComment.patch new file mode 100644 index 0000000000..b4605c982b --- /dev/null +++ b/programming/php/php/files/denial_of_service_in_getArchiveComment.patch @@ -0,0 +1,12 @@ +--- php-5.2.14.orig/ext/zip/php_zip.c 2011-01-14 16:12:17.886000067 +0200 ++++ php-5.2.14/ext/zip/php_zip.c 2011-01-14 16:14:50.233000067 +0200 +@@ -1954,6 +1954,9 @@ + + PHP_ZIP_STAT_INDEX(intern, index, 0, sb); + comment = zip_get_file_comment(intern, index, &comment_len, (int)flags); ++ if(comment==NULL) { ++ RETURN_FALSE; ++ } + RETURN_STRINGL((char *)comment, (long)comment_len, 1); + } + /* }}} */ diff --git a/programming/php/php/files/int_overflow_in_mt_rand.patch b/programming/php/php/files/int_overflow_in_mt_rand.patch new file mode 100644 index 0000000000..95470bb6b1 --- /dev/null +++ b/programming/php/php/files/int_overflow_in_mt_rand.patch @@ -0,0 +1,14 @@ +--- php-5.2.14.orig/ext/standard/rand.c 2011-02-07 14:44:55.975000003 +0200 ++++ php-5.2.14/ext/standard/rand.c 2011-02-07 16:24:24.017000004 +0200 +@@ -322,6 +322,11 @@ + php_mt_srand(GENERATE_SEED() TSRMLS_CC); + } + ++ if (max < min) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "max(%d) is smaller than min(%d)", max, min); ++ RETURN_FALSE; ++ } ++ + /* + * Melo: hmms.. randomMT() returns 32 random bits... + * Yet, the previous php_rand only returns 31 at most. diff --git a/programming/php/php/files/php-imap-annotation+status-current.diff b/programming/php/php/files/php-imap-annotation+status-current.diff new file mode 100644 index 0000000000..2da8d70fe4 --- /dev/null +++ b/programming/php/php/files/php-imap-annotation+status-current.diff @@ -0,0 +1,302 @@ +diff -Naurp php-5.3.4RC1/ext/imap/php_imap.c php-5.3.4RC1.oden/ext/imap/php_imap.c +--- php-5.3.4RC1/ext/imap/php_imap.c 2010-11-18 16:22:22.000000000 +0100 ++++ php-5.3.4RC1.oden/ext/imap/php_imap.c 2010-11-22 10:01:42.538863104 +0100 +@@ -164,6 +164,22 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_geta + ZEND_ARG_INFO(0, mailbox) + ZEND_END_ARG_INFO() + #endif ++#if defined(HAVE_IMAP2005) ++ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setannotation, 0, 0, 5) ++ ZEND_ARG_INFO(0, stream_id) ++ ZEND_ARG_INFO(0, mailbox) ++ ZEND_ARG_INFO(0, entry) ++ ZEND_ARG_INFO(0, attr) ++ ZEND_ARG_INFO(0, value) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_getannotation, 0, 0, 4) ++ ZEND_ARG_INFO(0, stream_id) ++ ZEND_ARG_INFO(0, mailbox) ++ ZEND_ARG_INFO(0, entry) ++ ZEND_ARG_INFO(0, attr) ++ZEND_END_ARG_INFO() ++#endif + + ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_expunge, 0, 0, 1) + ZEND_ARG_INFO(0, stream_id) +@@ -408,6 +424,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_stat + ZEND_ARG_INFO(0, options) + ZEND_END_ARG_INFO() + ++ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_status_current, 0, 0, 2) ++ ZEND_ARG_INFO(0, stream_id) ++ ZEND_ARG_INFO(0, options) ++ZEND_END_ARG_INFO() ++ + ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_bodystruct, 0, 0, 3) + ZEND_ARG_INFO(0, stream_id) + ZEND_ARG_INFO(0, msg_no) +@@ -507,6 +528,7 @@ const zend_function_entry imap_functions + PHP_FE(imap_binary, arginfo_imap_binary) + PHP_FE(imap_utf8, arginfo_imap_utf8) + PHP_FE(imap_status, arginfo_imap_status) ++ PHP_FE(imap_status_current, arginfo_imap_status_current) + PHP_FE(imap_mailboxmsginfo, arginfo_imap_mailboxmsginfo) + PHP_FE(imap_setflag_full, arginfo_imap_setflag_full) + PHP_FE(imap_clearflag_full, arginfo_imap_clearflag_full) +@@ -537,6 +559,10 @@ const zend_function_entry imap_functions + PHP_FE(imap_setacl, arginfo_imap_setacl) + PHP_FE(imap_getacl, arginfo_imap_getacl) + #endif ++#if defined(HAVE_IMAP2005) ++ PHP_FE(imap_setannotation, arginfo_imap_setannotation) ++ PHP_FE(imap_getannotation, arginfo_imap_getannotation) ++#endif + + PHP_FE(imap_mail, arginfo_imap_mail) + +@@ -798,6 +824,30 @@ void mail_getacl(MAILSTREAM *stream, cha + /* }}} */ + #endif + ++#if defined(HAVE_IMAP2005) ++/* {{{ mail_getannotation ++ * ++ * Mail GET_ANNOTATION callback ++ * Called via the mail_parameter function in c-client:src/c-client/mail.c ++ */ ++void mail_getannotation(MAILSTREAM *stream, ANNOTATION *alist) ++{ ++ ANNOTATION_VALUES *cur; ++ ++ TSRMLS_FETCH(); ++ ++ /* walk through the ANNOTATION_VALUES */ ++ ++ for(cur = alist->values; cur; cur = cur->next) { ++ if (cur->value) ++ add_assoc_stringl(IMAPG(imap_annotation_list), cur->attr, cur->value, strlen(cur->value), 1); ++ else ++ add_assoc_stringl(IMAPG(imap_annotation_list), cur->attr, "", 0, 1); ++ } ++} ++/* }}} */ ++#endif ++ + /* {{{ PHP_GINIT_FUNCTION + */ + static PHP_GINIT_FUNCTION(imap) +@@ -823,6 +873,7 @@ static PHP_GINIT_FUNCTION(imap) + #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) + imap_globals->quota_return = NIL; + imap_globals->imap_acl_list = NIL; ++ imap_globals->imap_annotation_list = NIL; + #endif + imap_globals->gets_stream = NIL; + } +@@ -1547,7 +1598,119 @@ PHP_FUNCTION(imap_getacl) + } + /* }}} */ + #endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */ ++ ++#if defined(HAVE_IMAP2005) ++ ++/* {{{ proto bool imap_setannotation(resource stream_id, string mailbox, string entry, string attr, string value) ++ Sets an annotation for a given mailbox */ ++PHP_FUNCTION(imap_setannotation) ++{ ++ zval **streamind, **mailbox, **entry, **attr, **value; ++ pils *imap_le_struct; ++ long ret; ++ ++ // TODO: Use zend_parse_parameters here ++ if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &streamind, &mailbox, &entry, &attr, &value) == FAILURE) { ++ ZEND_WRONG_PARAM_COUNT(); ++ } ++ ++ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); ++ ++ convert_to_string_ex(mailbox); ++ convert_to_string_ex(entry); ++ convert_to_string_ex(attr); ++ convert_to_string_ex(value); ++ ++ // create annotation object ++ ANNOTATION *annotation = mail_newannotation(); ++ if (!annotation) ++ RETURN_FALSE; ++ annotation->values = mail_newannotationvalue(); ++ if (!annotation->values) { ++ mail_free_annotation(&annotation); ++ RETURN_FALSE; ++ } ++ ++ // fill in annotation values ++ annotation->mbox = Z_STRVAL_PP(mailbox); ++ annotation->entry = Z_STRVAL_PP(entry); ++ annotation->values->attr = Z_STRVAL_PP(attr); ++ annotation->values->value = Z_STRVAL_PP(value); ++ ++ ret = imap_setannotation(imap_le_struct->imap_stream, annotation); ++ ++ // make sure mail_free_annotation doesn't free our variables ++ annotation->mbox = NULL; ++ annotation->entry = NULL; ++ annotation->values->attr = NULL; ++ annotation->values->value = NULL; ++ mail_free_annotation(&annotation); ++ ++ RETURN_BOOL(ret); ++} ++/* }}} */ ++ ++/* {{{ proto array imap_getannotation(resource stream_id, string mailbox, string entry, string attr) ++ Gets the ACL for a given mailbox */ ++PHP_FUNCTION(imap_getannotation) ++{ ++ zval **streamind, **mailbox, **entry, **attr; ++ pils *imap_le_struct; ++ long ret; ++ ++ if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &mailbox, &entry, &attr) == FAILURE) { ++ ZEND_WRONG_PARAM_COUNT(); ++ } + ++ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); ++ ++ convert_to_string_ex(mailbox); ++ convert_to_string_ex(entry); ++ convert_to_string_ex(attr); ++ ++ /* initializing the special array for the return values */ ++ if (array_init(return_value) == FAILURE) { ++ RETURN_FALSE; ++ } ++ ++ // fillup calling parameters ++ STRINGLIST *entries = mail_newstringlist(); ++ if (!entries) ++ RETURN_FALSE; ++ ++ STRINGLIST *cur = entries; ++ cur->text.data = (unsigned char *)cpystr(Z_STRVAL_PP(entry)); ++ cur->text.size = Z_STRLEN_PP(entry); ++ cur->next = NIL; ++ ++ STRINGLIST *attributes = mail_newstringlist(); ++ if (!attributes) ++ RETURN_FALSE; ++ cur = attributes; ++ cur->text.data = (unsigned char *)cpystr (Z_STRVAL_PP(attr)); ++ cur->text.size = Z_STRLEN_PP(attr); ++ cur->next = NIL; ++ ++ IMAPG(imap_annotation_list) = return_value; ++ ++ /* set the callback for the GET_ANNOTATION function */ ++ mail_parameters(NIL, SET_ANNOTATION, (void *) mail_getannotation); ++ ret = imap_getannotation(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), entries, attributes); ++ ++ mail_free_stringlist(&entries); ++ mail_free_stringlist(&attributes); ++ ++ if (!ret) { ++ zval_dtor(return_value); ++ RETURN_FALSE; ++ } ++ ++ IMAPG(imap_annotation_list) = NIL; ++} ++/* }}} */ ++ ++#endif /* HAVE_IMAP2005 */ ++ + /* {{{ proto bool imap_expunge(resource stream_id) + Permanently delete all messages marked for deletion */ + PHP_FUNCTION(imap_expunge) +@@ -3190,6 +3353,42 @@ PHP_FUNCTION(imap_msgno) + } + /* }}} */ + ++/* {{{ proto object imap_status_current(resource stream_id, int options) ++ Get (cached) status info from current mailbox */ ++PHP_FUNCTION(imap_status_current) ++{ ++ zval **streamind, **pflags; ++ pils *imap_le_struct; ++ long flags = 0L; ++ ++ if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &pflags) == FAILURE) { ++ ZEND_WRONG_PARAM_COUNT(); ++ } ++ ++ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); ++ ++ convert_to_long_ex(pflags); ++ flags = Z_LVAL_PP(pflags); ++ ++ if (object_init(return_value) == FAILURE) { ++ RETURN_FALSE; ++ } ++ ++ if (flags & SA_MESSAGES) { ++ add_property_long(return_value, "messages", imap_le_struct->imap_stream->nmsgs); ++ } ++ if (flags & SA_RECENT) { ++ add_property_long(return_value, "recent", imap_le_struct->imap_stream->recent); ++ } ++ if (flags & SA_UIDNEXT) { ++ add_property_long(return_value, "uidnext", imap_le_struct->imap_stream->uid_last+1); ++ } ++ if (flags & SA_UIDVALIDITY) { ++ add_property_long(return_value, "uidvalidity", imap_le_struct->imap_stream->uid_validity); ++ } ++} ++/* }}} */ ++ + /* {{{ proto object imap_status(resource stream_id, string mailbox, int options) + Get status info from a mailbox */ + PHP_FUNCTION(imap_status) +diff -Naurp php-5.3.4RC1/ext/imap/php_imap.h php-5.3.4RC1.oden/ext/imap/php_imap.h +--- php-5.3.4RC1/ext/imap/php_imap.h 2010-01-03 10:23:27.000000000 +0100 ++++ php-5.3.4RC1.oden/ext/imap/php_imap.h 2010-11-22 10:01:42.542862889 +0100 +@@ -153,6 +153,7 @@ PHP_FUNCTION(imap_lsub); + PHP_FUNCTION(imap_lsub_full); + PHP_FUNCTION(imap_create); + PHP_FUNCTION(imap_rename); ++PHP_FUNCTION(imap_status_current); + PHP_FUNCTION(imap_status); + PHP_FUNCTION(imap_bodystruct); + PHP_FUNCTION(imap_fetch_overview); +@@ -173,6 +174,9 @@ PHP_FUNCTION(imap_mime_header_decode); + PHP_FUNCTION(imap_thread); + PHP_FUNCTION(imap_timeout); + ++// TODO: Needs fixing in configure in ++#define HAVE_IMAP2005 1 ++ + #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) + PHP_FUNCTION(imap_get_quota); + PHP_FUNCTION(imap_get_quotaroot); +@@ -180,7 +184,10 @@ PHP_FUNCTION(imap_set_quota); + PHP_FUNCTION(imap_setacl); + PHP_FUNCTION(imap_getacl); + #endif +- ++#if defined(HAVE_IMAP2005) ++PHP_FUNCTION(imap_setannotation); ++PHP_FUNCTION(imap_getannotation); ++#endif + + ZEND_BEGIN_MODULE_GLOBALS(imap) + char *imap_user; +@@ -211,6 +218,9 @@ ZEND_BEGIN_MODULE_GLOBALS(imap) + zval **quota_return; + zval *imap_acl_list; + #endif ++#if defined(HAVE_IMAP2005) ++ zval *imap_annotation_list; ++#endif + /* php_stream for php_mail_gets() */ + php_stream *gets_stream; + ZEND_END_MODULE_GLOBALS(imap) diff --git a/programming/php/php/files/php-imap-myrights.diff b/programming/php/php/files/php-imap-myrights.diff new file mode 100644 index 0000000000..274a5f73da --- /dev/null +++ b/programming/php/php/files/php-imap-myrights.diff @@ -0,0 +1,92 @@ +diff -Naurp php-5.3.4RC1/ext/imap/php_imap.c php-5.3.4RC1.oden/ext/imap/php_imap.c +--- php-5.3.4RC1/ext/imap/php_imap.c 2010-11-22 10:39:59.349863220 +0100 ++++ php-5.3.4RC1.oden/ext/imap/php_imap.c 2010-11-22 10:40:14.709956619 +0100 +@@ -163,6 +163,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_geta + ZEND_ARG_INFO(0, stream_id) + ZEND_ARG_INFO(0, mailbox) + ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_myrights, 0, 0, 2) ++ ZEND_ARG_INFO(0, stream_id) ++ ZEND_ARG_INFO(0, mailbox) ++ZEND_END_ARG_INFO() + #endif + #if defined(HAVE_IMAP2005) + ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setannotation, 0, 0, 5) +@@ -558,6 +563,7 @@ const zend_function_entry imap_functions + PHP_FE(imap_set_quota, arginfo_imap_set_quota) + PHP_FE(imap_setacl, arginfo_imap_setacl) + PHP_FE(imap_getacl, arginfo_imap_getacl) ++ PHP_FE(imap_myrights, arginfo_imap_myrights) + #endif + #if defined(HAVE_IMAP2005) + PHP_FE(imap_setannotation, arginfo_imap_setannotation) +@@ -822,6 +828,20 @@ void mail_getacl(MAILSTREAM *stream, cha + } + } + /* }}} */ ++ ++/* {{{ mail_myrights ++ * ++ * Mail MYRIGHTS callback ++ * Called via the mail_parameter function in c-client:src/c-client/mail.c ++ */ ++void mail_myrights(MAILSTREAM *stream, char *mailbox, char *rights) ++{ ++ TSRMLS_FETCH(); ++ ++ ZVAL_STRING(IMAPG(imap_acl_list), rights, 1); ++ ++} ++/* }}} */ + #endif + + #if defined(HAVE_IMAP2005) +@@ -1597,6 +1617,36 @@ PHP_FUNCTION(imap_getacl) + IMAPG(imap_acl_list) = NIL; + } + /* }}} */ ++ ++/* {{{ proto string imap_myrights(resource stream_id, string mailbox) ++ Gets my rights (ACL) for a given mailbox */ ++PHP_FUNCTION(imap_myrights) ++{ ++ zval **streamind, **mailbox; ++ pils *imap_le_struct; ++ ++ if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) { ++ ZEND_WRONG_PARAM_COUNT(); ++ } ++ ++ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap); ++ ++ convert_to_string_ex(mailbox); ++ ++ IMAPG(imap_acl_list) = return_value; ++ ++ /* set the callback for the GET_ACL function */ ++ mail_parameters(NIL, SET_MYRIGHTS, (void *) mail_myrights); ++ if(!imap_myrights(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) { ++ php_error(E_WARNING, "c-client imap_myrights failed"); ++ zval_dtor(return_value); ++ RETURN_FALSE; ++ } ++ ++ IMAPG(imap_acl_list) = NIL; ++} ++/* }}} */ ++ + #endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */ + + #if defined(HAVE_IMAP2005) +diff -Naurp php-5.3.4RC1/ext/imap/php_imap.h php-5.3.4RC1.oden/ext/imap/php_imap.h +--- php-5.3.4RC1/ext/imap/php_imap.h 2010-11-22 10:39:59.349863220 +0100 ++++ php-5.3.4RC1.oden/ext/imap/php_imap.h 2010-11-22 10:40:14.709956619 +0100 +@@ -183,6 +183,7 @@ PHP_FUNCTION(imap_get_quotaroot); + PHP_FUNCTION(imap_set_quota); + PHP_FUNCTION(imap_setacl); + PHP_FUNCTION(imap_getacl); ++PHP_FUNCTION(imap_myrights); + #endif + #if defined(HAVE_IMAP2005) + PHP_FUNCTION(imap_setannotation); diff --git a/programming/php/php/files/php5-imap-symlink.diff b/programming/php/php/files/php5-imap-symlink.diff new file mode 100644 index 0000000000..475c037557 --- /dev/null +++ b/programming/php/php/files/php5-imap-symlink.diff @@ -0,0 +1,15 @@ +--- ext/imap/config.m4 2006-01-23 23:55:13.000000000 +0200 ++++ ext.orig/imap/config.m4 2006-01-23 23:56:08.000000000 +0200 +@@ -146,12 +146,6 @@ + AC_MSG_ERROR(Cannot find rfc822.h. Please check your c-client installation.) + fi + +- if test -r "$IMAP_DIR/c-client/c-client.a"; then +- ln -s "$IMAP_DIR/c-client/c-client.a" "$IMAP_DIR/c-client/libc-client.a" >/dev/null 2>&1 +- elif test -r "$IMAP_DIR/$PHP_LIBDIR/c-client.a"; then +- ln -s "$IMAP_DIR/$PHP_LIBDIR/c-client.a" "$IMAP_DIR/$PHP_LIBDIR/libc-client.a" >/dev/null 2>&1 +- fi +- + for lib in c-client4 c-client imap; do + IMAP_LIB=$lib + IMAP_LIB_CHK($PHP_LIBDIR) diff --git a/programming/php/php/files/stack_buffer_overflow_in_imagepstext.patch b/programming/php/php/files/stack_buffer_overflow_in_imagepstext.patch new file mode 100644 index 0000000000..338e5e6d3e --- /dev/null +++ b/programming/php/php/files/stack_buffer_overflow_in_imagepstext.patch @@ -0,0 +1,14 @@ +--- php-5.2.14.orig/ext/gd/gd.c 2011-01-26 12:38:42.956023043 +0200 ++++ php-5.2.14/ext/gd/gd.c 2011-01-26 13:37:21.171023045 +0200 +@@ -4593,6 +4593,11 @@ + return; + } + ++ if (aa_steps != 4 && aa_steps != 16) { ++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Antialias steps must be 4 or 16"); ++ RETURN_FALSE; ++ } ++ + ZEND_FETCH_RESOURCE(bg_img, gdImagePtr, &img, -1, "Image", le_gd); + ZEND_FETCH_RESOURCE(f_ind, int *, &fnt, -1, "Type 1 font", le_ps_font); + diff --git a/programming/php/php/files/system-timezone.patch b/programming/php/php/files/system-timezone.patch new file mode 100644 index 0000000000..42e470b5a1 --- /dev/null +++ b/programming/php/php/files/system-timezone.patch @@ -0,0 +1,265 @@ +Index: ext/date/lib/parse_tz.c +=================================================================== +RCS file: /repository/php-src/ext/date/lib/parse_tz.c,v +retrieving revision 1.35 +diff -u -r1.35 parse_tz.c +--- ext/date/lib/parse_tz.c 31 Dec 2007 07:12:08 -0000 1.35 ++++ ext/date/lib/parse_tz.c 10 Jan 2008 11:42:15 -0000 +@@ -20,6 +20,16 @@ + + #include "timelib.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include ++#include ++#include ++#include ++#include ++ ++#include "php_scandir.h" ++#endif ++ + #include + + #ifdef HAVE_STRING_H +@@ -27,7 +37,10 @@ + #else + #include + #endif ++ ++#ifndef HAVE_SYSTEM_TZDATA + #include "timezonedb.h" ++#endif + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -202,6 +215,195 @@ + } + } + ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++static const timelib_tzdb *timezonedb_system = NULL; ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entres to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next].id = strdup(name); ++ db_index[index_next++].pos = 0; ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || st.st_size < 21) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++const timelib_tzdb *timelib_builtin_db(void) ++{ ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ timezonedb_system = tmp; ++ } ++ ++ return timezonedb_system; ++} ++ ++const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int *count) ++{ ++ *count = timezonedb_system->index_size; ++ return timezonedb_system->index; ++} ++ ++int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) ++{ ++ char fname[PATH_MAX]; ++ ++ if (strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone); ++ ++ return access(fname, R_OK) == 0 ? 1 : 0; ++} ++ ++timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) ++{ ++ char *tzf, *orig; ++ timelib_tzinfo *tmp; ++ size_t len; ++ ++ orig = map_tzfile(timezone, &len); ++ if (orig == NULL) { ++ return NULL; ++ } ++ ++ tmp = timelib_tzinfo_ctor(timezone); ++ ++ tzf = orig + 20; ++ read_header(&tzf, tmp); ++ read_transistions(&tzf, tmp); ++ read_types(&tzf, tmp); ++ ++ munmap(orig, len); ++ ++ return tmp; ++} ++#else /* !HAVE_SYSTEM_TZDATA */ ++ + static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; +@@ -258,6 +460,7 @@ + + return tmp; + } ++#endif + + static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time) + { +Index: ext/date/lib/timelib.m4 +=================================================================== +RCS file: /repository/php-src/ext/date/lib/timelib.m4,v +retrieving revision 1.4 +diff -u -r1.4 timelib.m4 +--- ext/date/lib/timelib.m4 3 Jul 2005 23:30:52 -0000 1.4 ++++ ext/date/lib/timelib.m4 10 Jan 2008 11:42:16 -0000 +@@ -78,3 +78,17 @@ + + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll strftime) ++ ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ +