Hi,
the attached patch allows entries to be
added/removed/modified using a LDAP address book
(provided that the server handles it and that the
correct configuration of all related parameters have
been done).
The support is not 100% complete yet since some other
places need changes to take advantage of the read/write
capabilities.
The new functionality can be tested by editing
functions/addressbook.php and changing the "if (!
$onlylocal)" line to "if (true)".
Regards,
David
Extended LDAP functionality patch
Logged In: YES
user_id=225877
You could add ldap_read() search support to ldap_search()
method and use it in lookup(). You don't need
LDAP_SCOPE_SUBTREE or LDAP_SCOPE_ONELEVEL search for single
record lookup.
When you code, turn on display of errors and set error
reporting to E_ALL. Try triggering errors in all php ldap
extension function calls. If ldap_add or ldap_modify
function generates php errors, warnings or notices, they
must be suppressed.
in add() method $userdata is array. you are using object syntax.
return $this->set_error(sprintf(_("User \"%s\" already
exists"), $userdata->nickname));
> The new functionality can be tested by editing
> functions/addressbook.php and changing the "if (!
> $onlylocal)" line to "if (true)".
Or fix appropriate addressbook_init() calls. I think remote
backends are initialized in SquirrelMail 1.5.1+
src/addressbook.php. Patch is written for sm 1.5.1+ code.
Updated LDAP functionality patch
Logged In: YES
user_id=5960
Thanks for the feedback, I've attached a new version of the
patch with the following changes:
o Uses ldap_read in ldap_search when only one entry is
requested (i.e. when using lookup)
o Suppressed warnings from ldap_add and ldap_modify
o Test runs with E_ALL have been made
o Object syntax usage in add() fixed
o addressbook_init changed to consider writeable ldap
servers as "local" (similar to how it treats databases)
o Removes some debug echo() outputs which snuck in
Regards,
David
Logged In: YES
user_id=225877
Added to HEAD cvs functions/abook_ldap_server.php v.1.40
Had to initialize $data array in modify() and add() methods.
you can't set attributes to empty strings on some ldap
libraries (at least on OpenLDAP 2.2.23). used ldap_mod_del()
to remove attributes.
Thanks for your contribution.
Logged In: YES
user_id=508228
Originator: NO
If anyone wants to implement it, the other abook backends now have the ability to look up abook entries by fields other than the nickname/alias. The LDAP backend needs to have this implemented. See:
http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13186&view=rev
Thanks