72
72
73
73
typedef struct {
74
74
LDAP * link ;
75
- #if defined(LDAP_API_FEATURE_X_OPENLDAP ) && defined( HAVE_3ARG_SETREBINDPROC )
75
+ #if defined(HAVE_3ARG_SETREBINDPROC )
76
76
zval * rebindproc ;
77
77
#endif
78
78
} ldap_linkdata ;
@@ -98,7 +98,6 @@ static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
98
98
99
99
/* ldap_unbind_s() is deprecated;
100
100
* the distinction between ldap_unbind() and ldap_unbind_s() is moot */
101
- #ifdef LDAP_API_FEATURE_X_OPENLDAP
102
101
ldap_unbind_ext (ld -> link , NULL , NULL );
103
102
#ifdef HAVE_3ARG_SETREBINDPROC
104
103
@@ -107,9 +106,6 @@ static void _close_ldap_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
107
106
FREE_ZVAL (ld -> rebindproc );
108
107
}
109
108
#endif
110
- #else /* ! LDAP_API_FEATURE_X_OPENLDAP */
111
- ldap_unbind_s (ld -> link );
112
- #endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
113
109
114
110
efree (ld );
115
111
LDAPG (num_links )-- ;
@@ -310,13 +306,7 @@ PHP_FUNCTION(ldap_connect)
310
306
{
311
307
char * host = NULL ;
312
308
int hostlen ;
313
- long port =
314
- #ifdef LDAP_API_FEATURE_X_OPENLDAP
315
- LDAP_PORT
316
- #else /* ! LDAP_API_FEATURE_X_OPENLDAP */
317
- 389 /* Default port */
318
- #endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
319
- ;
309
+ long port = LDAP_PORT ;
320
310
#ifdef HAVE_ORALDAP
321
311
char * wallet = NULL , * walletpasswd = NULL ;
322
312
int walletlen = 0 , walletpasswdlen = 0 ;
@@ -351,7 +341,6 @@ PHP_FUNCTION(ldap_connect)
351
341
352
342
ld = ecalloc (1 , sizeof (ldap_linkdata ));
353
343
354
- #ifdef LDAP_API_FEATURE_X_OPENLDAP
355
344
/* OpenLDAP provides a specific call to detect valid LDAP URIs;
356
345
* ldap_init()/ldap_open() is deprecated, use ldap_initialize() instead.
357
346
*/
@@ -380,9 +369,6 @@ PHP_FUNCTION(ldap_connect)
380
369
RETURN_FALSE ;
381
370
}
382
371
}
383
- #else /* ! LDAP_API_FEATURE_X_OPENLDAP */
384
- ldap = ldap_open (host , port );
385
- #endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
386
372
387
373
if (ldap == NULL ) {
388
374
efree (ld );
@@ -470,7 +456,6 @@ PHP_FUNCTION(ldap_bind)
470
456
RETURN_FALSE ;
471
457
}
472
458
473
- #ifdef LDAP_API_FEATURE_X_OPENLDAP
474
459
{
475
460
struct berval cred ;
476
461
@@ -481,9 +466,6 @@ PHP_FUNCTION(ldap_bind)
481
466
NULL , NULL , /* no controls right now */
482
467
NULL ); /* we don't care about the server's credentials */
483
468
}
484
- #else
485
- rc = ldap_bind_s (ld -> link , ldap_bind_dn , ldap_bind_pw , LDAP_AUTH_SIMPLE );
486
- #endif
487
469
if ( rc != LDAP_SUCCESS ) {
488
470
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Unable to bind to server: %s" , ldap_err2string (rc ));
489
471
RETURN_FALSE ;
@@ -801,7 +783,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
801
783
php_set_opts (ld -> link , ldap_sizelimit , ldap_timelimit , ldap_deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
802
784
803
785
/* Run the actual search */
804
- rcs [ i ] = ldap_search (ld -> link , ldap_base_dn , scope , ldap_filter , ldap_attrs , ldap_attrsonly );
786
+ ldap_search_ext (ld -> link , ldap_base_dn , scope , ldap_filter , ldap_attrs , ldap_attrsonly , NULL , NULL , NULL , ldap_sizelimit , & rcs [ i ] );
805
787
lds [i ] = ld ;
806
788
zend_hash_move_forward (Z_ARRVAL_P (link ));
807
789
}
@@ -843,7 +825,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
843
825
php_set_opts (ld -> link , ldap_sizelimit , ldap_timelimit , ldap_deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
844
826
845
827
/* Run the actual search */
846
- errno = ldap_search_s (ld -> link , ldap_base_dn , scope , ldap_filter , ldap_attrs , ldap_attrsonly , & ldap_res );
828
+ errno = ldap_search_ext_s (ld -> link , ldap_base_dn , scope , ldap_filter , ldap_attrs , ldap_attrsonly , NULL , NULL , NULL , ldap_sizelimit , & ldap_res );
847
829
848
830
if (errno != LDAP_SUCCESS
849
831
&& errno != LDAP_SIZELIMIT_EXCEEDED
@@ -1314,12 +1296,8 @@ PHP_FUNCTION(ldap_explode_dn)
1314
1296
add_index_string (return_value , i , ldap_value [i ], 1 );
1315
1297
}
1316
1298
1317
- #ifdef LDAP_API_FEATURE_X_OPENLDAP
1318
1299
/* ldap_value_free() is deprecated */
1319
- ber_memvfree ((void * * )ldap_value );
1320
- #else /* ! LDAP_API_FEATURE_X_OPENLDAP */
1321
- ldap_value_free (ldap_value );
1322
- #endif /* ! LDAP_API_FEATURE_X_OPENLDAP */
1300
+ ldap_memvfree ((void * * )ldap_value );
1323
1301
}
1324
1302
/* }}} */
1325
1303
@@ -1443,7 +1421,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper)
1443
1421
1444
1422
/* check flag to see if do_mod was called to perform full add , gerrit thomson */
1445
1423
if (is_full_add == 1 ) {
1446
- if ((i = ldap_add_s (ld -> link , dn , ldap_mods )) != LDAP_SUCCESS ) {
1424
+ if ((i = ldap_add_ext_s (ld -> link , dn , ldap_mods , NULL , NULL )) != LDAP_SUCCESS ) {
1447
1425
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Add: %s" , ldap_err2string (i ));
1448
1426
RETVAL_FALSE ;
1449
1427
} else RETVAL_TRUE ;
@@ -1520,7 +1498,7 @@ PHP_FUNCTION(ldap_delete)
1520
1498
1521
1499
ZEND_FETCH_RESOURCE (ld , ldap_linkdata * , & link , -1 , "ldap link" , le_link );
1522
1500
1523
- if ((rc = ldap_delete_s (ld -> link , dn )) != LDAP_SUCCESS ) {
1501
+ if ((rc = ldap_delete_ext_s (ld -> link , dn , NULL , NULL )) != LDAP_SUCCESS ) {
1524
1502
php_error_docref (NULL TSRMLS_CC , E_WARNING , "Delete: %s" , ldap_err2string (rc ));
1525
1503
RETURN_FALSE ;
1526
1504
}
@@ -1943,9 +1921,13 @@ PHP_FUNCTION(ldap_compare)
1943
1921
return ;
1944
1922
}
1945
1923
1924
+ struct berval lvalue ;
1925
+ lvalue .bv_val = value ;
1926
+ lvalue .bv_len = value_len ;
1927
+
1946
1928
ZEND_FETCH_RESOURCE (ld , ldap_linkdata * , & link , -1 , "ldap link" , le_link );
1947
1929
1948
- errno = ldap_compare_s (ld -> link , dn , attr , value );
1930
+ errno = ldap_compare_ext_s (ld -> link , dn , attr , & lvalue , NULL , NULL );
1949
1931
1950
1932
switch (errno ) {
1951
1933
case LDAP_COMPARE_TRUE :
@@ -2310,7 +2292,7 @@ PHP_FUNCTION(ldap_parse_result)
2310
2292
add_next_index_string (referrals , * refp , 1 );
2311
2293
refp ++ ;
2312
2294
}
2313
- ldap_value_free ( lreferrals );
2295
+ ldap_memvfree (( void * * ) lreferrals );
2314
2296
}
2315
2297
case 5 :
2316
2298
zval_dtor (errmsg );
@@ -2421,7 +2403,7 @@ PHP_FUNCTION(ldap_parse_reference)
2421
2403
add_next_index_string (referrals , * refp , 1 );
2422
2404
refp ++ ;
2423
2405
}
2424
- ldap_value_free ( lreferrals );
2406
+ ldap_memvfree (( void * * ) lreferrals );
2425
2407
}
2426
2408
RETURN_TRUE ;
2427
2409
}
@@ -2495,7 +2477,7 @@ PHP_FUNCTION(ldap_start_tls)
2495
2477
#endif
2496
2478
#endif /* (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP */
2497
2479
2498
- #if defined(LDAP_API_FEATURE_X_OPENLDAP ) && defined( HAVE_3ARG_SETREBINDPROC )
2480
+ #if defined(HAVE_3ARG_SETREBINDPROC )
2499
2481
/* {{{ _ldap_rebind_proc()
2500
2482
*/
2501
2483
int _ldap_rebind_proc (LDAP * ldap , const char * url , ber_tag_t req , ber_int_t msgid , void * params )
@@ -2847,7 +2829,7 @@ PHP_FUNCTION(ldap_control_paged_result_response)
2847
2829
RETURN_FALSE ;
2848
2830
}
2849
2831
2850
- lctrl = ldap_find_control (LDAP_CONTROL_PAGEDRESULTS , lserverctrls );
2832
+ lctrl = ldap_control_find (LDAP_CONTROL_PAGEDRESULTS , lserverctrls , NULL );
2851
2833
if (lctrl == NULL ) {
2852
2834
ldap_controls_free (lserverctrls );
2853
2835
php_error_docref (NULL TSRMLS_CC , E_WARNING , "No paged results control response in result" );
@@ -3148,7 +3130,7 @@ ZEND_END_ARG_INFO()
3148
3130
#endif
3149
3131
#endif
3150
3132
3151
- #if defined(LDAP_API_FEATURE_X_OPENLDAP ) && defined( HAVE_3ARG_SETREBINDPROC )
3133
+ #if defined(HAVE_3ARG_SETREBINDPROC )
3152
3134
ZEND_BEGIN_ARG_INFO_EX (arginfo_ldap_set_rebind_proc , 0 , 0 , 2 )
3153
3135
ZEND_ARG_INFO (0 , link )
3154
3136
ZEND_ARG_INFO (0 , callback )
@@ -3236,7 +3218,7 @@ const zend_function_entry ldap_functions[] = {
3236
3218
#endif
3237
3219
#endif
3238
3220
3239
- #if defined(LDAP_API_FEATURE_X_OPENLDAP ) && defined ( HAVE_3ARG_SETREBINDPROC )
3221
+ #if defined(HAVE_3ARG_SETREBINDPROC )
3240
3222
PHP_FE (ldap_set_rebind_proc , arginfo_ldap_set_rebind_proc )
3241
3223
#endif
3242
3224
0 commit comments