]> granicus.if.org Git - php/commitdiff
MFH:- Fixed bug #42015 (ldap_rename() gets server error "DSA is unwilling to perform")
authorJani Taskinen <jani@php.net>
Tue, 17 Jul 2007 08:40:24 +0000 (08:40 +0000)
committerJani Taskinen <jani@php.net>
Tue, 17 Jul 2007 08:40:24 +0000 (08:40 +0000)
NEWS
ext/ldap/ldap.c

diff --git a/NEWS b/NEWS
index 326f41a72bdc8538e0c878e49dcbb601efec55ef..d291fadc9ed825da2106585e8d8c441100135f9f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -59,6 +59,8 @@ PHP                                                                        NEWS
 - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory 
   already exists). (Pierre)
 
+- Fixed bug #42015 (ldap_rename(): server error "DSA is unwilling to perform").
+  (bob at mroczka dot com, Jani)
 - Fixed bug #41964 (strtotime returns a timestamp for non-time string of
   pattern '(A|a) .+'). (Derick)
 - Fixed bug #41961 (Ensure search for hidden private methods does not stray
index bee17a52013ddb9f987147e27f521c3d779d4e9c..454f81a092b12e4ec6a4cc069192869e742ea968 100644 (file)
@@ -2076,6 +2076,7 @@ PHP_FUNCTION(ldap_rename)
        zval **link, **dn, **newrdn, **newparent, **deleteoldrdn;
        ldap_linkdata *ld;
        int rc;
+       char *newp = NULL;
        
        if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(5, &link, &dn, &newrdn, &newparent, &deleteoldrdn) == FAILURE) {
                WRONG_PARAM_COUNT;
@@ -2088,10 +2089,12 @@ PHP_FUNCTION(ldap_rename)
        convert_to_string_ex(newparent);
        convert_to_boolean_ex(deleteoldrdn);
 
+       newp = (Z_STRLEN_PP(newparent) > 0) ?  Z_STRVAL_PP(newparent) : NULL;
+
 #if (LDAP_API_VERSION > 2000) || HAVE_NSLDAP || HAVE_ORALDAP_10
-       rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), Z_STRVAL_PP(newparent), Z_BVAL_PP(deleteoldrdn), NULL, NULL);
+       rc = ldap_rename_s(ld->link, Z_STRVAL_PP(dn), Z_STRVAL_PP(newrdn), newp, Z_BVAL_PP(deleteoldrdn), NULL, NULL);
 #else
-       if (Z_STRLEN_PP(newparent) != 0) {
+       if (newp != NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN");
                RETURN_FALSE;
        }