iliaa Sun Nov 5 18:32:41 2006 UTC
Modified files:
/php-src/ext/imap php_imap.c
Log:
MFB: Fixed bug #39362 (Added an option to imap_open/imap_reopen to control
the number of connection retries).
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.226&r2=1.227&diff_format=u
Index: php-src/ext/imap/php_imap.c
diff -u php-src/ext/imap/php_imap.c:1.226 php-src/ext/imap/php_imap.c:1.227
--- php-src/ext/imap/php_imap.c:1.226 Sun Oct 8 13:34:22 2006
+++ php-src/ext/imap/php_imap.c Sun Nov 5 18:32:41 2006
@@ -26,7 +26,7 @@
| PHP 4.0 updates: Zeev Suraski <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.226 2006/10/08 13:34:22 bjori Exp $ */
+/* $Id: php_imap.c,v 1.227 2006/11/05 18:32:41 iliaa Exp $ */
#define IMAP41
@@ -736,21 +736,21 @@
*/
static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
- zval **mailbox, **user, **passwd, **options;
+ zval **mailbox, **user, **passwd, **options, **retries;
MAILSTREAM *imap_stream;
pils *imap_le_struct;
long flags=NIL;
long cl_flags=NIL;
int myargc = ZEND_NUM_ARGS();
- if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc,
&mailbox, &user, &passwd, &options) == FAILURE) {
+ if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc,
&mailbox, &user, &passwd, &options, &retries) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
convert_to_string_ex(mailbox);
convert_to_string_ex(user);
convert_to_string_ex(passwd);
- if (myargc ==4) {
+ if (myargc >= 4) {
convert_to_long_ex(options);
flags = Z_LVAL_PP(options);
if (flags & PHP_EXPUNGE) {
@@ -775,6 +775,13 @@
IMAPG(imap_user) = estrndup(Z_STRVAL_PP(user), Z_STRLEN_PP(user));
IMAPG(imap_password) = estrndup(Z_STRVAL_PP(passwd),
Z_STRLEN_PP(passwd));
+#ifdef SET_MAXLOGINTRIALS
+ if (myargc == 5) {
+ convert_to_long_ex(retries);
+ mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *)
Z_LVAL_PP(retries));
+ }
+#endif
+
imap_stream = mail_open(NIL, Z_STRVAL_PP(mailbox), flags);
if (imap_stream == NIL) {
@@ -792,7 +799,7 @@
}
/* }}} */
-/* {{{ proto resource imap_open(string mailbox, string user, string password
[, int options])
+/* {{{ proto resource imap_open(string mailbox, string user, string password
[, int options [, int n_retries]])
Open an IMAP stream to a mailbox */
PHP_FUNCTION(imap_open)
{
@@ -800,18 +807,18 @@
}
/* }}} */
-/* {{{ proto bool imap_reopen(resource stream_id, string mailbox [, int
options])
+/* {{{ proto bool imap_reopen(resource stream_id, string mailbox [, int
options [, int n_retries]])
Reopen an IMAP stream to a new mailbox */
PHP_FUNCTION(imap_reopen)
{
- zval **streamind, **mailbox, **options;
+ zval **streamind, **mailbox, **options, **retries;
pils *imap_le_struct;
MAILSTREAM *imap_stream;
long flags=NIL;
long cl_flags=NIL;
int myargc=ZEND_NUM_ARGS();
- if (myargc < 2 || myargc > 3 || zend_get_parameters_ex(myargc,
&streamind, &mailbox, &options) == FAILURE) {
+ if (myargc < 2 || myargc > 4 || zend_get_parameters_ex(myargc,
&streamind, &mailbox, &options, &retries) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -819,7 +826,7 @@
convert_to_string_ex(mailbox);
- if (myargc == 3) {
+ if (myargc >= 3) {
convert_to_long_ex(options);
flags = Z_LVAL_PP(options);
if (flags & PHP_EXPUNGE) {
@@ -828,7 +835,12 @@
}
imap_le_struct->flags = cl_flags;
}
-
+#ifdef SET_MAXLOGINTRIALS
+ if (myargc == 4) {
+ convert_to_long_ex(retries);
+ mail_parameters(NIL, SET_MAXLOGINTRIALS, (void *)
Z_LVAL_PP(retries));
+ }
+#endif
/* local filename, need to perform open_basedir checks */
if (Z_STRVAL_PP(mailbox)[0] != '{' &&
php_check_open_basedir(Z_STRVAL_PP(mailbox) TSRMLS_CC)) {
RETURN_FALSE;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php