]> granicus.if.org Git - php/commitdiff
- Fixed bug #33588 (LDAP: RootDSE query not possible).
authorfoobar <sniper@php.net>
Sat, 9 Jul 2005 00:46:45 +0000 (00:46 +0000)
committerfoobar <sniper@php.net>
Sat, 9 Jul 2005 00:46:45 +0000 (00:46 +0000)
NEWS
ext/ldap/ldap.c

diff --git a/NEWS b/NEWS
index 1acf2b619382fb9da75127b049f6b5c48a5b6811..23502ffaa40f0c7f07f74c1f05e5c1d0dfd1a4c8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ PHP                                                                        NEWS
   (Tony)
 - Fixed bug #33597 (setcookie() "expires" date format doesn't comply with RFC).
   (Tony)
+- Fixed bug #33588 (LDAP: RootDSE query not possible). (Jani)
 - Fixed bug #33578 (strtotime() doesn't understand "11 Oct" format). (Derick)
 - Fixed bug #33562 (date("") crashes). (Derick)
 - Fixed bug #33536 (strtotime() defaults to now even on non time string).
index dcef1afd1662ee61a7841a8be160d8e22ed3831e..a328d0e4f793d8ab6a257a36064346b7e0cdafa0 100644 (file)
@@ -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) {