From 0b313506076ecbc422ebb0b5f7973b90e07b633d Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Tue, 17 Jul 2007 08:40:24 +0000 Subject: [PATCH] MFH:- Fixed bug #42015 (ldap_rename() gets server error "DSA is unwilling to perform") --- NEWS | 2 ++ ext/ldap/ldap.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 326f41a72b..d291fadc9e 100644 --- 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 diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index bee17a5201..454f81a092 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -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; } -- 2.50.1