[horde] findUserDN for LDAP for changing password.

ANANT S ATHAVALE asa at isac.gov.in
Wed Nov 20 09:13:47 UTC 2013


Dear List,

How do I introduce the following function in Passwd 5.0.1 to get the userDN
and let users to change their LDAP password? We are about to release HGWE
5.1.3 to users and facing problem w.r.t. changing password.  Please share
your code, if you have implemented some other way.

public function userdn($authid)
    {
        $ldapServer = 'localhost';
        $ldapPort = '389';
        $searchBase = 'dc=xxx';

        $ldapwithdomain = explode("@", $authid);
        $ldapuser = $ldapwithdomain[0];

        $ds = @ldap_connect($ldapServer, $ldapPort);
        $searchResult = @ldap_search($ds, $searchBase, 'uid=' .
$ldapuser );
        $information = @ldap_get_entries($ds, $searchResult);

        ldap_close($ds);

        if ($information === false || $information['count'] == 0) {
            return '';
        } else {
            return $information[0]['dn'];
        }
    }
-- 
           Regards
            Anant
------------------------------------------------------------------------------
Confidentiality Notice: This e-mail message, including any attachments, is for
the sole use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message.
------------------------------------------------------------------------------



More information about the horde mailing list