summaryrefslogtreecommitdiff
path: root/lang/php5
diff options
context:
space:
mode:
authorsborrill <sborrill>2008-03-04 17:13:49 +0000
committersborrill <sborrill>2008-03-04 17:13:49 +0000
commit53098445edbf4cff062b08ea1cde14ad4e6b0828 (patch)
treed39bda325b7ffe71dc0f5c45974fca82ad5dbea0 /lang/php5
parent983300b3f559a9ed30543fe7f65213acf187c0bb (diff)
downloadpkgsrc-53098445edbf4cff062b08ea1cde14ad4e6b0828.tar.gz
Patch around imap_header() dying with SIGABRT if recipient lists are too
long. Patch appended to PHP bug 42862, so the fix may be incorporated in later PHP releases and thus this patch can be reverted. http://bugs.php.net/bug.php?id=42862 Bump PKGREVISION of php-imap
Diffstat (limited to 'lang/php5')
-rw-r--r--lang/php5/patches/patch-ak150
1 files changed, 145 insertions, 5 deletions
diff --git a/lang/php5/patches/patch-ak b/lang/php5/patches/patch-ak
index 246b8b4cfa5..094544f206c 100644
--- a/lang/php5/patches/patch-ak
+++ b/lang/php5/patches/patch-ak
@@ -1,8 +1,16 @@
-$NetBSD: patch-ak,v 1.3 2006/11/06 22:06:35 jdolecek Exp $
+$NetBSD: patch-ak,v 1.4 2008/03/04 17:13:49 sborrill Exp $
---- ext/imap/php_imap.c.orig 2006-10-05 16:25:41.000000000 +0200
-+++ ext/imap/php_imap.c
-@@ -441,6 +441,11 @@ PHP_MINIT_FUNCTION(imap)
+--- ext/imap/php_imap.c.orig 2007-07-31 01:31:10.000000000 +0100
++++ ext/imap/php_imap.c 2008-03-04 18:14:19.000000000 +0000
+@@ -70,6 +70,7 @@
+ static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC);
+ static void _php_imap_parse_address(ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC);
+ static int _php_imap_address_size(ADDRESS *addresslist);
++static void _php_rfc822_write_address_len (char *dest, ADDRESS *adr, int len);
+
+ /* the gets we use */
+ static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md);
+@@ -452,6 +453,11 @@
{
unsigned long sa_all = SA_MESSAGES | SA_RECENT | SA_UNSEEN | SA_UIDNEXT | SA_UIDVALIDITY;
@@ -14,7 +22,7 @@ $NetBSD: patch-ak,v 1.3 2006/11/06 22:06:35 jdolecek Exp $
#ifndef PHP_WIN32
mail_link(&unixdriver); /* link in the unix driver */
mail_link(&mhdriver); /* link in the mh driver */
-@@ -456,6 +461,10 @@ PHP_MINIT_FUNCTION(imap)
+@@ -467,6 +473,10 @@
mail_link(&tenexdriver); /* link in the tenex driver */
mail_link(&mtxdriver); /* link in the mtx driver */
mail_link(&dummydriver); /* link in the dummy driver */
@@ -25,3 +33,135 @@ $NetBSD: patch-ak,v 1.3 2006/11/06 22:06:35 jdolecek Exp $
#ifndef PHP_WIN32
auth_link(&auth_log); /* link in the log authenticator */
+@@ -1603,18 +1613,21 @@
+ }
+
+ PHP_IMAP_CHECK_MSGNO(Z_LVAL_PP(msgno));
+-
++ printf("mail_fetchstructure\n");
+ if (mail_fetchstructure(imap_le_struct->imap_stream, Z_LVAL_PP(msgno), NIL)) {
+ cache = mail_elt(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
+ } else {
+ RETURN_FALSE;
+ }
+
++ printf("mail_fetchenvelope a\n");
+ en = mail_fetchenvelope(imap_le_struct->imap_stream, Z_LVAL_PP(msgno));
++ printf("mail_fetchenvelope b\n");
+
+ /* call a function to parse all the text, so that we can use the
+ same function to parse text from other sources */
+ _php_make_header_object(return_value, en TSRMLS_CC);
++ printf("mail_fetchenvelope c\n");
+
+ /* now run through properties that are only going to be returned
+ from a server, not text headers */
+@@ -1624,6 +1637,7 @@
+ add_property_string(return_value, "Answered", cache->answered ? "A" : " ", 1);
+ add_property_string(return_value, "Deleted", cache->deleted ? "D" : " ", 1);
+ add_property_string(return_value, "Draft", cache->draft ? "X" : " ", 1);
++ printf("mail_fetchenvelope d\n");
+
+ snprintf(dummy, sizeof(dummy), "%4ld", cache->msgno);
+ add_property_string(return_value, "Msgno", dummy, 1);
+@@ -1646,6 +1660,7 @@
+ mail_fetchsubject(fulladdress, imap_le_struct->imap_stream, Z_LVAL_PP(msgno), Z_LVAL_PP(subjectlength));
+ add_property_string(return_value, "fetchsubject", fulladdress, 1);
+ }
++ printf("mail_fetchenvelope e\n");
+ }
+ /* }}} */
+
+@@ -2105,7 +2120,6 @@
+ zval **mailbox, **host, **personal;
+ ADDRESS *addr;
+ char string[MAILTMPLEN];
+-
+ if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &mailbox, &host, &personal) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+@@ -2137,7 +2151,7 @@
+ }
+
+ string[0]='\0';
+- rfc822_write_address(string, addr);
++ _php_rfc822_write_address_len(string, addr, sizeof(string));
+ RETVAL_STRING(string, 1);
+ }
+ /* }}} */
+@@ -2906,13 +2920,13 @@
+ if (env->from && _php_imap_address_size(env->from) < MAILTMPLEN) {
+ env->from->next=NULL;
+ address[0] = '\0';
+- rfc822_write_address(address, env->from);
++ _php_rfc822_write_address_len(address, env->from, sizeof(address));
+ add_property_string(myoverview, "from", address, 1);
+ }
+ if (env->to && _php_imap_address_size(env->to) < MAILTMPLEN) {
+ env->to->next = NULL;
+ address[0] = '\0';
+- rfc822_write_address(address, env->to);
++ _php_rfc822_write_address_len(address, env->to, sizeof(address));
+ add_property_string(myoverview, "to", address, 1);
+ }
+ if (env->date) {
+@@ -3868,6 +3882,7 @@
+ ret += _php_rfc822_len(tmp->mailbox);
+ ret += _php_rfc822_len(tmp->host);
+ num_ent++;
++ printf("%d:%s %s %s %s\n",num_ent,tmp->personal,tmp->adl,tmp->mailbox,tmp->host);
+ } while ((tmp = tmp->next));
+
+ /*
+@@ -3883,6 +3898,33 @@
+ /* }}} */
+
+
++/* {{{ _php_rfc822_soutr
++ */
++static long _php_rfc822_soutr (void *stream,char *string)
++{
++ return NIL;
++}
++
++/* }}} */
++
++
++/* {{{ _php_rfc822_write_address_len
++ */
++static void _php_rfc822_write_address_len ( char *dest, ADDRESS *adr, int len)
++{
++ RFC822BUFFER buf;
++ buf.beg = dest;
++ buf.cur = buf.beg;
++ buf.end = buf.beg + len - 1;
++ buf.s = NIL;
++ buf.f = _php_rfc822_soutr;
++ rfc822_output_address_list (&buf, adr, 0, NIL);
++ *buf.cur = '\0';
++}
++
++/* }}} */
++
++
+ /* {{{ _php_imap_parse_address
+ */
+ static void _php_imap_parse_address (ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC)
+@@ -3891,13 +3933,15 @@
+ zval *tmpvals;
+ char *tmpstr;
+ int len=0;
+-
++
++
+ addresstmp = addresslist;
+
+ if ((len = _php_imap_address_size(addresstmp))) {
+ tmpstr = (char *) pemalloc(len + 1, 1);
+ tmpstr[0] = '\0';
+- rfc822_write_address(tmpstr, addresstmp);
++
++ _php_rfc822_write_address_len(tmpstr, addresstmp, len);
+ *fulladdress = tmpstr;
+ } else {
+ *fulladdress = NULL;