[imp] LDAP and retrieval of name and mailaddress
ES
enno_schulz at gmx.net
Mon Jul 28 15:10:53 PDT 2003
I'll answer it myself ;-)
As I read thru the LDAP-Schema of the Domino-Server I realized, that
searching for uid= in ldap_search isn't a good search crteria because
the login name of the user for authenthication against IMAP will be
firstname lastname and NOT shortname, which is mapped to uid in domino..
For domino there has to be 'cn=' . $imp['user'] n ldap_search!
Works fine, that's it.
Greetings to all
Enno
ES wrote:
> Hi,
> I'm using Lotus Domino 5.06a as my mailserver, this supports LDAP.
> I'm using IMP 3.2 and HORDE 2.2 from the stable release.
> IMP is running separated from the Domino-mailserver an a SuSE Linux
> 8.2 Server.
>
> In imp/conf/conf.php
> $conf['hooks']['from'] = 'imp_expand_fromaddress';
> and
> $conf['hooks']['fullname'] = 'imp_set_fullname';
>
> The functions used:
> /* This is another example how to get the from address from an ldap
> server. */
> if (!function_exists('imp_expand_fromaddress')) {
> function imp_expand_fromaddress($imp) {
> // $ldapServer = 'ldap.example.com';
> $ldapServer = '192.168.1.163';
> $ldapPort = '389';
> $searchBase = 'ou=people,o=example.com';
>
> $ds = @ldap_connect($ldapServer, $ldapPort);
>
> $searchResult = @ldap_search($ds, $searchBase, 'uid=' .
> $imp['user']);
> $information = @ldap_get_entries($ds, $searchResult);
> $name = $information[0]['mail'][0];
>
> ldap_close($ds);
> print $name;
> return (empty($name) ? $imp['user'] : $name);
> }
> }
>
> and:
>
> /* This is another example how to get the user's full name from an
> ldap server.
> * In this example we look if a Spanish name exists and return this or the
> * standard 'cn' entry if not.
> */
> if (!function_exists('imp_set_fullname')) {
> function imp_set_fullname($imp) {
> $ldapServer = '192.168.1.163';
> // $ldapServer = 'ldap.example.com';
> $ldapPort = '389';
> $searchBase = 'ou=people,o=example.com';
>
> $ds = @ldap_connect($ldapServer, $ldapPort);
>
> $searchResult = @ldap_search($ds, $searchBase, 'uid=' .
> $imp['user']);
> $information = @ldap_get_entries($ds, $searchResult);
> if ($information[0]['cn;lang-es'][0] != '') {
> $name = $information[0]['cn;lang-es'][0];
> } else {
> $name = $information[0]['cn'][0];
> }
>
> ldap_close($ds);
>
> return (empty($name) ? $imp['user'] : $name);
> }
> }
>
> I've deleted all data in mysql prefs for all users an logged in again.
> Fullname and Mailaddress where not retrieved from my LDAP-server.
>
> Any hints how to get fullname and mailaddress with these
> customfunctions set?
> Greetings
> Enno
>
>
More information about the imp
mailing list