@@ -105,6 +105,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_open, 0, 0, 3)
105
105
ZEND_ARG_INFO (0 , password )
106
106
ZEND_ARG_INFO (0 , options )
107
107
ZEND_ARG_INFO (0 , n_retries )
108
+ ZEND_ARG_INFO (0 , params )
108
109
ZEND_END_ARG_INFO ()
109
110
110
111
ZEND_BEGIN_ARG_INFO_EX (arginfo_imap_reopen , 0 , 0 , 2 )
@@ -1148,10 +1149,11 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
1148
1149
long retries = 0 , flags = NIL , cl_flags = NIL ;
1149
1150
MAILSTREAM * imap_stream ;
1150
1151
pils * imap_le_struct ;
1152
+ zval * params = NULL ;
1151
1153
int argc = ZEND_NUM_ARGS ();
1152
1154
1153
- if (zend_parse_parameters (argc TSRMLS_CC , "sss|ll " , & mailbox , & mailbox_len , & user , & user_len ,
1154
- & passwd , & passwd_len , & flags , & retries ) == FAILURE ) {
1155
+ if (zend_parse_parameters (argc TSRMLS_CC , "sss|lla " , & mailbox , & mailbox_len , & user , & user_len ,
1156
+ & passwd , & passwd_len , & flags , & retries , & params ) == FAILURE ) {
1155
1157
return ;
1156
1158
}
1157
1159
@@ -1165,6 +1167,46 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
1165
1167
}
1166
1168
}
1167
1169
1170
+ if (params ) {
1171
+ zval * * disabled_auth_method ;
1172
+
1173
+ if (zend_hash_find (HASH_OF (params ), "DISABLE_AUTHENTICATOR" , sizeof ("DISABLE_AUTHENTICATOR" ), (void * * )& disabled_auth_method ) == SUCCESS ) {
1174
+ switch (Z_TYPE_PP (disabled_auth_method )) {
1175
+ case IS_STRING :
1176
+ if (Z_STRLEN_PP (disabled_auth_method ) > 1 ) {
1177
+ mail_parameters (NIL , DISABLE_AUTHENTICATOR , (void * )Z_STRVAL_PP (disabled_auth_method ));
1178
+ }
1179
+ break ;
1180
+ case IS_ARRAY :
1181
+ {
1182
+ zval * * z_auth_method ;
1183
+ int i ;
1184
+ int nelems = zend_hash_num_elements (Z_ARRVAL_PP (disabled_auth_method ));
1185
+
1186
+ if (nelems == 0 ) {
1187
+ break ;
1188
+ }
1189
+ for (i = 0 ; i < nelems ; i ++ ) {
1190
+ if (zend_hash_index_find (Z_ARRVAL_PP (disabled_auth_method ), i , (void * * ) & z_auth_method ) == SUCCESS ) {
1191
+ if (Z_TYPE_PP (z_auth_method ) == IS_STRING ) {
1192
+ if (Z_STRLEN_PP (z_auth_method ) > 1 ) {
1193
+ mail_parameters (NIL , DISABLE_AUTHENTICATOR , (void * )Z_STRVAL_PP (disabled_auth_method ));
1194
+ }
1195
+ } else {
1196
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid argument, expect string or array of strings" );
1197
+ }
1198
+ }
1199
+ }
1200
+ }
1201
+ break ;
1202
+ case IS_LONG :
1203
+ default :
1204
+ php_error_docref (NULL TSRMLS_CC , E_WARNING , "Invalid argument, expect string or array of strings" );
1205
+ break ;
1206
+ }
1207
+ }
1208
+ }
1209
+
1168
1210
if (IMAPG (imap_user )) {
1169
1211
efree (IMAPG (imap_user ));
1170
1212
}
0 commit comments