[imp] using hook to generate email address from uid in LDAP nis schema?

Alain Fauconnet alain at ait.ac.th
Thu Oct 20 03:21:37 PDT 2005


Hello list,

We're making the very first small steps to transitioning our old
NIS-based user directory to LDAP here. I'm kind of new to LDAP.
I've used the famous NIS transition scripts and nis.schema
to build a flat directory, a direct mapping of /etc/passwd and
/etc/shadow. Far from the final target, but a beginning. LDAP server
works. I've even written a script to sync NIS and LDAP data for the
transition period.

How does this relate to IMP? OK, here it is: I would like to offer
a shared directory to users based on LDAP, so that they can search
people based on real names. However the schema I'm
using (nis.schema and top->account->posixAccount->shadowAccount
structutal object class chain) only provides 'uid' (= the Unix
username) and 'cn' (= the GECOS field of /etc/passwd). No 'email'.

If I configure ./turba/sources.php with:

$cfgSources['localldap'] = array(
...
    'map' => array(
        '__key' => 'dn',
        '__uid' => 'uid', 
        'name' => 'cn',
        'email' => 'uid',  
    ),
    'search' => array(
        'name',
    ),

I get the expected result *except* that the returned e-mail
address is domainless (just <user>). It works because I've configured
IMP to add a default domain, but it's neither nice nor clean and it
will bother users (and break if we ever have multiple domains).

Is there any relatively clean way to attach a default domain to the
e-mail address when copying entries to the private address book?
Mhhh... even worse, I just noticed that if users click on the name
directly from the search result to compose a new mail, the To: comes
out as "user@". Probably won't fly.

I assume that if there's a way, that must be using the hooks, but I
don't know where to start (yes I know, I read hook.php a few times
already).

- is using hooks a feasible approach or not?
- if yes, what kind of hook should I start looking into?
- any other possible approach? (besides reworking my LDAP schema)

Thanks in advance for any tip,
Greets,
_Alain_


More information about the imp mailing list