diff options
| author | foobar <sniper@php.net> | 2005-07-09 00:47:01 +0000 |
|---|---|---|
| committer | foobar <sniper@php.net> | 2005-07-09 00:47:01 +0000 |
| commit | ddac7fe3738d2ec57828f3f2c29488197a0c6aa9 (patch) | |
| tree | 23c57c1a7ea8b4030518e75f5c82ee3b7d67b6a5 | |
| parent | 6d7ea1ac5eca5d7febd57b65820d3d54494beef3 (diff) | |
| download | php-git-ddac7fe3738d2ec57828f3f2c29488197a0c6aa9.tar.gz | |
MFH
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | ext/ldap/ldap.c | 32 |
2 files changed, 22 insertions, 11 deletions
@@ -16,6 +16,7 @@ PHP NEWS - Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey) - Fixed memory corruption in stristr(). (Derick) - Fixed segfaults when CURL callback functions throw exception. (Tony) +- Fixed bug #33588 (LDAP: RootDSE query not possible). (Jani) - Fixed bug #33520 (crash if safe_mode is on and session.save_path is changed). (Dmitry) - Fixed bug #33491 (crash after extending MySQLi internal class). (Tony) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index a573a82622..2b4526af52 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -727,8 +727,12 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) if (Z_TYPE_PP(link) != IS_ARRAY) { convert_to_string_ex(filter); ldap_filter = Z_STRVAL_PP(filter); - convert_to_string_ex(base_dn); - ldap_base_dn = Z_STRVAL_PP(base_dn); + + /* If anything else than string is passed, ldap_base_dn = NULL */ + if (Z_TYPE_PP(base_dn) == IS_STRING) { + convert_to_string_ex(base_dn); + ldap_base_dn = Z_STRVAL_PP(base_dn); + } } break; @@ -764,8 +768,13 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) zend_hash_internal_pointer_reset(Z_ARRVAL_PP(base_dn)); } else { nbases = 0; /* this means string, not array */ - convert_to_string_ex(base_dn); - ldap_base_dn = Z_STRLEN_PP(base_dn) < 1 ? NULL : Z_STRVAL_PP(base_dn); + /* If anything else than string is passed, ldap_base_dn = NULL */ + if (Z_TYPE_PP(base_dn) == IS_STRING) { + convert_to_string_ex(base_dn); + ldap_base_dn = Z_STRVAL_PP(base_dn); + } else { + ldap_base_dn = NULL; + } } if (Z_TYPE_PP(filter) == IS_ARRAY) { @@ -803,8 +812,14 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) if (nbases != 0) { /* base_dn an array? */ zend_hash_get_current_data(Z_ARRVAL_PP(base_dn), (void **)&entry); zend_hash_move_forward(Z_ARRVAL_PP(base_dn)); - convert_to_string_ex(entry); - ldap_base_dn = Z_STRLEN_PP(entry) < 1 ? NULL : Z_STRVAL_PP(entry); + + /* If anything else than string is passed, ldap_base_dn = NULL */ + if (Z_TYPE_PP(entry) == IS_STRING) { + convert_to_string_ex(entry); + ldap_base_dn = Z_STRVAL_PP(entry); + } else { + ldap_base_dn = NULL; + } } if (nfilters != 0) { /* filter an array? */ zend_hash_get_current_data(Z_ARRVAL_PP(filter), (void **)&entry); @@ -845,11 +860,6 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) return; } - /* fix to make null base_dn's work */ - if (strlen(ldap_base_dn) < 1) { - ldap_base_dn = NULL; - } - ld = (ldap_linkdata *) zend_fetch_resource(link TSRMLS_CC, -1, "ldap link", NULL, 1, le_link); if (ld == NULL) { if (ldap_attrs != NULL) { |
