[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-06-23 Thread Ilia Alshanetsky
iliaa   Tue Jun 23 12:43:10 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  Fixed build
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.52r2=1.208.2.7.2.53diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.52 
php-src/ext/imap/php_imap.c:1.208.2.7.2.53
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.52  Mon Jun 22 20:42:04 2009
+++ php-src/ext/imap/php_imap.c Tue Jun 23 12:43:10 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.52 2009/06/22 20:42:04 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.53 2009/06/23 12:43:10 iliaa Exp $ */
 
 #define IMAP41
 
@@ -2670,7 +2670,7 @@
 
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  !(flags  SE_FREE)) {
+   if (spg  myargc = 4  !(Z_LVAL_PP(flags)  SE_FREE)) {
mail_free_searchpgm(spg);
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-06-22 Thread Pierre-Alain Joye
pajoye  Mon Jun 22 20:42:04 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - MF53: #48619, imap_search ALL segfaults
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.51r2=1.208.2.7.2.52diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.51 
php-src/ext/imap/php_imap.c:1.208.2.7.2.52
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.51  Thu Apr 30 18:55:44 2009
+++ php-src/ext/imap/php_imap.c Mon Jun 22 20:42:04 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.51 2009/04/30 18:55:44 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.52 2009/06/22 20:42:04 pajoye Exp $ */
 
 #define IMAP41
 
@@ -2670,7 +2670,7 @@
 
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) {
+   if (spg  !(flags  SE_FREE)) {
mail_free_searchpgm(spg);
}
 
@@ -3712,7 +3712,7 @@
 
mail_search_full(imap_le_struct-imap_stream, (argc == 4 ? 
Z_STRVAL_PP(charset) : NIL), pgm, flags);
 
-   if (pgm) {
+   if (pgm  !(flags  SE_FREE)) {
mail_free_searchpgm(pgm);
}
 
@@ -4341,7 +4341,7 @@
 
pgm = mail_criteria(criteria);
top = mail_thread(imap_le_struct-imap_stream, REFERENCES, NIL, pgm, 
flags);
-   if (pgm) {
+   if (pgm  !(flags  SE_FREE)) {
mail_free_searchpgm(pgm);
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-28 Thread Pierre-Alain Joye
pajoye  Tue Apr 28 08:33:25 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - space to tabs
  - CS
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.48r2=1.208.2.7.2.49diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.48 
php-src/ext/imap/php_imap.c:1.208.2.7.2.49
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.48  Mon Apr 27 00:01:15 2009
+++ php-src/ext/imap/php_imap.c Tue Apr 28 08:33:25 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.48 2009/04/27 00:01:15 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.49 2009/04/28 08:33:25 pajoye Exp $ */
 
 #define IMAP41
 
@@ -275,7 +275,7 @@
  */
 FOBJECTLIST *mail_newfolderobjectlist(void)
 {
-  return (FOBJECTLIST *) memset(fs_get(sizeof(FOBJECTLIST)), 0, 
sizeof(FOBJECTLIST));
+   return (FOBJECTLIST *) memset(fs_get(sizeof(FOBJECTLIST)), 0, 
sizeof(FOBJECTLIST));
 }
 /* }}} */
 
@@ -1150,11 +1150,11 @@
convert_to_long_ex(options);
flags = Z_LVAL_PP(options);
 
-/* Check that flags is exactly equal to PHP_EXPUNGE or Zero*/
-if (flags  ((flags  ~PHP_EXPUNGE) != 0)) {
-php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the flags parameter);
- RETURN_FALSE;
-}
+   /* Check that flags is exactly equal to PHP_EXPUNGE or Zero*/
+   if (flags  ((flags  ~PHP_EXPUNGE) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the flags parameter);
+   RETURN_FALSE;
+   }
 
/* Do the translation from PHP's internal PHP_EXPUNGE define to 
c-client's CL_EXPUNGE */
if (flags  PHP_EXPUNGE) {
@@ -1242,10 +1242,10 @@
if (myargc == 3) {
convert_to_long_ex(pflags);
flags = Z_LVAL_PP(pflags);
-   if (flags  ((flags  ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
invalid value for the options parameter);
-   RETURN_FALSE;
-   }
+   if (flags  ((flags  ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the options parameter);
+   RETURN_FALSE;
+   }
}
 
if ((myargc == 3)  (flags  FT_UID)) {
@@ -1881,10 +1881,10 @@
convert_to_long_ex(pflags);
flags = Z_LVAL_PP(pflags);
 
-   if (flags  ((flags  ~FT_UID) != 0)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
invalid value for the options parameter);
-   RETURN_FALSE;
-   }
+   if (flags  ((flags  ~FT_UID) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the options parameter);
+   RETURN_FALSE;
+   }
}
 
object_init(return_value);
@@ -1917,7 +1917,7 @@
zval **streamind, **msgno, **sec, **pflags;
pils *imap_le_struct;
char *body;
-long flags=0L;
+   long flags=0L;
unsigned long len;
int myargc=ZEND_NUM_ARGS();
 
@@ -1933,10 +1933,10 @@
if (myargc == 4) {
convert_to_long_ex(pflags);
flags = Z_LVAL_PP(pflags);
-   if (flags  ((flags  ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
invalid value for the options parameter);
-   RETURN_FALSE;
-}
+   if (flags  ((flags  ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the options parameter);
+   RETURN_FALSE;
+   }
}
 
if (myargc  4 || !(flags  FT_UID)) {
@@ -2690,7 +2690,7 @@
zval **streamind, **msgno, **pflags;
pils *imap_le_struct;
int msgindex, myargc = ZEND_NUM_ARGS();
-long flags=0L;
+   long flags=0L;
 
if (myargc  2 || myargc  3 || zend_get_parameters_ex(myargc, 
streamind, msgno, pflags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -2701,12 +2701,12 @@
convert_to_long_ex(msgno);
if (myargc == 3) {
convert_to_long_ex(pflags);
-flags =  Z_LVAL_PP(pflags);
-   if (flags  ((flags  ~(FT_UID|FT_INTERNAL|FT_PREFETCHTEXT)) 
!= 0)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
invalid value for the options 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-28 Thread Pierre-Alain Joye
pajoye  Tue Apr 28 12:43:10 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - MFH: SEARCHPGM struct has to be freed
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.49r2=1.208.2.7.2.50diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.49 
php-src/ext/imap/php_imap.c:1.208.2.7.2.50
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.49  Tue Apr 28 08:33:25 2009
+++ php-src/ext/imap/php_imap.c Tue Apr 28 12:43:10 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.49 2009/04/28 08:33:25 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.50 2009/04/28 12:43:10 pajoye Exp $ */
 
 #define IMAP41
 
@@ -3685,6 +3685,7 @@
char *search_criteria;
MESSAGELIST *cur;
int argc = ZEND_NUM_ARGS();
+   SEARCHPGM *pgm = NIL;
 
if (argc  2 || argc  4 || zend_get_parameters_ex(argc, streamind, 
criteria, search_flags, charset) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -3705,8 +3706,15 @@
}
}
 
+   pgm = mail_criteria(search_criteria);
IMAPG(imap_messages) = IMAPG(imap_messages_tail) = NIL;
-   mail_search_full(imap_le_struct-imap_stream, (argc == 4 ? 
Z_STRVAL_PP(charset) : NIL), mail_criteria(search_criteria), flags);
+
+   mail_search_full(imap_le_struct-imap_stream, (argc == 4 ? 
Z_STRVAL_PP(charset) : NIL), pgm, flags);
+
+   if (pgm) {
+   mail_free_searchpgm(pgm);
+   }
+
if (IMAPG(imap_messages) == NIL) {
efree(search_criteria);
RETURN_FALSE;
@@ -4315,6 +4323,7 @@
char criteria[] = ALL;
THREADNODE *top;
int argc = ZEND_NUM_ARGS();
+   SEARCHPGM *pgm = NIL;
 
if ( argc  1 || argc  2 || zend_get_parameters_ex(argc, streamind, 
search_flags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -4329,7 +4338,11 @@
flags = Z_LVAL_PP(search_flags);
}
 
-   top = mail_thread(imap_le_struct-imap_stream, REFERENCES, NIL, 
mail_criteria(criteria), flags);
+   pgm = mail_criteria(criteria);
+   top = mail_thread(imap_le_struct-imap_stream, REFERENCES, NIL, pgm, 
flags);
+   if (pgm) {
+   mail_free_searchpgm(pgm);
+   }
 
if(top == NIL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Function returned 
an empty tree);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-26 Thread Pierre-Alain Joye
pajoye  Mon Apr 27 00:01:16 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - MFH: add latest cclient versions
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.47r2=1.208.2.7.2.48diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.47 
php-src/ext/imap/php_imap.c:1.208.2.7.2.48
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.47  Sat Apr 25 16:36:02 2009
+++ php-src/ext/imap/php_imap.c Mon Apr 27 00:01:15 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.47 2009/04/25 16:36:02 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.48 2009/04/27 00:01:15 pajoye Exp $ */
 
 #define IMAP41
 
@@ -719,8 +719,17 @@
 }
 /* }}} */
 
+
 #if !defined(CCLIENTVERSION)
-#if HAVE_IMAP2004
+#if HAVE_IMAP2007e
+#define CCLIENTVERSION 2007e
+#elif HAVE_IMAP2007d
+#define CCLIENTVERSION 2007d
+#elif HAVE_IMAP2007b
+#define CCLIENTVERSION 2007b
+#elif HAVE_IMAP2007a
+#define CCLIENTVERSION 2007a
+#elif HAVE_IMAP2004
 #define CCLIENTVERSION 2004
 #elif HAVE_IMAP2001
 #define CCLIENTVERSION 2001



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-25 Thread Pierre-Alain Joye
pajoye  Sat Apr 25 16:36:02 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - ws
  http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.46r2=1.208.2.7.2.47diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.46 
php-src/ext/imap/php_imap.c:1.208.2.7.2.47
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.46  Fri Apr 24 14:53:59 2009
+++ php-src/ext/imap/php_imap.c Sat Apr 25 16:36:02 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.46 2009/04/24 14:53:59 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.47 2009/04/25 16:36:02 pajoye Exp $ */
 
 #define IMAP41
 
@@ -241,7 +241,7 @@
 static int add_assoc_object(zval *arg, char *key, zval *tmp TSRMLS_DC)
 {
HashTable *symtable;
-   
+
if (Z_TYPE_P(arg) == IS_OBJECT) {
symtable = Z_OBJPROP_P(arg);
} else {
@@ -256,14 +256,14 @@
 static inline int add_next_index_object(zval *arg, zval *tmp TSRMLS_DC)
 {
HashTable *symtable;
-   
+
if (Z_TYPE_P(arg) == IS_OBJECT) {
symtable = Z_OBJPROP_P(arg);
} else {
symtable = Z_ARRVAL_P(arg);
}
 
-   return zend_hash_next_index_insert(symtable, (void *) tmp, sizeof(zval 
*), NULL); 
+   return zend_hash_next_index_insert(symtable, (void *) tmp, sizeof(zval 
*), NULL);
 }
 /* }}} */
 
@@ -334,7 +334,7 @@
 /* }}} */
 
 /* {{{ mail_newmessagelist
- * 
+ *
  * Mail instantiate MESSAGELIST
  * Returns: new MESSAGELIST list
  * Author: CJH
@@ -365,8 +365,8 @@
 }
 /* }}} */
 
-#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) 
-/* {{{ mail_getquota 
+#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
+/* {{{ mail_getquota
  *
  * Mail GET_QUOTA callback
  * Called via the mail_parameter function in c-client:src/c-client/mail.c
@@ -377,7 +377,7 @@
 {
zval *t_map, *return_value;
TSRMLS_FETCH();
-   
+
return_value = *IMAPG(quota_return);
 
 /* put parsing code here */
@@ -472,7 +472,7 @@
 
 #ifndef PHP_WIN32
auth_link(auth_log);   /* link in the log authenticator */
-   auth_link(auth_md5);   /* link in the cram-md5 authenticator */ 
+   auth_link(auth_md5);   /* link in the cram-md5 authenticator */
 #if HAVE_IMAP_KRB  defined(HAVE_IMAP_AUTH_GSS)
auth_link(auth_gss);   /* link in the gss authenticator */
 #endif
@@ -522,13 +522,13 @@
REGISTER_LONG_CONSTANT(OP_SECURE, OP_SECURE, CONST_PERSISTENT | 
CONST_CS);
/* don't do non-secure authentication */
 
-   /* 
+   /*
PHP re-assigns CL_EXPUNGE a custom value that can be used as part of 
the imap_open() bitfield
-   because it seems like a good idea to be able to indicate that the 
mailbox should be 
+   because it seems like a good idea to be able to indicate that the 
mailbox should be
automatically expunged during imap_open in case the script get 
interrupted and it doesn't get
to the imap_close() where this option is normally placed.  If the 
c-client library adds other
-   options and the value for this one conflicts, simply make PHP_EXPUNGE 
higher at the top of 
-   this file 
+   options and the value for this one conflicts, simply make PHP_EXPUNGE 
higher at the top of
+   this file
*/
REGISTER_LONG_CONSTANT(CL_EXPUNGE, PHP_EXPUNGE, CONST_PERSISTENT | 
CONST_CS);
/* expunge silently */
@@ -759,7 +759,7 @@
long flags=NIL;
long cl_flags=NIL;
int myargc = ZEND_NUM_ARGS();
-   
+
if (myargc  3 || myargc  5 || zend_get_parameters_ex(myargc, 
mailbox, user, passwd, options, retries) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -776,17 +776,17 @@
}
}
 
-   if (IMAPG(imap_user)) { 
+   if (IMAPG(imap_user)) {
efree(IMAPG(imap_user));
}
 
-   if (IMAPG(imap_password)) { 
+   if (IMAPG(imap_password)) {
efree(IMAPG(imap_password));
}
 
/* local filename, need to perform open_basedir and safe_mode checks */
-   if (Z_STRVAL_PP(mailbox)[0] != '{'  
-   (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC) 
|| 
+   if (Z_STRVAL_PP(mailbox)[0] != '{' 
+   (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC) 
||
(PG(safe_mode)  !php_checkuid(Z_STRVAL_PP(mailbox), 
NULL, CHECKUID_CHECK_FILE_AND_DIR {
RETURN_FALSE;
}
@@ -816,7 +816,7 @@
 
imap_le_struct = emalloc(sizeof(pils));
imap_le_struct-imap_stream = imap_stream;
-   imap_le_struct-flags = cl_flags;   
+   imap_le_struct-flags = cl_flags;
 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-24 Thread Pierre-Alain Joye
pajoye  Fri Apr 24 14:53:59 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - #47940, pass body_len
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.45r2=1.208.2.7.2.46diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.45 
php-src/ext/imap/php_imap.c:1.208.2.7.2.46
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.45  Thu Apr 23 22:32:41 2009
+++ php-src/ext/imap/php_imap.c Fri Apr 24 14:53:59 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.45 2009/04/23 22:32:41 pajoye Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.46 2009/04/24 14:53:59 pajoye Exp $ */
 
 #define IMAP41
 
@@ -1251,7 +1251,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Bad message 
number);
RETURN_FALSE;
}
-   body = mail_fetchtext_full (imap_le_struct-imap_stream, 
Z_LVAL_PP(msgno), NIL, (myargc==3 ? Z_LVAL_PP(pflags) : NIL));
+   body = mail_fetchtext_full (imap_le_struct-imap_stream, 
Z_LVAL_PP(msgno), body_len, (myargc==3 ? Z_LVAL_PP(pflags) : NIL));
if (body_len == 0) {
RETVAL_EMPTY_STRING();
} else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-23 Thread Pierre-Alain Joye
pajoye  Thu Apr 23 22:32:41 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - MFH: #47940,  leaks in imap_body()
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.44r2=1.208.2.7.2.45diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.44 
php-src/ext/imap/php_imap.c:1.208.2.7.2.45
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.44  Sun Apr  5 14:10:49 2009
+++ php-src/ext/imap/php_imap.c Thu Apr 23 22:32:41 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.44 2009/04/05 14:10:49 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.45 2009/04/23 22:32:41 pajoye Exp $ */
 
 #define IMAP41
 
@@ -1219,6 +1219,8 @@
pils *imap_le_struct; 
int msgindex, myargc=ZEND_NUM_ARGS();
long flags=0L;
+   char *body;
+   unsigned long body_len = 0;
 
if (myargc  2 || myargc  3 || zend_get_parameters_ex(myargc, 
streamind, msgno, pflags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -1249,8 +1251,13 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Bad message 
number);
RETURN_FALSE;
}
-
-   RETVAL_STRING(mail_fetchtext_full (imap_le_struct-imap_stream, 
Z_LVAL_PP(msgno), NIL, myargc==3 ? Z_LVAL_PP(pflags) : NIL), 1);
+   body = mail_fetchtext_full (imap_le_struct-imap_stream, 
Z_LVAL_PP(msgno), NIL, (myargc==3 ? Z_LVAL_PP(pflags) : NIL));
+   if (body_len == 0) {
+   RETVAL_EMPTY_STRING();
+   } else {
+   RETVAL_STRINGL(body, body_len, 1);
+   }
+   free(body);
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2009-04-05 Thread Ilia Alshanetsky
iliaa   Sun Apr  5 14:10:50 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  Define _php_rfc822_len() only when needed
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.43r2=1.208.2.7.2.44diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.43 
php-src/ext/imap/php_imap.c:1.208.2.7.2.44
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.43  Wed Dec 31 11:17:38 2008
+++ php-src/ext/imap/php_imap.c Sun Apr  5 14:10:49 2009
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.43 2008/12/31 11:17:38 sebastian Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.44 2009/04/05 14:10:49 iliaa Exp $ */
 
 #define IMAP41
 
@@ -3886,38 +3886,11 @@
 }
 /* }}} */
 
-/* {{{ _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 */
 
 #ifdef HAVE_RFC822_OUTPUT_ADDRESS_LIST
+
 /* {{{ _php_rfc822_soutr
  */
 static long _php_rfc822_soutr (void *stream, char *string)
@@ -3953,6 +3926,36 @@
 
 #else
 
+/* {{{ _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;
+}
+/* }}} */
+
+
 /* {{{ _php_imap_get_address_size
  */
 static int _php_imap_address_size (ADDRESS *addresslist)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-12-24 Thread Felipe Pena
felipe  Wed Dec 24 11:24:38 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - Fixed bug #46918 (imap_rfc822_parse_adrlist host part not filled in 
correctly) [only in this branch]
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.40r2=1.208.2.7.2.41diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.40 
php-src/ext/imap/php_imap.c:1.208.2.7.2.41
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.40  Tue Dec 16 21:35:42 2008
+++ php-src/ext/imap/php_imap.c Wed Dec 24 11:24:38 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.40 2008/12/16 21:35:42 zoe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.41 2008/12/24 11:24:38 felipe Exp $ */
 
 #define IMAP41
 
@@ -2201,7 +2201,7 @@
 
/* rfc822_parse_adrlist() modifies passed string. Copy it. */
str_copy = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
-   rfc822_parse_adrlist(env-to, str_copy, defaulthost);
+   rfc822_parse_adrlist(env-to, str_copy, Z_STRVAL_PP(defaulthost));
efree(str_copy);
 
array_init(return_value);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-12-24 Thread Felipe Pena
felipe  Wed Dec 24 13:31:40 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - MFH: Fixed memory leak in imap_rfc822_parse_adrlist
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.41r2=1.208.2.7.2.42diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.41 
php-src/ext/imap/php_imap.c:1.208.2.7.2.42
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.41  Wed Dec 24 11:24:38 2008
+++ php-src/ext/imap/php_imap.c Wed Dec 24 13:31:40 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.41 2008/12/24 11:24:38 felipe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.42 2008/12/24 13:31:40 felipe Exp $ */
 
 #define IMAP41
 
@@ -2225,6 +2225,8 @@
}
add_next_index_object(return_value, tovals TSRMLS_CC);
} while ((addresstmp = addresstmp-next));
+   
+   mail_free_envelope(env);
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-12-16 Thread Zoe Slattery
zoe Tue Dec 16 21:11:50 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  bug #46884 fix
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.38r2=1.208.2.7.2.39diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.38 
php-src/ext/imap/php_imap.c:1.208.2.7.2.39
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.38  Fri Dec  5 11:59:01 2008
+++ php-src/ext/imap/php_imap.c Tue Dec 16 21:11:49 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.38 2008/12/05 11:59:01 zoe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.39 2008/12/16 21:11:49 zoe Exp $ */
 
 #define IMAP41
 
@@ -1208,22 +1208,29 @@
Read the message body */
 PHP_FUNCTION(imap_body)
 {
-   zval **streamind, **msgno, **flags;
+   zval **streamind, **msgno, **pflags;
pils *imap_le_struct; 
int msgindex, myargc=ZEND_NUM_ARGS();
+   long flags=0L;
 
-   if (myargc  2 || myargc  3 || zend_get_parameters_ex(myargc, 
streamind, msgno, flags) == FAILURE) {
+   if (myargc  2 || myargc  3 || zend_get_parameters_ex(myargc, 
streamind, msgno, pflags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
 
+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, imap, 
le_imap);

convert_to_long_ex(msgno);
if (myargc == 3) {
-   convert_to_long_ex(flags);
+   convert_to_long_ex(pflags);
+   flags = Z_LVAL_PP(pflags);
+   if (flags  ((flags  ~(FT_UID|FT_PEEK|FT_INTERNAL)) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
invalid value for the options parameter);
+   RETURN_FALSE;
+   }
}
 
-   if ((myargc == 3)  (Z_LVAL_PP(flags)  FT_UID)) {
+   if ((myargc == 3)  (flags  FT_UID)) {
/* This should be cached; if it causes an extra RTT to the
   IMAP server, then that's the price we pay for making
   sure we don't crash. */
@@ -1236,7 +1243,7 @@
RETURN_FALSE;
}
 
-   RETVAL_STRING(mail_fetchtext_full (imap_le_struct-imap_stream, 
Z_LVAL_PP(msgno), NIL, myargc==3 ? Z_LVAL_PP(flags) : NIL), 1);
+   RETVAL_STRING(mail_fetchtext_full (imap_le_struct-imap_stream, 
Z_LVAL_PP(msgno), NIL, myargc==3 ? Z_LVAL_PP(pflags) : NIL), 1);
 }
 /* }}} */
 
@@ -1830,14 +1837,16 @@
Read the full structure of a message */
 PHP_FUNCTION(imap_fetchstructure)
 {
-   zval **streamind, **msgno, **flags;
+   zval **streamind, **msgno, **pflags;
pils *imap_le_struct;
BODY *body;
int msgindex, myargc=ZEND_NUM_ARGS();
+   long flags=0L;
 
-   if (myargc  2  || myargc  3 || zend_get_parameters_ex(myargc, 
streamind, msgno, flags) == FAILURE) {
+   if (myargc  2  || myargc  3 || zend_get_parameters_ex(myargc, 
streamind, msgno, pflags) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
+

ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, imap, 
le_imap);
 
@@ -1846,12 +1855,18 @@
RETURN_FALSE;
}
if (myargc == 3) {
-   convert_to_long_ex(flags);
+   convert_to_long_ex(pflags);
+   flags = Z_LVAL_PP(pflags);
+
+   if (flags  ((flags  ~FT_UID) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
invalid value for the options parameter);
+   RETURN_FALSE;
+   }
}
 
object_init(return_value);
 
-   if ((myargc == 3)  (Z_LVAL_PP(flags)  FT_UID)) {
+   if ((myargc == 3)  (flags  FT_UID)) {
/* This should be cached; if it causes an extra RTT to the
   IMAP server, then that's the price we pay for making
   sure we don't crash. */
@@ -1861,7 +1876,7 @@
}
PHP_IMAP_CHECK_MSGNO(msgindex);
 
-   mail_fetchstructure_full(imap_le_struct-imap_stream, Z_LVAL_PP(msgno), 
body , myargc == 3 ? Z_LVAL_PP(flags) : NIL);
+   mail_fetchstructure_full(imap_le_struct-imap_stream, Z_LVAL_PP(msgno), 
body , myargc == 3 ? Z_LVAL_PP(pflags) : NIL);

if (!body) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, No body 
information available);
@@ -1876,30 +1891,37 @@
Get a specific body section */
 PHP_FUNCTION(imap_fetchbody)
 {
-   zval **streamind, **msgno, **sec, **flags;
+   zval **streamind, **msgno, **sec, **pflags;
pils *imap_le_struct;
char *body;
+long flags=0L;
unsigned long len;
int myargc=ZEND_NUM_ARGS();
 
-   if (myargc  3 || myargc  4 || zend_get_parameters_ex(myargc, 
streamind, msgno, sec, flags) == 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-12-16 Thread Zoe Slattery
zoe Tue Dec 16 21:35:42 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  bug #46837 fix
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.39r2=1.208.2.7.2.40diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.39 
php-src/ext/imap/php_imap.c:1.208.2.7.2.40
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.39  Tue Dec 16 21:11:49 2008
+++ php-src/ext/imap/php_imap.c Tue Dec 16 21:35:42 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski z...@zend.com   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.39 2008/12/16 21:11:49 zoe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.40 2008/12/16 21:35:42 zoe Exp $ */
 
 #define IMAP41
 
@@ -1140,6 +1140,13 @@
if (myargcount == 2) {
convert_to_long_ex(options);
flags = Z_LVAL_PP(options);
+
+/* Check that flags is exactly equal to PHP_EXPUNGE or Zero*/
+if (flags  ((flags  ~PHP_EXPUNGE) != 0)) {
+php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the flags parameter);
+ RETURN_FALSE;
+}
+
/* Do the translation from PHP's internal PHP_EXPUNGE define to 
c-client's CL_EXPUNGE */
if (flags  PHP_EXPUNGE) {
flags ^= PHP_EXPUNGE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-12-05 Thread Zoe Slattery
zoe Fri Dec  5 11:59:02 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  bug #46731 fix
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.37r2=1.208.2.7.2.38diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.37 
php-src/ext/imap/php_imap.c:1.208.2.7.2.38
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.37  Thu Oct 16 16:20:53 2008
+++ php-src/ext/imap/php_imap.c Fri Dec  5 11:59:01 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.37 2008/10/16 16:20:53 dmitry Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.38 2008/12/05 11:59:01 zoe Exp $ */
 
 #define IMAP41
 
@@ -2895,6 +2895,10 @@
if(myargc == 3) {
convert_to_long_ex(pflags);
flags = Z_LVAL_PP(pflags);
+if (flags  ((flags  ~FT_UID) != 0)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, invalid 
value for the options parameter);
+   RETURN_FALSE;
+   } 
}
 
array_init(return_value);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-12-05 Thread Hannes Magnusson
On Fri, Dec 5, 2008 at 12:59, Zoe Slattery [EMAIL PROTECTED] wrote:
 zoe Fri Dec  5 11:59:02 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c
  Log:
  bug #46731 fix

NEWS?

-Hannes

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-08-04 Thread Jani Taskinen
janiMon Aug  4 20:54:21 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  MFH: proper version check
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.34r2=1.208.2.7.2.35diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.34 
php-src/ext/imap/php_imap.c:1.208.2.7.2.35
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.34  Fri Jul 11 11:09:05 2008
+++ php-src/ext/imap/php_imap.c Mon Aug  4 20:54:20 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.34 2008/07/11 11:09:05 felipe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.35 2008/08/04 20:54:20 jani Exp $ */
 
 #define IMAP41
 
@@ -717,23 +717,26 @@
 }
 /* }}} */
 
-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(imap)
-{
-   php_info_print_table_start();
+#if !defined(CCLIENTVERSION)
 #if HAVE_IMAP2004
-   php_info_print_table_row(2, IMAP c-Client Version, 2004);
+#define CCLIENTVERSION 2004
 #elif HAVE_IMAP2001
-   php_info_print_table_row(2, IMAP c-Client Version, 2001);
+#define CCLIENTVERSION 2001
 #elif HAVE_IMAP2000
-   php_info_print_table_row(2, IMAP c-Client Version, 2000);
+#define CCLIENTVERSION 2000
 #elif defined(IMAP41)
-   php_info_print_table_row(2, IMAP c-Client Version, 4.1);
+#define CCLIENTVERSION 4.1
 #else
-   php_info_print_table_row(2, IMAP c-Client Version, 4.0);
+#define CCLIENTVERSION 4.0
+#endif
 #endif
+
+/* {{{ PHP_MINFO_FUNCTION
+ */
+PHP_MINFO_FUNCTION(imap)
+{
+   php_info_print_table_start();
+   php_info_print_table_row(2, IMAP c-Client Version, CCLIENTVERSION);
 #if HAVE_IMAP_SSL
php_info_print_table_row(2, SSL Support, enabled);
 #endif



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-07-11 Thread Felipe Pena
felipe  Fri Jul 11 11:09:05 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - Fixed the string sizes in imap_headerinfo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.33r2=1.208.2.7.2.34diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.33 
php-src/ext/imap/php_imap.c:1.208.2.7.2.34
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.33  Thu Jul 10 17:44:09 2008
+++ php-src/ext/imap/php_imap.c Fri Jul 11 11:09:05 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.33 2008/07/10 17:44:09 felipe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.34 2008/07/11 11:09:05 felipe Exp $ */
 
 #define IMAP41
 
@@ -1575,7 +1575,7 @@
pils *imap_le_struct;
MESSAGECACHE *cache;
ENVELOPE *en;
-   char dummy[2000], fulladdress[MAILTMPLEN];
+   char dummy[2000], fulladdress[MAILTMPLEN + 1];
int myargc = ZEND_NUM_ARGS();

if (myargc  2 || myargc  5 || zend_get_parameters_ex(myargc, 
streamind, msgno, fromlength, subjectlength, defaulthost) == FAILURE) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-07-10 Thread Felipe Pena
felipe  Thu Jul 10 17:44:09 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - Fixed bug #45460 (imap patch for fromlength fix in imap_headerinfo doesn't 
accept lengths of 1024)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.32r2=1.208.2.7.2.33diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.32 
php-src/ext/imap/php_imap.c:1.208.2.7.2.33
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.32  Wed Jun 11 02:32:22 2008
+++ php-src/ext/imap/php_imap.c Thu Jul 10 17:44:09 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.32 2008/06/11 02:32:22 philip Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.33 2008/07/10 17:44:09 felipe Exp $ */
 
 #define IMAP41
 
@@ -1587,8 +1587,8 @@
convert_to_long_ex(msgno);
if (myargc = 3) {
convert_to_long_ex(fromlength);
-   if (Z_LVAL_PP(fromlength)  0 || Z_LVAL_PP(fromlength) = 
MAILTMPLEN) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, From 
length has to be between 1 and %i, MAILTMPLEN);
+   if (Z_LVAL_PP(fromlength)  0 || Z_LVAL_PP(fromlength)  
MAILTMPLEN) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, From 
length has to be between 0 and %d, MAILTMPLEN);
RETURN_FALSE;
}
} else {
@@ -1596,8 +1596,8 @@
}
if (myargc = 4) {
convert_to_long_ex(subjectlength);
-   if (Z_LVAL_PP(subjectlength)  0 || Z_LVAL_PP(subjectlength) = 
MAILTMPLEN) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Subject 
length has to be between 1 and %i, MAILTMPLEN);
+   if (Z_LVAL_PP(subjectlength)  0 || Z_LVAL_PP(subjectlength)  
MAILTMPLEN) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Subject 
length has to be between 0 and %d, MAILTMPLEN);
RETURN_FALSE;
}
} else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2008-04-17 Thread Felipe Pena
felipe  Thu Apr 17 11:04:49 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  - Fix typo
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.30r2=1.208.2.7.2.31diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.30 
php-src/ext/imap/php_imap.c:1.208.2.7.2.31
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.30  Tue Apr  8 00:03:34 2008
+++ php-src/ext/imap/php_imap.c Thu Apr 17 11:04:49 2008
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.30 2008/04/08 00:03:34 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.31 2008/04/17 11:04:49 felipe Exp $ */
 
 #define IMAP41
 
@@ -792,7 +792,7 @@
 #ifdef SET_MAXLOGINTRIALS
if (myargc == 5) {
convert_to_long_ex(retries);
-   if (retries  0) {
+   if (Z_LVAL_PP(retries)  0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING ,Retries 
must be greater or equal to 0);
} else {
mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *) 
Z_LVAL_PP(retries));



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-07-30 Thread Stanislav Malyshev
stasTue Jul 31 00:31:11 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  sometimes c-client lib returns non-null entry with null host
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.25r2=1.208.2.7.2.26diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.25 
php-src/ext/imap/php_imap.c:1.208.2.7.2.26
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.25  Fri Jul  6 00:13:56 2007
+++ php-src/ext/imap/php_imap.c Tue Jul 31 00:31:10 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.25 2007/07/06 00:13:56 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.26 2007/07/31 00:31:10 stas Exp $ */
 
 #define IMAP41
 
@@ -3407,7 +3407,7 @@
addr = NULL;
rfc822_parse_adrlist(addr, tempMailTo, NULL);
while (addr) {
-   if (strcmp(addr-host, ERRHOST) == 0) {
+   if (addr-host == NULL || strcmp(addr-host, ERRHOST) 
== 0) {
PHP_IMAP_BAD_DEST;
} else {
bufferTo = safe_erealloc(bufferTo, bt_len, 1, 
strlen(addr-mailbox));
@@ -3436,7 +3436,7 @@
addr = NULL;
rfc822_parse_adrlist(addr, tempMailTo, NULL);
while (addr) {
-   if (strcmp(addr-host, ERRHOST) == 0) {
+   if (addr-host == NULL || strcmp(addr-host, ERRHOST) 
== 0) {
PHP_IMAP_BAD_DEST;
} else {
bufferCc = safe_erealloc(bufferCc, bt_len, 1, 
strlen(addr-mailbox));
@@ -3462,7 +3462,7 @@
addr = NULL;
rfc822_parse_adrlist(addr, tempMailTo, NULL);
while (addr) {
-   if (strcmp(addr-host, ERRHOST) == 0) {
+   if (addr-host == NULL || strcmp(addr-host, ERRHOST) 
== 0) {
PHP_IMAP_BAD_DEST;
} else {
bufferBcc = safe_erealloc(bufferBcc, bt_len, 1, 
strlen(addr-mailbox));

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-07-05 Thread Ilia Alshanetsky
iliaa   Fri Jul  6 00:13:57 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  
  Fixed NOTICE message
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.24r2=1.208.2.7.2.25diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.24 
php-src/ext/imap/php_imap.c:1.208.2.7.2.25
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.24  Mon Mar 19 22:56:57 2007
+++ php-src/ext/imap/php_imap.c Fri Jul  6 00:13:56 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.24 2007/03/19 22:56:57 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.25 2007/07/06 00:13:56 iliaa Exp $ */
 
 #define IMAP41
 
@@ -2377,7 +2377,7 @@
 #if PHP_DEBUG
/* warn if we computed outlen incorrectly */
if (outp - out != outlen) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, outp - out [%d] != 
outlen [%d], outp - out, outlen);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, outp - out [%ld] 
!= outlen [%d], outp - out, outlen);
}
 #endif
 
@@ -2496,7 +2496,7 @@
 #if PHP_DEBUG
/* warn if we computed outlen incorrectly */
if (outp - out != outlen) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, outp - out [%d] != 
outlen [%d], outp - out, outlen);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, outp - out [%ld] 
!= outlen [%d], outp - out, outlen);
}
 #endif
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-03-11 Thread Ilia Alshanetsky
iliaa   Sun Mar 11 18:42:19 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  
  malloc() - pemalloc()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.22r2=1.208.2.7.2.23diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.22 
php-src/ext/imap/php_imap.c:1.208.2.7.2.23
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.22  Tue Feb 27 03:04:40 2007
+++ php-src/ext/imap/php_imap.c Sun Mar 11 18:42:19 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.22 2007/02/27 03:04:40 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.23 2007/03/11 18:42:19 iliaa Exp $ */
 
 #define IMAP41
 
@@ -3895,7 +3895,7 @@
addresstmp = addresslist;
 
if ((len = _php_imap_address_size(addresstmp))) {
-   tmpstr = (char *) malloc(len + 1);
+   tmpstr = (char *) pemalloc(len + 1, 1);
tmpstr[0] = '\0';
rfc822_write_address(tmpstr, addresstmp);
*fulladdress = tmpstr;
@@ -4316,7 +4316,7 @@
}
return NULL;
} else {
-   char *buf = malloc(size + 1);
+   char *buf = pemalloc(size + 1, 1);

if (f(stream, size, buf)) {
buf[size] = '\0';

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-16 Thread Hannes Magnusson

On 2/16/07, Antony Dovgal [EMAIL PROTECTED] wrote:

On 02/16/2007 05:04 AM, Ilia Alshanetsky wrote:
 What version of c-client are you using? For me here the code does not
 show any errors via valgrind 3.2.3.

It's quite old, yes - imap-2004c.
imap-2006d works ok in the same time.

Ok, I found a solution, this patch fixes it:


Yup. Fixes it for my good old cclient-2004g too

-Hannes


Index: ext/imap/php_imap.c
===
RCS file: /repository/php-src/ext/imap/php_imap.c,v
retrieving revision 1.208.2.7.2.17
diff -u -p -d -r1.208.2.7.2.17 php_imap.c
--- ext/imap/php_imap.c 13 Feb 2007 20:12:52 -  1.208.2.7.2.17
+++ ext/imap/php_imap.c 16 Feb 2007 07:04:00 -
@@ -2215,7 +2215,7 @@ PHP_FUNCTION(imap_utf8)
if (dest.data) {
free(dest.data);
}
-   if (src.data) {
+   if (src.data  src.data != dest.data) {
free(src.data);
}
 }


In c-client sources they use similar if's.

--
Wbr,
Antony Dovgal

--
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: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-16 Thread Antony Dovgal
tony2001Fri Feb 16 13:28:03 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  fix possible double free
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.18r2=1.208.2.7.2.19diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.18 
php-src/ext/imap/php_imap.c:1.208.2.7.2.19
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.18  Fri Feb 16 03:32:06 2007
+++ php-src/ext/imap/php_imap.c Fri Feb 16 13:28:03 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.18 2007/02/16 03:32:06 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.19 2007/02/16 13:28:03 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -2215,7 +2215,7 @@
if (dest.data) {
free(dest.data);
}
-   if (src.data) {
+   if (src.data  src.data != dest.data) {
free(src.data);
}
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-15 Thread Antony Dovgal

On 02/13/2007 11:12 PM, Ilia Alshanetsky wrote:

http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.16r2=1.208.2.7.2.17diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.16 
php-src/ext/imap/php_imap.c:1.208.2.7.2.17
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.16  Thu Jan 18 14:03:38 2007
+++ php-src/ext/imap/php_imap.c Tue Feb 13 20:12:52 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.16 2007/01/18 14:03:38 tony2001 Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.17 2007/02/13 20:12:52 iliaa Exp $ */
 
 #define IMAP41
 
@@ -2215,6 +2215,9 @@

if (dest.data) {
free(dest.data);
}
+   if (src.data) {
+   free(src.data);
+   }
 }
 /* }}} */


This is what I see after this patch (confirmed by Hannes):

# ./sapi/cli/php -r 'var_dump(imap_utf8());'
*** glibc detected *** double free or corruption (fasttop): 0x08458658 ***
Aborted

==8685== Invalid free() / delete / delete[]
==8685==at 0x401D297: free (vg_replace_malloc.c:233)
==8685==by 0x8106713: zif_imap_utf8 (php_imap.c:2219)
==8685==by 0x828ED19: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:200)
==8685==by 0x8291D3F: ZEND_DO_FCALL_SPEC_CONST_HANDLER 
(zend_vm_execute.h:1681)
==8685==by 0x828E92C: execute (zend_vm_execute.h:92)
==8685==by 0x8263860: zend_eval_string (zend_execute_API.c:1151)
==8685==by 0x82639C0: zend_eval_string_ex (zend_execute_API.c:1185)
==8685==by 0x82D5B83: main (php_cli.c:1160)
==8685==  Address 0x4708D90 is 0 bytes inside a block of size 1 free'd
==8685==at 0x401D297: free (vg_replace_malloc.c:233)
==8685==by 0x81066FF: zif_imap_utf8 (php_imap.c:2216)
==8685==by 0x828ED19: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:200)
==8685==by 0x8291D3F: ZEND_DO_FCALL_SPEC_CONST_HANDLER 
(zend_vm_execute.h:1681)
==8685==by 0x828E92C: execute (zend_vm_execute.h:92)
==8685==by 0x8263860: zend_eval_string (zend_execute_API.c:1151)
==8685==by 0x82639C0: zend_eval_string_ex (zend_execute_API.c:1185)
==8685==by 0x82D5B83: main (php_cli.c:1160)


--
Wbr, 
Antony Dovgal


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-15 Thread Ilia Alshanetsky
What version of c-client are you using? For me here the code does not  
show any errors via valgrind 3.2.3.



On 15-Feb-07, at 3:04 PM, Antony Dovgal wrote:


On 02/13/2007 11:12 PM, Ilia Alshanetsky wrote:
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c? 
r1=1.208.2.7.2.16r2=1.208.2.7.2.17diff_format=u

Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.16 php-src/ext/ 
imap/php_imap.c:1.208.2.7.2.17
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.16	Thu Jan 18 14:03:38  
2007

+++ php-src/ext/imap/php_imap.c Tue Feb 13 20:12:52 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski  
[EMAIL PROTECTED]   |
 
+ 
--+

  */
-/* $Id: php_imap.c,v 1.208.2.7.2.16 2007/01/18 14:03:38 tony2001  
Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.17 2007/02/13 20:12:52 iliaa Exp  
$ */

  #define IMAP41
 @@ -2215,6 +2215,9 @@
if (dest.data) {
free(dest.data);
}
+   if (src.data) {
+   free(src.data);
+   }
 }
 /* }}} */


This is what I see after this patch (confirmed by Hannes):

# ./sapi/cli/php -r 'var_dump(imap_utf8());'
*** glibc detected *** double free or corruption (fasttop):  
0x08458658 ***

Aborted

==8685== Invalid free() / delete / delete[]
==8685==at 0x401D297: free (vg_replace_malloc.c:233)
==8685==by 0x8106713: zif_imap_utf8 (php_imap.c:2219)
==8685==by 0x828ED19: zend_do_fcall_common_helper_SPEC  
(zend_vm_execute.h:200)
==8685==by 0x8291D3F: ZEND_DO_FCALL_SPEC_CONST_HANDLER  
(zend_vm_execute.h:1681)

==8685==by 0x828E92C: execute (zend_vm_execute.h:92)
==8685==by 0x8263860: zend_eval_string (zend_execute_API.c:1151)
==8685==by 0x82639C0: zend_eval_string_ex (zend_execute_API.c: 
1185)

==8685==by 0x82D5B83: main (php_cli.c:1160)
==8685==  Address 0x4708D90 is 0 bytes inside a block of size 1 free'd
==8685==at 0x401D297: free (vg_replace_malloc.c:233)
==8685==by 0x81066FF: zif_imap_utf8 (php_imap.c:2216)
==8685==by 0x828ED19: zend_do_fcall_common_helper_SPEC  
(zend_vm_execute.h:200)
==8685==by 0x8291D3F: ZEND_DO_FCALL_SPEC_CONST_HANDLER  
(zend_vm_execute.h:1681)

==8685==by 0x828E92C: execute (zend_vm_execute.h:92)
==8685==by 0x8263860: zend_eval_string (zend_execute_API.c:1151)
==8685==by 0x82639C0: zend_eval_string_ex (zend_execute_API.c: 
1185)

==8685==by 0x82D5B83: main (php_cli.c:1160)


--
Wbr, Antony Dovgal


Ilia Alshanetsky

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-15 Thread Ilia Alshanetsky
iliaa   Fri Feb 16 03:32:07 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  Reduce stack usage  improve boundary checks
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.17r2=1.208.2.7.2.18diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.17 
php-src/ext/imap/php_imap.c:1.208.2.7.2.18
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.17  Tue Feb 13 20:12:52 2007
+++ php-src/ext/imap/php_imap.c Fri Feb 16 03:32:06 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.17 2007/02/13 20:12:52 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.18 2007/02/16 03:32:06 iliaa Exp $ */
 
 #define IMAP41
 
@@ -2956,7 +2956,7 @@
BODY *bod=NULL, *topbod=NULL;
PART *mypart=NULL, *part;
PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, 
*tmp_param = NULL;
-   char tmp[SENDBUFLEN + 1], *mystring=NULL, *t=NULL, *tempstring=NULL;
+   char *tmp=NULL, *mystring=NULL, *t=NULL, *tempstring=NULL;
int toppart = 0;
 
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, envelope, body) 
== FAILURE) {
@@ -3258,6 +3258,9 @@
}
 
rfc822_encode_body_7bit(env, topbod);
+
+   tmp = emalloc(SENDBUFLEN + 1);
+
rfc822_header(tmp, env, topbod);
 
/* add custom envelope headers */
@@ -3307,7 +3310,7 @@
/* yucky default */
if (!cookie) {
cookie = -;  
-   } else if (strlen(cookie)  (sizeof(tmp) - 2 - 2)) {  
/* validate cookie length -- + CRLF */
+   } else if (strlen(cookie)  (SENDBUFLEN - 2 - 2 - 2)) { 
 /* validate cookie length -- + CRLF * 2 */
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
The boudary should be no longer then 4kb);
RETVAL_FALSE;
goto done;  
@@ -3315,18 +3318,14 @@
 
/* for each part */
do {
-   t=tmp;
-   /* build cookie */
-   sprintf(t, --%s%s, cookie, CRLF);
-
+   t = tmp;
+   
/* append mini-header */
+   *t = '\0';
rfc822_write_body_header(t, part-body);
 
-   /* write terminating blank line */
-   strcat(t, CRLF);
-
/* output cookie, mini-header, and contents */
-   spprintf(tempstring, 0, %s%s, mystring, tmp);
+   spprintf(tempstring, 0, %s--%s%s%s%s, 
mystring, cookie, CRLF, tmp, CRLF);
efree(mystring);
mystring=tempstring;
 
@@ -3342,9 +3341,9 @@
efree(mystring);
mystring=tempstring;
} else if (bod) {
-   spprintf(tempstring, 0, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
-   efree(mystring);
-   mystring=tempstring;
+   spprintf(tempstring, 0, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
+   efree(mystring);
+   mystring=tempstring;
} else {
efree(mystring);
RETVAL_FALSE;
@@ -3353,6 +3352,9 @@
 
RETVAL_STRING(tempstring, 0);
 done:
+   if (tmp) {
+   efree(tmp);
+   }
mail_free_body(topbod);
mail_free_envelope(env);
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-15 Thread Antony Dovgal

On 02/16/2007 05:04 AM, Ilia Alshanetsky wrote:
What version of c-client are you using? For me here the code does not  
show any errors via valgrind 3.2.3.


It's quite old, yes - imap-2004c.
imap-2006d works ok in the same time.

Ok, I found a solution, this patch fixes it:

Index: ext/imap/php_imap.c
===
RCS file: /repository/php-src/ext/imap/php_imap.c,v
retrieving revision 1.208.2.7.2.17
diff -u -p -d -r1.208.2.7.2.17 php_imap.c
--- ext/imap/php_imap.c 13 Feb 2007 20:12:52 -  1.208.2.7.2.17
+++ ext/imap/php_imap.c 16 Feb 2007 07:04:00 -
@@ -2215,7 +2215,7 @@ PHP_FUNCTION(imap_utf8)
   if (dest.data) {
   free(dest.data);
   }
-   if (src.data) {
+   if (src.data  src.data != dest.data) {
   free(src.data);
   }
}


In c-client sources they use similar if's.

--
Wbr, 
Antony Dovgal


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-02-13 Thread Ilia Alshanetsky
iliaa   Tue Feb 13 20:12:52 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  
  Fixed a memory leak inside imap_utf8()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.16r2=1.208.2.7.2.17diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.16 
php-src/ext/imap/php_imap.c:1.208.2.7.2.17
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.16  Thu Jan 18 14:03:38 2007
+++ php-src/ext/imap/php_imap.c Tue Feb 13 20:12:52 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.16 2007/01/18 14:03:38 tony2001 Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.17 2007/02/13 20:12:52 iliaa Exp $ */
 
 #define IMAP41
 
@@ -2215,6 +2215,9 @@
if (dest.data) {
free(dest.data);
}
+   if (src.data) {
+   free(src.data);
+   }
 }
 /* }}} */
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2007-01-18 Thread Antony Dovgal
tony2001Thu Jan 18 14:03:38 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  MFH: use strlcat()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.15r2=1.208.2.7.2.16diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.15 
php-src/ext/imap/php_imap.c:1.208.2.7.2.16
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.15  Mon Jan  1 09:36:01 2007
+++ php-src/ext/imap/php_imap.c Thu Jan 18 14:03:38 2007
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.15 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.16 2007/01/18 14:03:38 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -1182,13 +1182,13 @@
if ((i = cache-user_flags)) {
strcat(tmp, {);
while (i) {
-   strcat(tmp, 
imap_le_struct-imap_stream-user_flags[find_rightmost_bit (i)]);
-   if (i) strcat(tmp,  );
+   strlcat(tmp, 
imap_le_struct-imap_stream-user_flags[find_rightmost_bit (i)], sizeof(tmp));
+   if (i) strlcat(tmp,  , sizeof(tmp));
}
-   strcat(tmp, } );
+   strlcat(tmp, } , sizeof(tmp));
}
mail_fetchsubject(t = tmp + strlen(tmp), 
imap_le_struct-imap_stream, msgno, (long)25);
-   sprintf(t += strlen(t),  (%ld chars), cache-rfc822_size);
+   snprintf(t += strlen(t), sizeof(tmp) - strlen(tmp),   (%ld 
chars), cache-rfc822_size);
add_next_index_string(return_value, tmp, 1);
}
 }
@@ -3387,14 +3387,14 @@
 #define PHP_IMAP_CLEAN if (bufferTo) efree(bufferTo); if (bufferCc) 
efree(bufferCc); if (bufferBcc) efree(bufferBcc); if (bufferHeader) 
efree(bufferHeader);
 #define PHP_IMAP_BAD_DEST PHP_IMAP_CLEAN; efree(tempMailTo); return 
(BAD_MSG_DESTINATION);
 
-   bufferHeader = (char *)emalloc(bufferLen);
+   bufferHeader = (char *)emalloc(bufferLen + 1);
memset(bufferHeader, 0, bufferLen);
if (to  *to) {
-   strcat(bufferHeader, To: );
-   strcat(bufferHeader, to);
-   strcat(bufferHeader, \r\n);
+   strlcat(bufferHeader, To: , bufferLen + 1);
+   strlcat(bufferHeader, to, bufferLen + 1);
+   strlcat(bufferHeader, \r\n, bufferLen + 1);
tempMailTo = estrdup(to);
-   bufferTo = (char *)emalloc(strlen(to));
+   bufferTo = (char *)emalloc(strlen(to) + 1);
offset = 0;
addr = NULL;
rfc822_parse_adrlist(addr, tempMailTo, NULL);
@@ -3413,11 +3413,11 @@
}
 
if (cc  *cc) {
-   strcat(bufferHeader, Cc: );
-   strcat(bufferHeader, cc);
-   strcat(bufferHeader, \r\n);
+   strlcat(bufferHeader, Cc: , bufferLen + 1);
+   strlcat(bufferHeader, cc, bufferLen + 1);
+   strlcat(bufferHeader, \r\n, bufferLen + 1);
tempMailTo = estrdup(cc);
-   bufferCc = (char *)emalloc(strlen(cc));
+   bufferCc = (char *)emalloc(strlen(cc) + 1);
offset = 0;
addr = NULL;
rfc822_parse_adrlist(addr, tempMailTo, NULL);
@@ -3437,7 +3437,7 @@
 
if (bcc  *bcc) {
tempMailTo = estrdup(bcc);
-   bufferBcc = (char *)emalloc(strlen(bcc));
+   bufferBcc = (char *)emalloc(strlen(bcc) + 1);
offset = 0;
addr = NULL;
rfc822_parse_adrlist(addr, tempMailTo, NULL);
@@ -3456,7 +3456,7 @@
}
 
if (headers  *headers) {
-   strcat(bufferHeader, headers);
+   strlcat(bufferHeader, headers, bufferLen + 1);
}
 
if (TSendMail(INI_STR(SMTP), tsm_err, tsm_errmsg, bufferHeader, 
subject, bufferTo, message, bufferCc, bufferBcc, rpath TSRMLS_CC) != SUCCESS) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-12-25 Thread Ilia Alshanetsky
iliaa   Mon Dec 25 14:23:18 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  Define SENDBUFLEN for older c-client libs
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.12r2=1.208.2.7.2.13diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.12 
php-src/ext/imap/php_imap.c:1.208.2.7.2.13
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.12  Sun Dec 24 22:15:06 2006
+++ php-src/ext/imap/php_imap.c Mon Dec 25 14:23:18 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.12 2006/12/24 22:15:06 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.13 2006/12/25 14:23:18 iliaa Exp $ */
 
 #define IMAP41
 
@@ -62,6 +62,9 @@
 #define CRLF_LEN sizeof(\015\012) - 1
 #define PHP_EXPUNGE 32768
 #define PHP_IMAP_ADDRESS_SIZE_BUF 10
+#ifdef SENDBUFLEN
+#define SENDBUFLEN 16385
+#endif
 
 static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC);
 static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-12-25 Thread Ilia Alshanetsky


On 24-Dec-06, at 8:35 PM, Hannes Magnusson wrote:


Hi Ilia

My c-client library (2004g) from BSD ports doesn't have SENDBUFLEN  
defined...


I've added a handler for older c-client libs.


Ilia Alshanetsky

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-12-25 Thread Antony Dovgal
tony2001Mon Dec 25 15:28:57 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  MFH
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.13r2=1.208.2.7.2.14diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.13 
php-src/ext/imap/php_imap.c:1.208.2.7.2.14
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.13  Mon Dec 25 14:23:18 2006
+++ php-src/ext/imap/php_imap.c Mon Dec 25 15:28:57 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.13 2006/12/25 14:23:18 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.14 2006/12/25 15:28:57 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -62,7 +62,7 @@
 #define CRLF_LEN sizeof(\015\012) - 1
 #define PHP_EXPUNGE 32768
 #define PHP_IMAP_ADDRESS_SIZE_BUF 10
-#ifdef SENDBUFLEN
+#ifndef SENDBUFLEN
 #define SENDBUFLEN 16385
 #endif
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-12-24 Thread Ilia Alshanetsky
iliaa   Sun Dec 24 22:15:07 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  Fixed buffer boundary protection
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.11r2=1.208.2.7.2.12diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.11 
php-src/ext/imap/php_imap.c:1.208.2.7.2.12
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.11  Sun Dec 17 18:22:53 2006
+++ php-src/ext/imap/php_imap.c Sun Dec 24 22:15:06 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.11 2006/12/17 18:22:53 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.12 2006/12/24 22:15:06 iliaa Exp $ */
 
 #define IMAP41
 
@@ -2950,7 +2950,7 @@
BODY *bod=NULL, *topbod=NULL;
PART *mypart=NULL, *part;
PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, 
*tmp_param = NULL;
-   char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL;
+   char tmp[SENDBUFLEN + 1], *mystring=NULL, *t=NULL, *tempstring=NULL;
int toppart = 0;
 
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, envelope, body) 
== FAILURE) {
@@ -3251,8 +3251,8 @@
goto done;
}
 
-   rfc822_encode_body_7bit(env, topbod); 
-   rfc822_header (tmp, env, topbod);
+   rfc822_encode_body_7bit(env, topbod);
+   rfc822_header(tmp, env, topbod);
 
/* add custom envelope headers */
if (custom_headers_param) {
@@ -3301,43 +3301,42 @@
/* yucky default */
if (!cookie) {
cookie = -;  
+   } else if (strlen(cookie)  (sizeof(tmp) - 2 - 2)) {  
/* validate cookie length -- + CRLF */
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
The boudary should be no longer then 4kb);
+   RETVAL_FALSE;
+   goto done;  
}
 
/* for each part */
do {
t=tmp;
/* build cookie */
-   sprintf (t, --%s%s, cookie, CRLF);
+   sprintf(t, --%s%s, cookie, CRLF);
 
/* append mini-header */
rfc822_write_body_header(t, part-body);
 
/* write terminating blank line */
-   strcat (t, CRLF);
+   strcat(t, CRLF);
 
/* output cookie, mini-header, and contents */
-   
tempstring=emalloc(strlen(mystring)+strlen(tmp)+1);
-   sprintf(tempstring, %s%s, mystring, tmp);
+   spprintf(tempstring, 0, %s%s, mystring, tmp);
efree(mystring);
mystring=tempstring;
 
bod=part-body;
 
-   
tempstring=emalloc(strlen(bod-contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
-   sprintf(tempstring, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
+   spprintf(tempstring, 0, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
efree(mystring);
mystring=tempstring;
} while ((part = part-next)); /* until done */
 
/* output trailing cookie */
-   sprintf(tmp, --%s--, cookie);
-   
tempstring=emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1);
-   sprintf(tempstring, %s%s%s, mystring, tmp, CRLF);
+   spprintf(tempstring, 0, %s--%s--%s, mystring, tmp, 
CRLF);
efree(mystring);
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);
+   spprintf(tempstring, 0, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
efree(mystring);
mystring=tempstring;
} else {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-12-24 Thread Hannes Magnusson

Hi Ilia

My c-client library (2004g) from BSD ports doesn't have SENDBUFLEN defined...

-Hannes

On 12/24/06, Ilia Alshanetsky [EMAIL PROTECTED] wrote:

iliaa   Sun Dec 24 22:15:07 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c
  Log:
  Fixed buffer boundary protection


http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.11r2=1.208.2.7.2.12diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.11 
php-src/ext/imap/php_imap.c:1.208.2.7.2.12
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.11  Sun Dec 17 18:22:53 2006
+++ php-src/ext/imap/php_imap.c Sun Dec 24 22:15:06 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.11 2006/12/17 18:22:53 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.12 2006/12/24 22:15:06 iliaa Exp $ */

 #define IMAP41

@@ -2950,7 +2950,7 @@
BODY *bod=NULL, *topbod=NULL;
PART *mypart=NULL, *part;
PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL, 
*tmp_param = NULL;
-   char tmp[8 * MAILTMPLEN], *mystring=NULL, *t=NULL, *tempstring=NULL;
+   char tmp[SENDBUFLEN + 1], *mystring=NULL, *t=NULL, *tempstring=NULL;
int toppart = 0;

if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, envelope, body) 
== FAILURE) {
@@ -3251,8 +3251,8 @@
goto done;
}

-   rfc822_encode_body_7bit(env, topbod);
-   rfc822_header (tmp, env, topbod);
+   rfc822_encode_body_7bit(env, topbod);
+   rfc822_header(tmp, env, topbod);

/* add custom envelope headers */
if (custom_headers_param) {
@@ -3301,43 +3301,42 @@
/* yucky default */
if (!cookie) {
cookie = -;
+   } else if (strlen(cookie)  (sizeof(tmp) - 2 - 2)) {  
/* validate cookie length -- + CRLF */
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The 
boudary should be no longer then 4kb);
+   RETVAL_FALSE;
+   goto done;
}

/* for each part */
do {
t=tmp;
/* build cookie */
-   sprintf (t, --%s%s, cookie, CRLF);
+   sprintf(t, --%s%s, cookie, CRLF);

/* append mini-header */
rfc822_write_body_header(t, part-body);

/* write terminating blank line */
-   strcat (t, CRLF);
+   strcat(t, CRLF);

/* output cookie, mini-header, and contents */
-   
tempstring=emalloc(strlen(mystring)+strlen(tmp)+1);
-   sprintf(tempstring, %s%s, mystring, tmp);
+   spprintf(tempstring, 0, %s%s, mystring, tmp);
efree(mystring);
mystring=tempstring;

bod=part-body;

-   
tempstring=emalloc(strlen(bod-contents.text.data)+strlen(CRLF)+strlen(mystring)+1);
-   sprintf(tempstring, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
+   spprintf(tempstring, 0, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
efree(mystring);
mystring=tempstring;
} while ((part = part-next)); /* until done */

/* output trailing cookie */
-   sprintf(tmp, --%s--, cookie);
-   
tempstring=emalloc(strlen(tmp)+strlen(CRLF)+strlen(mystring)+1);
-   sprintf(tempstring, %s%s%s, mystring, tmp, CRLF);
+   spprintf(tempstring, 0, %s--%s--%s, mystring, tmp, 
CRLF);
efree(mystring);
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);
+   spprintf(tempstring, 0, %s%s%s, mystring, 
bod-contents.text.data, CRLF);
efree(mystring);
mystring=tempstring;
} else {

--
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: php-src(PHP_5_2) /ext/imap php_imap.c

2006-11-24 Thread Antony Dovgal
tony2001Fri Nov 24 10:28:51 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  fix #39613 (Possible segfault in imap initialization due to missing module 
dependency)
  patch by wharmby at uk dot ibm dot com
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.9r2=1.208.2.7.2.10diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.9 
php-src/ext/imap/php_imap.c:1.208.2.7.2.10
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.9   Mon Nov  6 16:44:03 2006
+++ php-src/ext/imap/php_imap.c Fri Nov 24 10:28:51 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.9 2006/11/06 16:44:03 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.10 2006/11/24 10:28:51 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -169,10 +169,18 @@
 };
 /* }}} */
 
+/* {{{ imap dependencies */
+static zend_module_dep imap_deps[] = {
+   ZEND_MOD_REQUIRED(standard)
+   {NULL, NULL, NULL}
+};
+/* }}} */
+
 /* {{{ imap_module_entry
  */
 zend_module_entry imap_module_entry = {
-   STANDARD_MODULE_HEADER,
+   STANDARD_MODULE_HEADER_EX, NULL,
+   imap_deps,
imap,
imap_functions,
PHP_MINIT(imap),

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-11-06 Thread Ilia Alshanetsky
iliaa   Mon Nov  6 16:44:03 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  param parsing fix
  
  # Thanks Hannes
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.8r2=1.208.2.7.2.9diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.8 
php-src/ext/imap/php_imap.c:1.208.2.7.2.9
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.8   Sun Nov  5 18:31:41 2006
+++ php-src/ext/imap/php_imap.c Mon Nov  6 16:44:03 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.8 2006/11/05 18:31:41 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.9 2006/11/06 16:44:03 iliaa Exp $ */
 
 #define IMAP41
 
@@ -743,7 +743,7 @@
long cl_flags=NIL;
int myargc = ZEND_NUM_ARGS();

-   if (myargc  3 || myargc  4 || zend_get_parameters_ex(myargc, 
mailbox, user, passwd, options, retries) == FAILURE) {
+   if (myargc  3 || myargc  5 || zend_get_parameters_ex(myargc, 
mailbox, user, passwd, options, retries) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-10-05 Thread Antony Dovgal
tony2001Thu Oct  5 14:25:42 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  fix build with new version of c-client
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.6r2=1.208.2.7.2.7diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.6 
php-src/ext/imap/php_imap.c:1.208.2.7.2.7
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.6   Sun Sep 24 18:06:37 2006
+++ php-src/ext/imap/php_imap.c Thu Oct  5 14:25:41 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.6 2006/09/24 18:06:37 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.7 2006/10/05 14:25:41 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -2181,7 +2181,12 @@
dest.size = 0;
 
cpytxt(src, Z_STRVAL_PP(str), Z_STRLEN_PP(str));
+
+#ifndef HAVE_NEW_MIME2TEXT
utf8_mime2text(src, dest);
+#else
+   utf8_mime2text(src, dest, U8T_CANONICAL);
+#endif
RETVAL_STRINGL(dest.data, dest.size, 1);
if (dest.data) {
free(dest.data);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c /ext/imap/tests imap_utf8.phpt

2006-09-05 Thread Antony Dovgal
tony2001Tue Sep  5 11:24:49 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/imap/tests imap_utf8.phpt 

  Modified files:  
/php-src/ext/imap   php_imap.c 
  Log:
  fix leak in imap_utf8(), avoid extra strlen() call
  add test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.4r2=1.208.2.7.2.5diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.4 
php-src/ext/imap/php_imap.c:1.208.2.7.2.5
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.4   Thu Aug 31 16:15:24 2006
+++ php-src/ext/imap/php_imap.c Tue Sep  5 11:24:49 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.4 2006/08/31 16:15:24 tony2001 Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.5 2006/09/05 11:24:49 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -2178,7 +2178,10 @@
 
cpytxt(src, Z_STRVAL_PP(str), Z_STRLEN_PP(str));
utf8_mime2text(src, dest);
-   RETURN_STRINGL(dest.data, strlen(dest.data), 1);
+   RETVAL_STRINGL(dest.data, dest.size, 1);
+   if (dest.data) {
+   free(dest.data);
+   }
 }
 /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/imap/tests/imap_utf8.phpt?view=markuprev=1.1
Index: php-src/ext/imap/tests/imap_utf8.phpt
+++ php-src/ext/imap/tests/imap_utf8.phpt
--TEST--
imap_utf8() tests
--SKIPIF--
?php if (!extension_loaded(imap)) print skip; ?
--FILE--
?php

var_dump(imap_utf8());
var_dump(imap_utf8(1));
var_dump(imap_utf8(array(1,2)));
var_dump(imap_utf8(test));

echo Done\n;
?
--EXPECTF-- 
string(0) 
string(1) 1

Notice: Array to string conversion in %s on line %d
string(5) Array
string(4) test
Done
--UEXPECTF--
string(0) 
string(1) 1

Notice: Array to string conversion in %s on line %d
string(5) Array
string(4) test
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c /ext/mbstring mbstring.c /ext/oci8 oci8_statement.c /ext/posix posix.c /ext/reflection php_reflection.c /ext/sockets sockets.c

2006-08-31 Thread Antony Dovgal
tony2001Thu Aug 31 16:15:25 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
/php-src/ext/mbstring   mbstring.c 
/php-src/ext/oci8   oci8_statement.c 
/php-src/ext/posix  posix.c 
/php-src/ext/reflection php_reflection.c 
/php-src/ext/socketssockets.c 
  Log:
  last portion of z/Z fixes
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.3r2=1.208.2.7.2.4diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.3 
php-src/ext/imap/php_imap.c:1.208.2.7.2.4
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.3   Fri Aug 11 15:07:29 2006
+++ php-src/ext/imap/php_imap.c Thu Aug 31 16:15:24 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.3 2006/08/11 15:07:29 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.4 2006/08/31 16:15:24 tony2001 Exp $ */
 
 #define IMAP41
 
@@ -1876,14 +1876,14 @@
Save a specific body section to a file */
 PHP_FUNCTION(imap_savebody)
 {
-   zval *stream, *out;
+   zval *stream, **out;
pils *imap_ptr = NULL;
php_stream *writer = NULL;
char *section = ;
int section_len = 0, close_stream = 1;
long msgno, flags = 0;

-   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
rzl|sl, stream, out, msgno, section, section_len, flags)) {
+   if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
rZl|sl, stream, out, msgno, section, section_len, flags)) {
RETURN_FALSE;
}

@@ -1893,17 +1893,17 @@
RETURN_FALSE;
}

-   switch (Z_TYPE_P(out))
+   switch (Z_TYPE_PP(out))
{
case IS_LONG:
case IS_RESOURCE:
close_stream = 0;
-   php_stream_from_zval(writer, out);
+   php_stream_from_zval(writer, out);
break;
 
default:
-   convert_to_string_ex(out);
-   writer = php_stream_open_wrapper(Z_STRVAL_P(out), wb, 
REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
+   convert_to_string_ex(out);
+   writer = php_stream_open_wrapper(Z_STRVAL_PP(out), 
wb, REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
break;
}

http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.11r2=1.224.2.22.2.12diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.11 
php-src/ext/mbstring/mbstring.c:1.224.2.22.2.12
--- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.11 Fri Aug 25 16:26:50 2006
+++ php-src/ext/mbstring/mbstring.c Thu Aug 31 16:15:24 2006
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: mbstring.c,v 1.224.2.22.2.11 2006/08/25 16:26:50 masugata Exp $ */
+/* $Id: mbstring.c,v 1.224.2.22.2.12 2006/08/31 16:15:24 tony2001 Exp $ */
 
 /*
  * PHP 4 Multibyte String module mbstring
@@ -1645,7 +1645,7 @@
mbfl_string haystack, needle;
char *enc_name = NULL;
int enc_name_len;
-   zval *zoffset;
+   zval **zoffset;
long offset = 0, str_flg;
char *enc_name2 = NULL;
int enc_name_len2;
@@ -1657,14 +1657,14 @@
needle.no_language = MBSTRG(current_language);
needle.no_encoding = MBSTRG(current_internal_encoding);
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|zs, (char 
**)haystack.val, haystack.len, (char **)needle.val, needle.len, zoffset, 
enc_name, enc_name_len) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ss|Zs, (char 
**)haystack.val, haystack.len, (char **)needle.val, needle.len, zoffset, 
enc_name, enc_name_len) == FAILURE) {
RETURN_FALSE;
}
 
if(ZEND_NUM_ARGS() = 3) {
-   if (Z_TYPE_P(zoffset) == IS_STRING) {
-   enc_name2 = Z_STRVAL_P(zoffset);
-   enc_name_len2 = Z_STRLEN_P(zoffset);
+   if (Z_TYPE_PP(zoffset) == IS_STRING) {
+   enc_name2 = Z_STRVAL_PP(zoffset);
+   enc_name_len2 = Z_STRLEN_PP(zoffset);
str_flg   = 1;
 
if (enc_name2 != NULL) {
@@ -1690,15 +1690,15 @@
}
 
if(str_flg) {
-   convert_to_long(zoffset);
-   offset   = Z_LVAL_P(zoffset);
+   convert_to_long_ex(zoffset);
+   offset   = Z_LVAL_PP(zoffset);
} else {

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/imap php_imap.c

2006-08-11 Thread Ilia Alshanetsky
iliaa   Fri Aug 11 15:07:30 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/imap   php_imap.c 
  Log:
  MFB: Extend safe_mode/open_basedir checks to imap_reopen() as well.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.2r2=1.208.2.7.2.3diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.2 
php-src/ext/imap/php_imap.c:1.208.2.7.2.3
--- php-src/ext/imap/php_imap.c:1.208.2.7.2.2   Fri Aug  4 20:31:19 2006
+++ php-src/ext/imap/php_imap.c Fri Aug 11 15:07:29 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates:  Zeev Suraski [EMAIL PROTECTED]   |
+--+
  */
-/* $Id: php_imap.c,v 1.208.2.7.2.2 2006/08/04 20:31:19 iliaa Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.3 2006/08/11 15:07:29 iliaa Exp $ */
 
 #define IMAP41
 
@@ -826,6 +826,14 @@
}
imap_le_struct-flags = cl_flags;   
}
+
+   /* local filename, need to perform open_basedir and safe_mode checks */
+   if (Z_STRVAL_PP(mailbox)[0] != '{'  
+   (php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC) 
|| 
+   (PG(safe_mode)  !php_checkuid(Z_STRVAL_PP(mailbox), 
NULL, CHECKUID_CHECK_FILE_AND_DIR {
+   RETURN_FALSE;
+   }
+
imap_stream = mail_open(imap_le_struct-imap_stream, 
Z_STRVAL_PP(mailbox), flags);
if (imap_stream == NIL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Couldn't re-open 
stream);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php