[imp] Using IMP w/LDAP

German Poo Caaman~o gpoo@ubiobio.cl
Sat, 10 Feb 2001 10:59:19 -0300


Chuck Hagenbuch wrote:
> 
> Quoting Rob Tanner <rtanner@cheshire.onlinemac.com>:
> 
> > My users are accustomed to having address expansion features similar to
> > the address expansion for addresses in the Contacts list, except that
> > rather than a rather than a private addressbook, they access network
> > addressbooks, including both personal books and a complete campus
> > addressbook.  Currently that is being done through IMSP which neither
> > PHP4 nor IMP support.  Is there anyway I can enable that feature with
> > LDAP (which is where all that stuff is ultimately stored anyway).  I
> > know that IMP can access LDAP, but my concern is how to enable address
> > expansion.
> 
> I'm assuming you want to do this with IMP 2.2.x? There's currently no way; if
> you modify the imp_get_addresses() function to get a dump from your ldap
> server, though, you could make it work.

I added the following code to imp/lib/db.mysql that works:

function imp_get_fullname ($user, $server) {
        global $_imp_fullname, $default;

        if (isset($_imp_fullname)) return $_imp_fullname;

	/* check the name on LDAP server */
        if(isset($default->ldap_server)) {
                $ldapconnect = ldap_connect($default->ldap_server);
                if($ldapconnect) {
                        $ldapbind = ldap_bind($ldapconnect);
                        $ldapsearch =
ldap_search($ldapconnect,$default->ldap_dn,                        $values =
ldap_get_entries($ldapconnect,$ldapsearch);
                        $_imp_fullname =
$values[0][$default->ldap_user_fullname_                } else {
                        $_imp_fullname = false;
                }
        }

/* the rest of the code ( imp_get_addresses() ) */


-- 
German Poo Caaman~o
mailto:gpoo@ubiobio.cl
http://www.ubiobio.cl/~gpoo/chilelindo.html
"La historia no se lee, se escribe"