I was by accident looking at the ldap_first_attribute() code and
realized that something was wrong. Turns out that it has been
broken for 6 months without anyone noticing! I've done a lot of
LDAP testing, but I've not been using ldap_first_attribute() and
ldap_next_attribute(). I know accidents easily happens, but I
wish people would test when they change things.

I think the patch below fixes it. Could we apply the same patch to
4.1.0? I don't think we can release 4.1.0 without these functions
working, and this fix shouldn't affect anything but those functions.

Stig

----- Forwarded message from Stig Venaas <[EMAIL PROTECTED]> -----

Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: <mailto:[EMAIL PROTECTED]>
list-unsubscribe: <mailto:[EMAIL PROTECTED]>
list-post: <mailto:[EMAIL PROTECTED]>
Delivered-To: mailing list [EMAIL PROTECTED]
From: "Stig Venaas" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Fri, 30 Nov 2001 23:37:44 -0000
Subject: [PHP-CVS] cvs: php4 /ext/ldap ldap.c  

venaas          Fri Nov 30 18:37:44 2001 EDT

  Modified files:              
    /php4/ext/ldap      ldap.c 
  Log:
  ldap_first_attribute and ldap_next_attribute has been completely broken
  for 6 months!! Fixed (I think), might be a memory leak there...
  
  
Index: php4/ext/ldap/ldap.c
diff -u php4/ext/ldap/ldap.c:1.107 php4/ext/ldap/ldap.c:1.108
--- php4/ext/ldap/ldap.c:1.107  Thu Nov 29 15:26:20 2001
+++ php4/ext/ldap/ldap.c        Fri Nov 30 18:37:43 2001
@@ -22,7 +22,7 @@
    +----------------------------------------------------------------------+
  */
  
-/* $Id: ldap.c,v 1.107 2001/11/29 20:26:20 venaas Exp $ */
+/* $Id: ldap.c,v 1.108 2001/11/30 23:37:43 venaas Exp $ */
 #define IS_EXT_MODULE
 
 #ifdef HAVE_CONFIG_H
@@ -232,6 +232,7 @@
        le_result = zend_register_list_destructors_ex(_free_ldap_result, NULL, "ldap 
result", module_number);
        le_link = zend_register_list_destructors_ex(_close_ldap_link, NULL, "ldap 
link", module_number);
        le_result_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap result 
entry", module_number);
+       le_ber_entry = zend_register_list_destructors_ex(NULL, NULL, "ldap ber entry", 
+module_number);
 
        Z_TYPE(ldap_module_entry) = type;
 
@@ -275,7 +276,7 @@
 
        php_info_print_table_start();
        php_info_print_table_row(2, "LDAP Support", "enabled" );
-       php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.107 2001/11/29 
20:26:20 venaas Exp $" );
+       php_info_print_table_row(2, "RCS Version", "$Id: ldap.c,v 1.108 2001/11/30 
+23:37:43 venaas Exp $" );
        php_info_print_table_row(2, "Total Links", maxl );
 
 #ifdef LDAP_API_VERSION
@@ -1001,7 +1002,7 @@
        if ((attribute = ldap_first_attribute(ld->link, ldap_result_entry, &ber)) == 
NULL) {
                RETURN_FALSE;
        } else {
-               ZEND_REGISTER_RESOURCE(return_value, ber, le_ber_entry);
+               ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry);
 
                RETVAL_STRING(attribute, 1);
 #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS
@@ -1032,7 +1033,7 @@
        if ((attribute = ldap_next_attribute(ld->link, ldap_result_entry, ber)) == 
NULL) {
                RETURN_FALSE;
        } else {
-               ZEND_REGISTER_RESOURCE(return_value, ber, le_ber_entry);
+               ZEND_REGISTER_RESOURCE(*berp, ber, le_ber_entry);
 
                RETVAL_STRING(attribute, 1);
 #if ( LDAP_API_VERSION > 2000 ) || HAVE_NSLDAP || WINDOWS



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

----- End forwarded message -----

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to