fixed wrong extraction of the extra_attr, eg. uid

This commit is contained in:
Ralf Becker 2010-07-21 14:39:07 +00:00
parent f7c1f243ae
commit 8ef7201027

View File

@ -272,7 +272,7 @@ class accounts_ldap
($old && in_array($objectclass,$old['objectclass']) || $data_utf8['account_email'] || $old['mail'])) ($old && in_array($objectclass,$old['objectclass']) || $data_utf8['account_email'] || $old['mail']))
{ {
$extra_attr = false; $extra_attr = false;
if (is_array($forward)) list($forward,$extra_attr) = each($forward); if (is_array($forward)) list($forward,$extra_attr) = $forward;
if ($data_utf8['account_email']) // setting an email if ($data_utf8['account_email']) // setting an email
{ {
if (!in_array($objectclass,$old ? $old['objectclass'] : $to_write['objectclass'])) if (!in_array($objectclass,$old ? $old['objectclass'] : $to_write['objectclass']))
@ -1093,14 +1093,13 @@ class accounts_ldap
if ($this->id2name($gid,'account_email') && ($objectclass = $this->id2name($gid,'mailAllowed'))) if ($this->id2name($gid,'account_email') && ($objectclass = $this->id2name($gid,'mailAllowed')))
{ {
$forward = $this->group_mail_classes[$objectclass]; $forward = $this->group_mail_classes[$objectclass];
if (is_array($forward)) list($forward,$extra_attr) = each($forward); if (is_array($forward)) list($forward,$extra_attr) = $forward;
if ($extra_attr && ($uid = $this->id2name($gid))) $to_write[$extra_attr] = $uid;
$to_write[$forward] = array(); $to_write[$forward] = array();
if ($extra_attr) $to_write[$extra_attr] = array();
foreach($members as $key => $member) foreach($members as $key => $member)
{ {
if (($email = $this->id2name($member,'account_email'))) $to_write[$forward][] = $email; if (($email = $this->id2name($member,'account_email'))) $to_write[$forward][] = $email;
if ($extra_attr && ($uid = $this->id2name($member,'account_lid'))) $to_write[$extra_attr] = $uid;
} }
} }
if (!ldap_modify($this->ds,'cn='.ldap::quote($cn).','.$this->group_context,$to_write)) if (!ldap_modify($this->ds,'cn='.ldap::quote($cn).','.$this->group_context,$to_write))