[sork] finduserDN

ANANT S ATHAVALE asa at isac.gov.in
Tue Nov 19 12:02:28 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.

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 sork mailing list