@@ -1432,7 +1432,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1432
1432
LDAPControl * * lserverctrls = NULL ;
1433
1433
int ldap_attrsonly = 0 , ldap_sizelimit = -1 , ldap_timelimit = -1 , ldap_deref = -1 ;
1434
1434
int old_ldap_sizelimit = -1 , old_ldap_timelimit = -1 , old_ldap_deref = -1 ;
1435
- int num_attribs = 0 , ret = 1 , i , errno , argcount = ZEND_NUM_ARGS ();
1435
+ int num_attribs = 0 , ret = 1 , i , php_ldap_errno , argcount = ZEND_NUM_ARGS ();
1436
1436
1437
1437
if (zend_parse_parameters (argcount , "zzz|a/lllla/" , & link , & base_dn , & filter , & attrs , & attrsonly ,
1438
1438
& sizelimit , & timelimit , & deref , & serverctrls ) == FAILURE ) {
@@ -1617,30 +1617,30 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope)
1617
1617
php_set_opts (ld -> link , ldap_sizelimit , ldap_timelimit , ldap_deref , & old_ldap_sizelimit , & old_ldap_timelimit , & old_ldap_deref );
1618
1618
1619
1619
/* Run the actual search */
1620
- errno = ldap_search_ext_s (ld -> link , ZSTR_VAL (ldap_base_dn ), scope , ZSTR_VAL (ldap_filter ), ldap_attrs , ldap_attrsonly , lserverctrls , NULL , NULL , ldap_sizelimit , & ldap_res );
1620
+ php_ldap_errno = ldap_search_ext_s (ld -> link , ZSTR_VAL (ldap_base_dn ), scope , ZSTR_VAL (ldap_filter ), ldap_attrs , ldap_attrsonly , lserverctrls , NULL , NULL , ldap_sizelimit , & ldap_res );
1621
1621
1622
- if (errno != LDAP_SUCCESS
1623
- && errno != LDAP_SIZELIMIT_EXCEEDED
1622
+ if (php_ldap_errno != LDAP_SUCCESS
1623
+ && php_ldap_errno != LDAP_SIZELIMIT_EXCEEDED
1624
1624
#ifdef LDAP_ADMINLIMIT_EXCEEDED
1625
- && errno != LDAP_ADMINLIMIT_EXCEEDED
1625
+ && php_ldap_errno != LDAP_ADMINLIMIT_EXCEEDED
1626
1626
#endif
1627
1627
#ifdef LDAP_REFERRAL
1628
- && errno != LDAP_REFERRAL
1628
+ && php_ldap_errno != LDAP_REFERRAL
1629
1629
#endif
1630
1630
) {
1631
1631
/* ldap_res should be freed regardless of return value of ldap_search_ext_s()
1632
1632
* see: https://linux.die.net/man/3/ldap_search_ext_s */
1633
1633
if (ldap_res != NULL ) {
1634
1634
ldap_msgfree (ldap_res );
1635
1635
}
1636
- php_error_docref (NULL , E_WARNING , "Search: %s" , ldap_err2string (errno ));
1636
+ php_error_docref (NULL , E_WARNING , "Search: %s" , ldap_err2string (php_ldap_errno ));
1637
1637
ret = 0 ;
1638
1638
} else {
1639
- if (errno == LDAP_SIZELIMIT_EXCEEDED ) {
1639
+ if (php_ldap_errno == LDAP_SIZELIMIT_EXCEEDED ) {
1640
1640
php_error_docref (NULL , E_WARNING , "Partial search results returned: Sizelimit exceeded" );
1641
1641
}
1642
1642
#ifdef LDAP_ADMINLIMIT_EXCEEDED
1643
- else if (errno == LDAP_ADMINLIMIT_EXCEEDED ) {
1643
+ else if (php_ldap_errno == LDAP_ADMINLIMIT_EXCEEDED ) {
1644
1644
php_error_docref (NULL , E_WARNING , "Partial search results returned: Adminlimit exceeded" );
1645
1645
}
1646
1646
#endif
@@ -2892,7 +2892,7 @@ PHP_FUNCTION(ldap_compare)
2892
2892
size_t dn_len , attr_len , value_len ;
2893
2893
ldap_linkdata * ld ;
2894
2894
LDAPControl * * lserverctrls = NULL ;
2895
- int errno ;
2895
+ int php_ldap_errno ;
2896
2896
struct berval lvalue ;
2897
2897
2898
2898
if (zend_parse_parameters (ZEND_NUM_ARGS (), "rsss|a" , & link , & dn , & dn_len , & attr , & attr_len , & value , & value_len , & serverctrls ) != SUCCESS ) {
@@ -2914,9 +2914,9 @@ PHP_FUNCTION(ldap_compare)
2914
2914
lvalue .bv_val = value ;
2915
2915
lvalue .bv_len = value_len ;
2916
2916
2917
- errno = ldap_compare_ext_s (ld -> link , dn , attr , & lvalue , lserverctrls , NULL );
2917
+ php_ldap_errno = ldap_compare_ext_s (ld -> link , dn , attr , & lvalue , lserverctrls , NULL );
2918
2918
2919
- switch (errno ) {
2919
+ switch (php_ldap_errno ) {
2920
2920
case LDAP_COMPARE_TRUE :
2921
2921
RETVAL_TRUE ;
2922
2922
break ;
@@ -2926,7 +2926,7 @@ PHP_FUNCTION(ldap_compare)
2926
2926
break ;
2927
2927
2928
2928
default :
2929
- php_error_docref (NULL , E_WARNING , "Compare: %s" , ldap_err2string (errno ));
2929
+ php_error_docref (NULL , E_WARNING , "Compare: %s" , ldap_err2string (php_ldap_errno ));
2930
2930
RETVAL_LONG (-1 );
2931
2931
}
2932
2932
0 commit comments