|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-02-12 16:27 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 14:00:01 2025 UTC |
Description: ------------ There seems to be an issue with ldap_add when the cn and corresponding dn, include a forward slash (/). NOTE, ldap in this case is an active directory (AD) server. Ldap_add works fine when the cn doesn't include a forward slash, however, when the text does include it, I cannot get the ldap_add to work. I've tried escaping the characters (using backslash) with no success. I've also tried equivalent characters, but same result - the ldap add doesn't run. Interestingly, if one uses LDAP explorer, the entries which have forward slashes actually show a backward slash before the forward slash. If I use those tools, I can manually add ldap entries with a forward slash, just can't do it with php ldap library. I've attached the ldap_add calling script which provides a wrapper for creating a group on the ldap server. Reproduce code: --------------- --- From manual page: function.ldap-add#Parameters --- function ldapcreateGroup($hash, $dn) { // Maintain handle on LDAP connection to limit unnecessary ldapOpen if (!isset($GLOBALS["static_ad"])) { @ldapOpen(); } // Add these fields to ensure proper group be added $hash['objectClass'][0] = "top"; $hash['objectClass'][1] ="group"; $hash['groupType']=(int)'-2147483646'; $hash['objectcategory'] = 'CN=Group,CN=Schema,CN=Configuration,'.sdn; $hash["sAMAccountName"] = $hash['cn']; unset($hash['distinguishedname']); #print_r($hash); @ldap_add($GLOBALS["static_ad"],$dn,$hash); if(@ldap_error($GLOBALS["static_ad"]) == "Success") { return 1; } else { return 0; } } Expected result: ---------------- Short of not using forward slashes in the cn, which would take some time to change in all the various entries in AD, is there some possible way to get ldap_add to add these? Or, is there some special preparations required to perform on the cn field that would allow me to use conventional ldap_add to correctly insert this entry? Actual result: -------------- none