From:             bruce dot bahlmann at lsiowa dot org
Operating system: Windows Vista Business
PHP version:      5.2.12
PHP Bug Type:     LDAP related
Bug description:  Problems ldap_add when CN includes forward slash (/)

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

-- 
Edit bug report at http://bugs.php.net/?id=51019&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51019&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51019&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51019&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51019&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51019&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51019&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51019&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51019&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51019&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51019&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51019&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51019&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51019&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51019&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51019&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51019&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51019&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51019&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51019&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51019&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51019&r=mysqlcfg

Reply via email to