From: bob at mroczka dot com Operating system: solaris 8 PHP version: 5.2.3 PHP Bug Type: LDAP related Bug description: ldap_rename gets server error "DSA is unwilling to perform"
Description: ------------ i encountered this error while attempting to use ldap_rename against an IBM tivoli directory server. if i used the command line ldapmodrn tool the same rename was successful. i ran a network trace for each rename and found that php was not properly sending a null in the 4th argument (newparent) to ldap_rename_s when a null or empty string is passed in the php web page for this argument. this was causing the ldap client library to send 2 additional hex bytes x'0800' at the end of the modrdn packet causing the server to return the unwilling error. the following 2 line patch fixes this problem and sends a proper null when requested. --- ext/ldap/ldap.c.orig 2006-06-15 13:33:07.000000000 -0500 +++ ext/ldap/ldap.c 2007-07-16 21:33:32.748612000 -0500 @@ -2114,7 +2114,8 @@ convert_to_boolean_ex(deleteoldrdn); #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); + char *newp = Z_STRLEN_PP(newparent) < 1 ? NULL : Z_STRVAL_PP(newparent); + 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) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "You are using old LDAP API, newparent must be the empty string, can only modify RDN"); -- Edit bug report at http://bugs.php.net/?id=42015&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42015&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42015&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42015&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42015&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42015&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42015&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42015&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42015&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42015&r=support Expected behavior: http://bugs.php.net/fix.php?id=42015&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42015&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42015&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42015&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42015&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42015&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42015&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42015&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42015&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42015&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42015&r=mysqlcfg