diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:34:59 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:34:59 -0400 |
| commit | ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (patch) | |
| tree | acdb9a8816483652a9db1a47db71df5df43707c5 /ext/imap | |
| parent | 10f5b47dc7c1cf2b9a00991629f43652710322d3 (diff) | |
| download | php-ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61.tar.gz | |
Imported Upstream version 5.1.1upstream/5.1.1
Diffstat (limited to 'ext/imap')
| -rw-r--r-- | ext/imap/config.m4 | 14 | ||||
| -rw-r--r-- | ext/imap/config.w32 | 4 | ||||
| -rw-r--r-- | ext/imap/php_imap.c | 37 | ||||
| -rw-r--r-- | ext/imap/php_imap.h | 4 | ||||
| -rw-r--r-- | ext/imap/tests/bug32589.phpt | 34 |
5 files changed, 66 insertions, 27 deletions
diff --git a/ext/imap/config.m4 b/ext/imap/config.m4 index bae0bf2d8..3fb2ba70b 100644 --- a/ext/imap/config.m4 +++ b/ext/imap/config.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.63.2.4 2005/01/11 04:56:44 sniper Exp $ +dnl $Id: config.m4,v 1.69 2005/05/29 23:16:41 sniper Exp $ dnl AC_DEFUN([IMAP_INC_CHK],[if test -r "$i$1/c-client.h"; then @@ -86,13 +86,13 @@ AC_DEFUN([PHP_IMAP_SSL_CHK], [ PHP_ARG_WITH(imap,for IMAP support, -[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix.]) +[ --with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix]) PHP_ARG_WITH(kerberos,for IMAP Kerberos support, -[ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix.], no, no) +[ --with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix], no, no) PHP_ARG_WITH(imap-ssl,for IMAP SSL support, -[ --with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix.], no, no) +[ --with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix], no, no) if test "$PHP_IMAP" != "no"; then @@ -148,13 +148,13 @@ if test "$PHP_IMAP" != "no"; then 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/lib/c-client.a"; then - ln -s "$IMAP_DIR/lib/c-client.a" "$IMAP_DIR/lib/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(lib) + IMAP_LIB_CHK($PHP_LIBDIR) IMAP_LIB_CHK(c-client) done diff --git a/ext/imap/config.w32 b/ext/imap/config.w32 index 2f905402a..447e1e67f 100644 --- a/ext/imap/config.w32 +++ b/ext/imap/config.w32 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.3 2003/12/22 23:30:20 fmk Exp $ +// $Id: config.w32,v 1.4 2005/08/01 20:55:31 edink Exp $ // vim:ft=javascript ARG_WITH("imap", "IMAP Support", "no"); @@ -13,7 +13,7 @@ if (PHP_IMAP == "yes") { CHECK_LIB("crypt32.lib", "imap"); EXTENSION("imap", "php_imap.c"); - ADD_FLAG("CFLAGS_IMAP", "/D HAVE_IMAP2000=1"); + ADD_FLAG("CFLAGS_IMAP", "/D HAVE_IMAP2000=1 /D HAVE_IMAP2004=1 /D HAVE_IMAP_SSL=1"); AC_DEFINE('HAVE_IMAP', 1, 'Have IMAP support', true); } else { WARNING("imap not enabled; libraries and headers not found"); diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index bf261c2c8..50f4cf41d 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | + | Copyright (c) 1997-2005 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 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 <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: php_imap.c,v 1.184.2.20 2005/08/30 22:03:42 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.208.2.1 2005/08/30 22:03:28 iliaa Exp $ */ #define IMAP41 @@ -113,7 +113,7 @@ function_entry imap_functions[] = { PHP_FE(imap_qprint, NULL) PHP_FE(imap_8bit, NULL) PHP_FE(imap_binary, NULL) - PHP_FE(imap_utf8, NULL) + PHP_FE(imap_utf8, NULL) PHP_FE(imap_status, NULL) PHP_FE(imap_mailboxmsginfo, NULL) PHP_FE(imap_setflag_full, NULL) @@ -132,7 +132,7 @@ function_entry imap_functions[] = { PHP_FE(imap_utf7_encode, NULL) PHP_FE(imap_mime_header_decode, NULL) PHP_FE(imap_thread, NULL) - PHP_FE(imap_timeout, NULL) + PHP_FE(imap_timeout, NULL) #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) PHP_FE(imap_get_quota, NULL) @@ -3135,6 +3135,12 @@ PHP_FUNCTION(imap_mail_compose) goto done; } + if (bod && bod->type == TYPEMULTIPART && (!bod->nested.part || !bod->nested.part->next)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot generate multipart e-mail without components."); + RETVAL_FALSE; + goto done; + } + rfc822_encode_body_7bit(env, topbod); rfc822_header (tmp, env, topbod); @@ -3165,8 +3171,7 @@ PHP_FUNCTION(imap_mail_compose) efree(tempstring); } else { - mystring = emalloc(strlen(tmp) + 1); - strcpy(mystring, tmp); + mystring = estrdup(tmp); } bod = topbod; @@ -3190,8 +3195,9 @@ PHP_FUNCTION(imap_mail_compose) /* for each part */ do { + t=tmp; /* build cookie */ - sprintf (t=tmp, "--%s%s", cookie, CRLF); + sprintf (t, "--%s%s", cookie, CRLF); /* append mini-header */ rfc822_write_body_header(&t, &part->body); @@ -3201,37 +3207,36 @@ PHP_FUNCTION(imap_mail_compose) /* output cookie, mini-header, and contents */ tempstring=emalloc(strlen(mystring)+strlen(tmp)+1); - strcpy(tempstring, mystring); + sprintf(tempstring, "%s%s", mystring, tmp); efree(mystring); mystring=tempstring; - strcat(mystring, tmp); bod=&part->body; - tempstring = emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1); + tempstring=emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1); sprintf(tempstring, "%s%s%s", mystring, bod->contents.text.data, CRLF); efree(mystring); - mystring = tempstring; + mystring=tempstring; } while ((part = part->next)); /* until done */ /* output trailing cookie */ sprintf(tmp, "--%s--", cookie); - tempstring = emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1); + tempstring=emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1); sprintf(tempstring, "%s%s%s", mystring, tmp, CRLF); efree(mystring); - mystring = tempstring; + mystring=tempstring; } else if (bod) { tempstring = emalloc(strlen(bod->contents.text.data)+strlen(CRLF)+strlen(mystring)+1); sprintf(tempstring, "%s%s%s", mystring, bod->contents.text.data, CRLF); efree(mystring); - mystring = tempstring; + mystring=tempstring; } else { efree(mystring); RETVAL_FALSE; goto done; } - RETVAL_STRING(tempstring, 0); + RETVAL_STRING(tempstring, 0); done: mail_free_body(&topbod); mail_free_envelope(&env); @@ -3342,7 +3347,7 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char * strcat(bufferHeader, headers); } - if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, bufferHeader, subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) { + if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, bufferHeader, subject, bufferTo, message, bufferCc, bufferBcc, rpath TSRMLS_CC) != SUCCESS) { if (tsm_errmsg) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tsm_errmsg); efree(tsm_errmsg); diff --git a/ext/imap/php_imap.h b/ext/imap/php_imap.h index 1ba5a427d..504620660 100644 --- a/ext/imap/php_imap.h +++ b/ext/imap/php_imap.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2004 The PHP Group | + | Copyright (c) 1997-2005 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_imap.h,v 1.31 2004/01/08 17:32:12 sniper Exp $ */ +/* $Id: php_imap.h,v 1.32 2005/08/03 14:07:17 sniper Exp $ */ #ifndef PHP_IMAP_H #define PHP_IMAP_H diff --git a/ext/imap/tests/bug32589.phpt b/ext/imap/tests/bug32589.phpt new file mode 100644 index 000000000..c5030e897 --- /dev/null +++ b/ext/imap/tests/bug32589.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #32589 (crash inside imap_mail_compose() function) +--SKIPIF-- +<?php + if (!extension_loaded("imap")) { + die("skip imap extension not available"); + } +?> +--FILE-- +<?php +$m_envelope["To"] = "mail@example.com"; +$m_part1["type"] = TYPEMULTIPART; +$m_part1["subtype"] = "mixed"; +$m_part2["type"] = TYPETEXT; +$m_part2["subtype"] = "plain"; +$m_part2["description"] = "text_message"; + +$m_part2["charset"] = "ISO-8859-2"; + +$m_part2["contents.data"] = "hello"; +$m_body[1] = $m_part1; +$m_body[2] = $m_part2; +echo imap_mail_compose($m_envelope, $m_body); +?> +--EXPECTF-- +MIME-Version: 1.0 +Content-Type: MULTIPART/mixed; BOUNDARY="%s" + +%s +Content-Type: TEXT/plain; CHARSET=ISO-8859-2 +Content-Description: text_message + +hello +%s |
