Re: Ldap-Problems
Felipe Scarel <[email protected]> Fri, 4 Nov 2011 15:35:54 -0200
| Newsgroups | gmane.comp.horde.sork |
|---|---|
| Message-ID | <CALrgKg1H-dTH9qmi8SuOcLpPXfCewqi+LMFiZDjqy-s+v2mBxw@mail.gmail.com> |
Hey Hanns, On Fri, Nov 4, 2011 at 15:05, Hanns Mattes <[email protected]> wrote: > Hi, > > me again, > > Am 04.11.2011 15:45, schrieb Hanns Mattes: > > > [php, userdn, hooks and me] > > okay, got it: > > > <?php > > class Passwd_Hooks > > { > > public function userdn($authid) > > { > > // Example: Provide LDAP server with a userdn so that you do not > have > > // to perform anonymous binds. > > $zwischenschritt = explode("@", $authid); > > $hmldapdomain = $zwischenschritt[1]; > > return 'uid=' . $authid . ',ou=' . $hmldapdomain . > ',ou=virtualmail' . ',dc=hanns' . ',dc=de'; > > } > > } > > Looks a bit "hackish", but it's working. > > Still got the same issue, Felipe Scarel reported some weeks ago, but > this is no main problem for me in the moment. > > Thanks for the help. > > Regards Hanns Incidentally, I had to make my own hook script as well. I didn't post it on the original thread, but since it seems it somehow helped you, I'll post it here for future reference: class Passwd_Hooks { /** * Userdn hook. * * @param string $authid The authenticated username. * * @return string TODO */ public function userdn($authid) { $ldapServer = 'localhost'; $ldapPort = '389'; $searchBase = 'dc=unb,dc=br'; $ds = @ldap_connect($ldapServer, $ldapPort); $searchResult = @ldap_search($ds, $searchBase, 'uid=' . $authid); $information = @ldap_get_entries($ds, $searchResult); ldap_close($ds); if ($information === false || $information['count'] == 0) { return ''; } else { return $information[0]['dn']; } } } Cheers, fbscarel -- Sork mailing list - Join the hunt: http://horde.org/bounties/#sork Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected]