File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -2129,6 +2129,8 @@ PHP_FUNCTION(ldap_sort)
2129
2129
PHP_FUNCTION (ldap_get_option )
2130
2130
{
2131
2131
zval * link , * retval ;
2132
+ zval tmp1 ;
2133
+ int num_entries ;
2132
2134
ldap_linkdata * ld ;
2133
2135
zend_long option ;
2134
2136
@@ -2273,9 +2275,37 @@ PHP_FUNCTION(ldap_get_option)
2273
2275
ZVAL_STRING (retval , val );
2274
2276
ldap_memfree (val );
2275
2277
} break ;
2276
- /* options not implemented
2277
2278
case LDAP_OPT_SERVER_CONTROLS :
2278
2279
case LDAP_OPT_CLIENT_CONTROLS :
2280
+ {
2281
+ LDAPControl * * ctrls = NULL , * * ctrlp ;
2282
+
2283
+ if (ldap_get_option (ld -> link , option , & ctrls ) || ctrls == NULL ) {
2284
+ if (ctrls ) {
2285
+ ldap_memfree (ctrls );
2286
+ }
2287
+ RETURN_FALSE ;
2288
+ }
2289
+
2290
+ zval_ptr_dtor (retval );
2291
+ array_init (retval );
2292
+ num_entries = 0 ;
2293
+ ctrlp = ctrls ;
2294
+ while (* ctrlp != NULL )
2295
+ {
2296
+ array_init (& tmp1 );
2297
+ add_assoc_string (& tmp1 , "oid" , (* ctrlp )-> ldctl_oid );
2298
+ add_assoc_bool (& tmp1 , "iscritical" , ((* ctrlp )-> ldctl_iscritical != 0 ));
2299
+ if ((* ctrlp )-> ldctl_value .bv_len ) {
2300
+ add_assoc_stringl (& tmp1 , "value" , (* ctrlp )-> ldctl_value .bv_val , (* ctrlp )-> ldctl_value .bv_len );
2301
+ }
2302
+ zend_hash_index_update (Z_ARRVAL_P (retval ), num_entries , & tmp1 );
2303
+ num_entries ++ ;
2304
+ ctrlp ++ ;
2305
+ }
2306
+ ldap_controls_free (ctrls );
2307
+ } break ;
2308
+ /* options not implemented
2279
2309
case LDAP_OPT_API_INFO:
2280
2310
case LDAP_OPT_API_FEATURE_INFO:
2281
2311
*/
You can’t perform that action at this time.
0 commit comments