Jump to content

LDAP with Unicode problems


FliesLikeABrick

Recommended Posts

    $lr = ldap_search($ldap,'ou=People,dc=thd,dc=vg','uid='.trim($_POST['username']));
    if(ldap_count_entries($ldap,$lr) != 1) {
        die('Error resolving username'."\n".$_POST['username']."\n".ldap_count_entries($ldap,$lr) );
    }

 

When a search is done above with '†' as the $_POST['username'] value, the search completes successfully and returns 0 results.  (and the die() method call executes).

 

Is there something that I'm missing before executing this query?  Here is the code used to set up the connection $lr

 

    $ldap=ldap_connect('vm-ldap-server');
    
    if(!$ldap) {
        die('Could not connect to LDAP server.');
    }
    
    if (!ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3)) {
        die("Failed to set protocol version to 3");
    }
    if(!ldap_bind($ldap)) {
        die("Anonymous bind died");
    }    

 

The following query from the command line works fine:

root@vm-ldap-client:/var/www# ldapsearch -x -W -D "cn=admin,dc=thd,dc=vg" -h vm-ldap-server -b "ou=People,dc=thd,dc=vg" "uid=†"

 

When I browse the directory from phpldapadmin or do this search from within phpldapadmin, everything works fine and as expected.  I have been looking through the phpldapadmin source code and haven't yet found what they're doing different.

 

 

Link to comment
https://forums.phpfreaks.com/topic/149889-ldap-with-unicode-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.