Mailing List Archive

LDAP Sync
Hey,

I did a fresh install of Davical 0.9.9.5 today but the LDAP sync is not working. It gives me the following error:

Exception [0] Principal::Create: Mandatory field "username" is not set.
At line 521 of /usr/share/davical/inc/Principal.php
================= Stack Trace ===================
/usr/share/davical/htdocs/tools.php[24] sync_LDAP()
/usr/share/davical/inc/drivers_ldap.php[544] sync_user_from_LDAP()
/usr/share/davical/inc/drivers_ldap.php[284] Principal->Create()
/usr/share/davical/inc/Principal.php[544] Principal->Write()

I think the problem is in Principal.php in Line 514:

$sql_params[':'.$k] = $field_values->{$k};

You only search for the values in field_values, but the username and other are found in the object itself ($this->{$k}). You might want to use something like:

$sql_params[':'.$k] = isset($field_values->{$k}) ? $field_values->{$k} : $this->{$k};

This works for me…

Greetz
_______________________________________________
DAViCal-dev mailing list
DAViCal-dev@lists.davical.org
http://lists.davical.org/listinfo/davical-dev
Re: LDAP Sync [ In reply to ]
On Wed, 2011-09-14 at 15:36 +0200, Florian Mutter wrote:
> Hey,
>
> I did a fresh install of Davical 0.9.9.5 today but the LDAP sync is not working. It gives me the following error:
>
> Exception [0] Principal::Create: Mandatory field "username" is not set.
> At line 521 of /usr/share/davical/inc/Principal.php
> ================= Stack Trace ===================
> /usr/share/davical/htdocs/tools.php[24] sync_LDAP()
> /usr/share/davical/inc/drivers_ldap.php[544] sync_user_from_LDAP()
> /usr/share/davical/inc/drivers_ldap.php[284] Principal->Create()
> /usr/share/davical/inc/Principal.php[544] Principal->Write()
>
> I think the problem is in Principal.php in Line 514:
>
> $sql_params[':'.$k] = $field_values->{$k};
>
> You only search for the values in field_values, but the username and other are found in the object itself ($this->{$k}). You might want to use something like:
>
> $sql_params[':'.$k] = isset($field_values->{$k}) ? $field_values->{$k} : $this->{$k};
>
> This works for me…

This was reported yesterday by someone else, and this is the fix I ended
up applying to it:

http://repo.or.cz/w/davical.git/commit/1a35a111e78034b797ba988df7422dc89769924f

I'd be interested to know if it's a good solution.

Cheers,
Andrew.

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
You will visit the Dung Pits of Glive soon.
------------------------------------------------------------------------