[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Tue Jun 17 09:59:44 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed a typo in the check Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.171 php4/ext/imap/php_imap.c:1.172 --- php4/ext/imap/php_imap.c:1.171 Mon Jun 16 13:41:52 2003 +++ php4/ext/imap/php_imap.cTue Jun 17 09:59:44 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.171 2003/06/16 17:41:52 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.172 2003/06/17 13:59:44 iliaa Exp $ */ #define IMAP41 @@ -2749,13 +2749,13 @@ if (env-subject) { add_property_string(myoverview, subject, env-subject, 1); } - if (env-from _php_imap_address_size(env-from) = MAILTMPLEN) { + if (env-from _php_imap_address_size(env-from) MAILTMPLEN) { env-from-next=NULL; address[0] = '\0'; rfc822_write_address(address, env-from); add_property_string(myoverview, from, address, 1); } - if (env-to _php_imap_address_size(env-from) = MAILTMPLEN) { + if (env-to _php_imap_address_size(env-from) MAILTMPLEN) { env-to-next = NULL; address[0] = '\0'; rfc822_write_address(address, env-to); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Fri Jun 13 10:56:07 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Added missing function proto Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.167 php4/ext/imap/php_imap.c:1.168 --- php4/ext/imap/php_imap.c:1.167 Fri Jun 13 10:39:22 2003 +++ php4/ext/imap/php_imap.cFri Jun 13 10:56:07 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.167 2003/06/13 14:39:22 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.168 2003/06/13 14:56:07 iliaa Exp $ */ #define IMAP41 @@ -4023,6 +4023,8 @@ } /* }}} */ +/* {{{ proto mixed imap_timeout(int timeout_type [, int timeout]) + Set or fetch imap timeout */ PHP_FUNCTION (imap_timeout) { long ttype, timeout=-1; @@ -4078,6 +4080,7 @@ RETURN_FALSE; } } +/* }}} */ /* {{{ Interfaces to C-client */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Fri Jun 13 11:01:18 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Busted by the CS police. Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.168 php4/ext/imap/php_imap.c:1.169 --- php4/ext/imap/php_imap.c:1.168 Fri Jun 13 10:56:07 2003 +++ php4/ext/imap/php_imap.cFri Jun 13 11:01:18 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.168 2003/06/13 14:56:07 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.169 2003/06/13 15:01:18 iliaa Exp $ */ #define IMAP41 @@ -3985,7 +3985,7 @@ /* {{{ proto array imap_thread(resource stream_id [, int options]) Return threaded by REFERENCES tree */ -PHP_FUNCTION (imap_thread) +PHP_FUNCTION(imap_thread) { zval **streamind, **search_flags; pils *imap_le_struct; @@ -4025,7 +4025,7 @@ /* {{{ proto mixed imap_timeout(int timeout_type [, int timeout]) Set or fetch imap timeout */ -PHP_FUNCTION (imap_timeout) +PHP_FUNCTION(imap_timeout) { long ttype, timeout=-1; int timeout_type; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Thu Jun 12 15:46:44 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed bug #22505 (Allow imap_sort() and imap_search() to specify a charset) Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.165 php4/ext/imap/php_imap.c:1.166 --- php4/ext/imap/php_imap.c:1.165 Tue Jun 10 16:03:30 2003 +++ php4/ext/imap/php_imap.cThu Jun 12 15:46:44 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.165 2003/06/10 20:03:30 imajes Exp $ */ +/* $Id: php_imap.c,v 1.166 2003/06/12 19:46:44 iliaa Exp $ */ #define IMAP41 @@ -2393,11 +2393,11 @@ } /* }}} */ -/* {{{ proto array imap_sort(resource stream_id, int criteria, int reverse [, int options [, string search_criteria]]) +/* {{{ proto array imap_sort(resource stream_id, int criteria, int reverse [, int options [, string search_criteria [, string charset]]]) Sort an array of message headers, optionally including only messages that meet specified criteria. */ PHP_FUNCTION(imap_sort) { - zval **streamind, **pgm, **rev, **flags, **criteria; + zval **streamind, **pgm, **rev, **flags, **criteria, **charset; pils *imap_le_struct; unsigned long *slst, *sl; char *search_criteria; @@ -2405,7 +2405,7 @@ SEARCHPGM *spg=NIL; int myargc = ZEND_NUM_ARGS(); - if (myargc 3 || myargc 5 || zend_get_parameters_ex(myargc, streamind, pgm, rev, flags, criteria) == FAILURE) { + if (myargc 3 || myargc 6 || zend_get_parameters_ex(myargc, streamind, pgm, rev, flags, criteria, charset) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -2420,10 +2420,13 @@ if (myargc = 4) { convert_to_long_ex(flags); } - if (myargc == 5) { + if (myargc = 5) { search_criteria = estrndup(Z_STRVAL_PP(criteria), Z_STRLEN_PP(criteria)); spg = mail_criteria(search_criteria); efree(search_criteria); + if (myargc == 6) { + convert_to_string_ex(charset); + } } else { spg = mail_newsearchpgm(); } @@ -2433,7 +2436,7 @@ mypgm-function = (short) Z_LVAL_PP(pgm); mypgm-next = NIL; - slst = mail_sort(imap_le_struct-imap_stream, NIL, spg, mypgm, myargc = 4 ? Z_LVAL_PP(flags) : NIL); + slst = mail_sort(imap_le_struct-imap_stream, (myargc == 6 ? Z_STRVAL_PP(charset) : NIL), spg, mypgm, (myargc = 4 ? Z_LVAL_PP(flags) : NIL)); if (spg) { mail_free_searchpgm(spg); @@ -3381,18 +3384,18 @@ } /* }}} */ -/* {{{ proto array imap_search(resource stream_id, string criteria [, int options]) +/* {{{ proto array imap_search(resource stream_id, string criteria [, int options [, string charset]]) Return a list of messages matching the given criteria */ PHP_FUNCTION(imap_search) { - zval **streamind, **criteria, **search_flags; + zval **streamind, **criteria, **search_flags, **charset; pils *imap_le_struct; long flags; char *search_criteria; MESSAGELIST *cur; int argc = ZEND_NUM_ARGS(); - if (argc 2 || argc 3 || zend_get_parameters_ex(argc, streamind, criteria, search_flags) == FAILURE) { + if (argc 2 || argc 4 || zend_get_parameters_ex(argc, streamind, criteria, search_flags, charset) == FAILURE) { ZEND_WRONG_PARAM_COUNT(); } @@ -3406,10 +3409,13 @@ } else { convert_to_long_ex(search_flags); flags = Z_LVAL_PP(search_flags); + if (argc == 4) { + convert_to_string_ex(charset); + } } IMAPG(imap_messages) = IMAPG(imap_messages_tail) = NIL; - mail_search_full(imap_le_struct-imap_stream, NIL, mail_criteria(search_criteria), flags); + mail_search_full(imap_le_struct-imap_stream, (argc == 4 ? Z_STRVAL_PP(charset) : NIL), mail_criteria(search_criteria), flags); if (IMAPG(imap_messages) == NIL) { efree(search_criteria); RETURN_FALSE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
moriyoshi Mon Mar 31 15:36:47 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed proto to sync with the documentation Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.160 php4/ext/imap/php_imap.c:1.161 --- php4/ext/imap/php_imap.c:1.160 Sat Feb 15 22:48:44 2003 +++ php4/ext/imap/php_imap.cMon Mar 31 15:36:46 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.160 2003/02/16 03:48:44 wez Exp $ */ +/* $Id: php_imap.c,v 1.161 2003/03/31 20:36:46 moriyoshi Exp $ */ #define IMAP41 @@ -1981,8 +1981,8 @@ } /* }}} */ -/* {{{ proto string imap_utf8(string string) - Convert a string to UTF-8 */ +/* {{{ proto string imap_utf8(string mime_encoded_text) + Convert a mime-encoded text to UTF-8 */ PHP_FUNCTION(imap_utf8) { zval **str; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Tue Feb 11 17:57:22 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed bug #22048 (crash in imap_headers when the e-mail contains an abnormally large number of special characters). Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.158 php4/ext/imap/php_imap.c:1.159 --- php4/ext/imap/php_imap.c:1.158 Mon Feb 3 16:24:32 2003 +++ php4/ext/imap/php_imap.cTue Feb 11 17:57:22 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.158 2003/02/03 21:24:32 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.159 2003/02/11 22:57:22 iliaa Exp $ */ #define IMAP41 @@ -3549,6 +3549,34 @@ } /* }}} */ +/* {{{ _php_rfc822_len + * Calculate string length based on imap's rfc822_cat function. + */ +static int _php_rfc822_len(char *str) +{ + int len; + char *p; + + if (!str || !*str) { + return 0; + } + + /* strings with special characters will need to be quoted, as a safety measure +we +* add 2 bytes for the quotes just in case. +*/ + len = strlen(str) + 2; + p = str; + /* rfc822_cat() will escape all and \ characters, therefor we need to +increase +* our buffer length to account for these characters. +*/ + while ((p = strpbrk(p, \\\))) { + p++; + len++; + } + + return len; +} +/* }}} */ /* Support Functions */ /* {{{ _php_imap_get_address_size @@ -3561,10 +3589,10 @@ tmp = addresslist; if (tmp) do { - ret += (tmp-personal) ? strlen(tmp-personal) : 0; - ret += (tmp-adl) ? strlen(tmp-adl) : 0; - ret += (tmp-mailbox) ? strlen(tmp-mailbox) : 0; - ret += (tmp-host) ? strlen(tmp-host) : 0; + ret += _php_rfc822_len(tmp-personal); + ret += _php_rfc822_len(tmp-adl); + ret += _php_rfc822_len(tmp-mailbox); + ret += _php_rfc822_len(tmp-host); num_ent++; } while ((tmp = tmp-next)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Mon Feb 3 16:24:32 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed bug #22022 (Crash in imap_mail_compose() if the body is an empty array). Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.157 php4/ext/imap/php_imap.c:1.158 --- php4/ext/imap/php_imap.c:1.157 Wed Jan 29 21:33:14 2003 +++ php4/ext/imap/php_imap.cMon Feb 3 16:24:32 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.157 2003/01/30 02:33:14 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.158 2003/02/03 21:24:32 iliaa Exp $ */ #define IMAP41 @@ -2807,7 +2807,10 @@ } zend_hash_internal_pointer_reset(Z_ARRVAL_PP(body)); - zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) data); + if (zend_hash_get_current_data(Z_ARRVAL_PP(body), (void **) data) != SUCCESS) +{ + php_error_docref(NULL TSRMLS_CC, E_WARNING, body parameter cannot be +empty); + RETURN_FALSE; + } zend_hash_get_current_key(Z_ARRVAL_PP(body), key, ind, 0); /* FIXME: is this necessary? we're not using key/ind */ if (Z_TYPE_PP(data) == IS_ARRAY) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
sniper Fri Jan 24 05:12:55 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: - Fixed stupid typo.. # I will test before commit, I will test before commit... Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.155 php4/ext/imap/php_imap.c:1.156 --- php4/ext/imap/php_imap.c:1.155 Thu Jan 23 11:29:49 2003 +++ php4/ext/imap/php_imap.cFri Jan 24 05:12:55 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.155 2003/01/23 16:29:49 sniper Exp $ */ +/* $Id: php_imap.c,v 1.156 2003/01/24 10:12:55 sniper Exp $ */ #define IMAP41 @@ -418,7 +418,7 @@ #ifndef PHP_WIN32 auth_link(auth_log); /* link in the log authenticator */ auth_link(auth_md5); /* link in the cram-md5 authenticator */ -#ifdef HAVE_IMAP_KRB defined(HAVE_IMAP_AUTH_GSS) +#if HAVE_IMAP_KRB defined(HAVE_IMAP_AUTH_GSS) auth_link(auth_gss); /* link in the gss authenticator */ #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Mon Jan 20 14:41:59 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Changed php_error to php_error_docref. Removed pointless memory allocation checks. Memory leak fix inside quota functions. Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.152 php4/ext/imap/php_imap.c:1.153 --- php4/ext/imap/php_imap.c:1.152 Sat Jan 18 02:00:47 2003 +++ php4/ext/imap/php_imap.cMon Jan 20 14:41:58 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.152 2003/01/18 07:00:47 sniper Exp $ */ +/* $Id: php_imap.c,v 1.153 2003/01/20 19:41:58 iliaa Exp $ */ #define IMAP41 @@ -609,7 +609,7 @@ if (EG(error_reporting) E_NOTICE) { ecur = IMAPG(imap_errorstack); while (ecur != NIL) { - php_error(E_NOTICE, %s(): %s (errflg=%d), get_active_function_name(TSRMLS_C), ecur-LTEXT, ecur-errflg); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, %s +(errflg=%d), ecur-LTEXT, ecur-errflg); ecur = ecur-next; } } @@ -621,7 +621,7 @@ if (EG(error_reporting) E_NOTICE) { acur = IMAPG(imap_alertstack); while (acur != NIL) { - php_error(E_NOTICE, %s(): %s, get_active_function_name(TSRMLS_C), acur-LTEXT); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, %s, +acur-LTEXT); acur = acur-next; } } @@ -698,7 +698,7 @@ imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags); if (imap_stream == NIL) { - php_error(E_WARNING, %s(): Couldn't open stream %s, get_active_function_name(TSRMLS_C), Z_STRVAL_PP(mailbox)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't open stream %s, +Z_STRVAL_PP(mailbox)); efree(IMAPG(imap_user)); IMAPG(imap_user) = 0; efree(IMAPG(imap_password)); IMAPG(imap_password) = 0; RETURN_FALSE; @@ -750,7 +750,7 @@ } imap_stream = mail_open(imap_le_struct-imap_stream, Z_STRVAL_PP(mailbox), flags); if (imap_stream == NIL) { - php_error(E_WARNING, %s(): Couldn't re-open stream, get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't re-open stream); RETURN_FALSE; } imap_le_struct-imap_stream = imap_stream; @@ -857,19 +857,16 @@ convert_to_string_ex(qroot); - MAKE_STD_ZVAL(IMAPG(quota_return)); - array_init(IMAPG(quota_return)); + array_init(return_value); + *IMAPG(quota_return) = *return_value; /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); if(!imap_getquota(imap_le_struct-imap_stream, Z_STRVAL_PP(qroot))) { - php_error(E_WARNING, %s(): c-client imap_getquota failed, get_active_function_name(TSRMLS_C)); - FREE_ZVAL(IMAPG(quota_return)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, c-client imap_getquota +failed); + zval_dtor(return_value); RETURN_FALSE; } - - *return_value = *IMAPG(quota_return); - FREE_ZVAL(IMAPG(quota_return)); } /* }}} */ @@ -888,19 +885,16 @@ convert_to_string_ex(mbox); - MAKE_STD_ZVAL(IMAPG(quota_return)); - array_init(IMAPG(quota_return)); + array_init(return_value); + *IMAPG(quota_return) = *return_value; /* set the callback for the GET_QUOTAROOT function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); if(!imap_getquotaroot(imap_le_struct-imap_stream, Z_STRVAL_PP(mbox))) { - php_error(E_WARNING, %s(): c-client imap_getquotaroot failed, get_active_function_name(TSRMLS_C)); - FREE_ZVAL(IMAPG(quota_return)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, c-client +imap_getquotaroot failed); + zval_dtor(return_value); RETURN_FALSE; } - - *return_value = *IMAPG(quota_return); - FREE_ZVAL(IMAPG(quota_return)); } /* }}} */ @@ -1081,7 +1075,7 @@ msgindex = Z_LVAL_PP(msgno); } if ((msgindex 1) || ((unsigned) msgindex imap_le_struct-imap_stream-nmsgs)) { - php_error(E_WARNING, %s(): Bad message number, get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, Bad message number); RETURN_FALSE; } @@ -1454,7 +1448,7 @@ } if (!Z_LVAL_PP(msgno) || Z_LVAL_PP(msgno)
[PHP-CVS] cvs: php4 /ext/imap php_imap.c php_imap.h
iliaa Mon Jan 20 16:28:10 2003 EDT Modified files: /php4/ext/imap php_imap.c php_imap.h Log: quota function fixes. Thanks Wez. Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.153 php4/ext/imap/php_imap.c:1.154 --- php4/ext/imap/php_imap.c:1.153 Mon Jan 20 14:41:58 2003 +++ php4/ext/imap/php_imap.cMon Jan 20 16:28:09 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.153 2003/01/20 19:41:58 iliaa Exp $ */ +/* $Id: php_imap.c,v 1.154 2003/01/20 21:28:09 iliaa Exp $ */ #define IMAP41 @@ -338,8 +338,11 @@ */ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist) { - zval *t_map; + zval *t_map, *return_value; TSRMLS_FETCH(); + + return_value = *IMAPG(quota_return); + /* put parsing code here */ for(; qlist; qlist = qlist-next) { MAKE_STD_ZVAL(t_map); @@ -347,13 +350,13 @@ if (strncmp(qlist-name, STORAGE, 7) == 0) { /* this is to add backwards compatibility */ - add_assoc_long_ex(IMAPG(quota_return), usage, sizeof(usage), qlist-usage); - add_assoc_long_ex(IMAPG(quota_return), limit, sizeof(limit), qlist-limit); + add_assoc_long_ex(return_value, usage, sizeof(usage), +qlist-usage); + add_assoc_long_ex(return_value, limit, sizeof(limit), +qlist-limit); } add_assoc_long_ex(t_map, usage, sizeof(usage), qlist-usage); add_assoc_long_ex(t_map, limit, sizeof(limit), qlist-limit); - add_assoc_zval_ex(IMAPG(quota_return), qlist-name, strlen(qlist-name)+1, t_map); + add_assoc_zval_ex(return_value, qlist-name, strlen(qlist-name)+1, +t_map); } } /* }}} */ @@ -858,7 +861,7 @@ convert_to_string_ex(qroot); array_init(return_value); - *IMAPG(quota_return) = *return_value; + IMAPG(quota_return) = return_value; /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); @@ -886,7 +889,7 @@ convert_to_string_ex(mbox); array_init(return_value); - *IMAPG(quota_return) = *return_value; + IMAPG(quota_return) = return_value; /* set the callback for the GET_QUOTAROOT function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); Index: php4/ext/imap/php_imap.h diff -u php4/ext/imap/php_imap.h:1.26 php4/ext/imap/php_imap.h:1.27 --- php4/ext/imap/php_imap.h:1.26 Tue Dec 31 11:06:45 2002 +++ php4/ext/imap/php_imap.hMon Jan 20 16:28:09 2003 @@ -27,7 +27,7 @@ +--+ */ -/* $Id: php_imap.h,v 1.26 2002/12/31 16:06:45 sebastian Exp $ */ +/* $Id: php_imap.h,v 1.27 2003/01/20 21:28:09 iliaa Exp $ */ #ifndef PHP_IMAP_H #define PHP_IMAP_H @@ -200,7 +200,7 @@ unsigned long status_uidnext; unsigned long status_uidvalidity; #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) - zval *quota_return; + zval **quota_return; #endif ZEND_END_MODULE_GLOBALS(imap) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Fri Jan 17 11:07:39 2003 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed memory leaks in imap_get_quota imap_get_quotaroot. Removed pointless checks around array_init(). Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.150 php4/ext/imap/php_imap.c:1.151 --- php4/ext/imap/php_imap.c:1.150 Sat Jan 4 15:06:32 2003 +++ php4/ext/imap/php_imap.cFri Jan 17 11:07:39 2003 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.150 2003/01/04 20:06:32 helly Exp $ */ +/* $Id: php_imap.c,v 1.151 2003/01/17 16:07:39 iliaa Exp $ */ #define IMAP41 @@ -343,12 +343,7 @@ /* put parsing code here */ for(; qlist; qlist = qlist-next) { MAKE_STD_ZVAL(t_map); - if (array_init(t_map) == FAILURE) { - php_error(E_WARNING, Unable to allocate t_map memory); - FREE_ZVAL(t_map); - FREE_ZVAL(IMAPG(quota_return)); - return; - } + array_init(t_map); if (strncmp(qlist-name, STORAGE, 7) == 0) { /* this is to add backwards compatibility */ @@ -859,16 +854,13 @@ convert_to_string_ex(qroot); MAKE_STD_ZVAL(IMAPG(quota_return)); - if (array_init(IMAPG(quota_return)) == FAILURE) { - php_error(E_WARNING, %s(): Unable to allocate array memory, get_active_function_name(TSRMLS_C)); - FREE_ZVAL(IMAPG(quota_return)); - RETURN_FALSE; - } + array_init(IMAPG(quota_return)); /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); if(!imap_getquota(imap_le_struct-imap_stream, Z_STRVAL_PP(qroot))) { php_error(E_WARNING, %s(): c-client imap_getquota failed, get_active_function_name(TSRMLS_C)); + FREE_ZVAL(IMAPG(quota_return)); RETURN_FALSE; } @@ -893,16 +885,13 @@ convert_to_string_ex(mbox); MAKE_STD_ZVAL(IMAPG(quota_return)); - if (array_init(IMAPG(quota_return)) == FAILURE) { - php_error(E_WARNING, %s(): Unable to allocate array memory, get_active_function_name(TSRMLS_C)); - FREE_ZVAL(IMAPG(quota_return)); - RETURN_FALSE; - } + array_init(IMAPG(quota_return)); /* set the callback for the GET_QUOTAROOT function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); if(!imap_getquotaroot(imap_le_struct-imap_stream, Z_STRVAL_PP(mbox))) { php_error(E_WARNING, %s(): c-client imap_getquotaroot failed, get_active_function_name(TSRMLS_C)); + FREE_ZVAL(IMAPG(quota_return)); RETURN_FALSE; } @@ -1028,9 +1017,7 @@ ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, imap, le_imap); /* Initialize return array */ - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); for (msgno = 1; msgno = imap_le_struct-imap_stream-nmsgs; msgno++) { MESSAGECACHE * cache = mail_elt (imap_le_struct-imap_stream, msgno); @@ -1971,9 +1958,7 @@ rfc822_parse_adrlist(env-to, Z_STRVAL_PP(str), Z_STRVAL_PP(defaulthost)); - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); addresstmp = env-to; @@ -3493,9 +3478,7 @@ convert_to_string_ex(str); - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } + array_init(return_value); string = Z_STRVAL_PP(str); end = Z_STRLEN_PP(str); @@ -3901,7 +3884,7 @@ long numNodes = 0; char buf[25]; - if(array_init(*tree) != SUCCESS) return FAILURE; + array_init(*tree); build_thread_tree_helper(top, *tree, numNodes, buf); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/imap php_imap.c
Hey, Unless you are sure there can't be a buffer overrun in this strcat() call please use strlcat(). In any case, I think using strlcat() should be prefered. Andi At 10:52 PM 12/6/2002 +, Frank M. Kromann wrote: fmk Fri Dec 6 17:52:31 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixing a possible strcat on a NULL pointer Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.146 php4/ext/imap/php_imap.c:1.147 --- php4/ext/imap/php_imap.c:1.146 Sat Nov 30 16:49:20 2002 +++ php4/ext/imap/php_imap.cFri Dec 6 17:52:31 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.146 2002/11/30 21:49:20 fmk Exp $ */ +/* $Id: php_imap.c,v 1.147 2002/12/06 22:52:31 fmk Exp $ */ #define IMAP41 @@ -3222,7 +3222,8 @@ } } - strcat(bufferHeader, headers); + if (headers *headers) + strcat(bufferHeader, headers); if (TSendMail(INI_STR(SMTP), tsm_err, tsm_errmsg, bufferHeader, subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) { if (tsm_errmsg) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
fmk Sat Dec 7 01:05:06 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: fixing code style Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.147 php4/ext/imap/php_imap.c:1.148 --- php4/ext/imap/php_imap.c:1.147 Fri Dec 6 17:52:31 2002 +++ php4/ext/imap/php_imap.cSat Dec 7 01:05:06 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.147 2002/12/06 22:52:31 fmk Exp $ */ +/* $Id: php_imap.c,v 1.148 2002/12/07 06:05:06 fmk Exp $ */ #define IMAP41 @@ -3147,12 +3147,15 @@ char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = NULL; int offset, bufferLen = 0;; - if (headers) + if (headers) { bufferLen += strlen(headers); - if (to) + } + if (to) { bufferLen += strlen(to) + 6; - if (cc) + } + if (cc) { bufferLen += strlen(cc) + 6; + } bufferHeader = (char *)emalloc(bufferLen); memset(bufferHeader, 0, bufferLen); @@ -3222,8 +3225,9 @@ } } - if (headers *headers) + if (headers *headers) { strcat(bufferHeader, headers); + } if (TSendMail(INI_STR(SMTP), tsm_err, tsm_errmsg, bufferHeader, subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) { if (tsm_errmsg) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
fmk Sat Nov 30 16:49:20 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: Fix the use of personal information in To and Cc headers Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.145 php4/ext/imap/php_imap.c:1.146 --- php4/ext/imap/php_imap.c:1.145 Wed Nov 27 13:52:31 2002 +++ php4/ext/imap/php_imap.cSat Nov 30 16:49:20 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.145 2002/11/27 18:52:31 fmk Exp $ */ +/* $Id: php_imap.c,v 1.146 2002/11/30 21:49:20 fmk Exp $ */ #define IMAP41 @@ -3144,10 +3144,22 @@ char *tempMailTo; char *tsm_errmsg = NULL; ADDRESS *addr; - char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL; - int offset; + char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = +NULL; + int offset, bufferLen = 0;; + if (headers) + bufferLen += strlen(headers); + if (to) + bufferLen += strlen(to) + 6; + if (cc) + bufferLen += strlen(cc) + 6; + + bufferHeader = (char *)emalloc(bufferLen); + memset(bufferHeader, 0, bufferLen); if (to *to) { + strcat(bufferHeader, To: ); + strcat(bufferHeader, to); + strcat(bufferHeader, \r\n); tempMailTo = estrdup(to); bufferTo = (char *)emalloc(strlen(to)); offset = 0; @@ -3168,6 +3180,9 @@ } if (cc *cc) { + strcat(bufferHeader, Cc: ); + strcat(bufferHeader, cc); + strcat(bufferHeader, \r\n); tempMailTo = estrdup(cc); bufferCc = (char *)emalloc(strlen(cc)); offset = 0; @@ -3207,8 +3222,9 @@ } } + strcat(bufferHeader, headers); - if (TSendMail(INI_STR(SMTP), tsm_err, tsm_errmsg, headers, subject, bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) { + if (TSendMail(INI_STR(SMTP), tsm_err, tsm_errmsg, bufferHeader, subject, +bufferTo, message, bufferCc, bufferBcc, rpath) != SUCCESS) { if (tsm_errmsg) { php_error(E_WARNING, %s(): %s, get_active_function_name(TSRMLS_C), tsm_errmsg); efree(tsm_errmsg); @@ -3225,6 +3241,9 @@ } if (bufferBcc) { efree(bufferBcc); + } + if (bufferHeader) { + efree(bufferHeader); } #else if (!INI_STR(sendmail_path)) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
fmk Wed Nov 27 13:52:31 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: free alocated mem. minor changes in the layout Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.144 php4/ext/imap/php_imap.c:1.145 --- php4/ext/imap/php_imap.c:1.144 Tue Nov 26 02:04:31 2002 +++ php4/ext/imap/php_imap.cWed Nov 27 13:52:31 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.144 2002/11/26 07:04:31 fmk Exp $ */ +/* $Id: php_imap.c,v 1.145 2002/11/27 18:52:31 fmk Exp $ */ #define IMAP41 @@ -3162,7 +3162,9 @@ addr = addr-next; } efree(tempMailTo); - if (offset0) bufferTo[offset-1] = 0; + if (offset0) { + bufferTo[offset-1] = 0; + } } if (cc *cc) { @@ -3180,7 +3182,9 @@ addr = addr-next; } efree(tempMailTo); - if (offset0) bufferCc[offset-1] = 0; + if (offset0) { + bufferCc[offset-1] = 0; + } } if (bcc *bcc) { @@ -3198,7 +3202,9 @@ addr = addr-next; } efree(tempMailTo); - if (offset0) bufferBcc[offset-1] = 0; + if (offset0) { + bufferBcc[offset-1] = 0; + } } @@ -3211,8 +3217,15 @@ } return 0; } - if (bufferCc) efree(bufferCc); - if (bufferBcc) efree(bufferBcc); + if (bufferTo) { + efree(bufferTo); + } + if (bufferCc) { + efree(bufferCc); + } + if (bufferBcc) { + efree(bufferBcc); + } #else if (!INI_STR(sendmail_path)) { return 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/imap php_imap.c
MFH? On Tue, 26 Nov 2002, Frank M. Kromann wrote: fmkTue Nov 26 02:04:33 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: Avoid , at the end of each string (to, cc and bcc) Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.143 php4/ext/imap/php_imap.c:1.144 --- php4/ext/imap/php_imap.c:1.143 Mon Nov 25 07:30:23 2002 +++ php4/ext/imap/php_imap.c Tue Nov 26 02:04:31 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.143 2002/11/25 12:30:23 hholzgra Exp $ */ +/* $Id: php_imap.c,v 1.144 2002/11/26 07:04:31 fmk Exp $ */ #define IMAP41 @@ -3162,7 +3162,7 @@ addr = addr-next; } efree(tempMailTo); - bufferTo[offset] = 0; + if (offset0) bufferTo[offset-1] = 0; } if (cc *cc) { @@ -3180,7 +3180,7 @@ addr = addr-next; } efree(tempMailTo); - bufferCc[offset] = 0; + if (offset0) bufferCc[offset-1] = 0; } if (bcc *bcc) { @@ -3198,7 +3198,7 @@ addr = addr-next; } efree(tempMailTo); - bufferBcc[offset] = 0; + if (offset0) bufferBcc[offset-1] = 0; } -- - For Sale! - -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
fmk Tue Nov 26 02:04:33 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: Avoid , at the end of each string (to, cc and bcc) Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.143 php4/ext/imap/php_imap.c:1.144 --- php4/ext/imap/php_imap.c:1.143 Mon Nov 25 07:30:23 2002 +++ php4/ext/imap/php_imap.cTue Nov 26 02:04:31 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.143 2002/11/25 12:30:23 hholzgra Exp $ */ +/* $Id: php_imap.c,v 1.144 2002/11/26 07:04:31 fmk Exp $ */ #define IMAP41 @@ -3162,7 +3162,7 @@ addr = addr-next; } efree(tempMailTo); - bufferTo[offset] = 0; + if (offset0) bufferTo[offset-1] = 0; } if (cc *cc) { @@ -3180,7 +3180,7 @@ addr = addr-next; } efree(tempMailTo); - bufferCc[offset] = 0; + if (offset0) bufferCc[offset-1] = 0; } if (bcc *bcc) { @@ -3198,7 +3198,7 @@ addr = addr-next; } efree(tempMailTo); - bufferBcc[offset] = 0; + if (offset0) bufferBcc[offset-1] = 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/imap php_imap.c
iliaa Tue Oct 8 16:07:53 2002 EDT Modified files: /php4/ext/imap php_imap.c Log: Fixed bug #19280 Index: php4/ext/imap/php_imap.c diff -u php4/ext/imap/php_imap.c:1.140 php4/ext/imap/php_imap.c:1.141 --- php4/ext/imap/php_imap.c:1.140 Wed Sep 18 22:32:48 2002 +++ php4/ext/imap/php_imap.cTue Oct 8 16:07:52 2002 @@ -26,7 +26,7 @@ | PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] | +--+ */ -/* $Id: php_imap.c,v 1.140 2002/09/19 02:32:48 kalowsky Exp $ */ +/* $Id: php_imap.c,v 1.141 2002/10/08 20:07:52 iliaa Exp $ */ #define IMAP41 @@ -58,6 +58,7 @@ #define CRLF \015\012 #define PHP_EXPUNGE 32768 +#define PHP_IMAP_ADDRESS_SIZE_BUF 10 static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC); static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC); @@ -3546,7 +3547,7 @@ static int _php_imap_address_size (ADDRESS *addresslist) { ADDRESS *tmp; - int ret=0; + int ret=0, num_ent=0; tmp = addresslist; @@ -3555,10 +3556,15 @@ ret += (tmp-adl) ? strlen(tmp-adl) : 0; ret += (tmp-mailbox) ? strlen(tmp-mailbox) : 0; ret += (tmp-host) ? strlen(tmp-host) : 0; + num_ent++; } while ((tmp = tmp-next)); - /* rfc822_write_address_full() needs some extra space for ',', etc. */ - ret += (ret) ? MAILTMPLEN : 0; + /* +* rfc822_write_address_full() needs some extra space for ',', etc. +* for this perpouse we allocate additional PHP_IMAP_ADDRESS_SIZE_BUF bytes +* by default this buffer is 10 bytes long + */ + ret += (ret) ? num_ent*PHP_IMAP_ADDRESS_SIZE_BUF : 0; return ret; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php