Many more fixes and additions..
[licom.git] / lib / Person.pm
index 96a5977..c692e96 100644 (file)
@@ -179,11 +179,11 @@ sub create
                {
                        if (ref ($val) eq 'ARRAY')
                        {
-                               $entry->add ($field => [@$val]);
+                               $entry->add ($field => [@$val]) if (@$val);
                        }
                        elsif (!ref ($val))
                        {
-                               $entry->add ($field => [$val]);
+                               $entry->add ($field => [$val]) if ($val);
                        }
                        else
                        {
@@ -364,8 +364,11 @@ sub _update_dn
 
        $obj->{'cn'} = $cn;
 
+       print STDERR "This is _update_dn, trying to set dn=$dn";
+
        $entry->changetype ('modify');
        $entry->replace (sn => $sn, givenName => $gn, cn => $cn);
+       $entry->update ($Ldap);
        $entry->dn ($dn);
        $entry->update ($Ldap);
 }
@@ -528,8 +531,6 @@ sub get_user
                my ($t_cn) = $e->get_value ('cn', asref => 0);
                my ($t_id) = $e->get_value ('uid', asref => 0);
 
-               print STDERR "LDAP result: $t_cn, $t_id";
-
                if (!$id or $t_id)
                {
                        $cn = $t_cn;