diff --git a/ACU/LDAP.pm b/ACU/LDAP.pm index d31296a..5b491e6 100644 --- a/ACU/LDAP.pm +++ b/ACU/LDAP.pm @@ -142,6 +142,11 @@ sub add_attribute($$$@) my $mod = 0; my $entry = get_dn($ldap, $dn, $what); + if (!$entry) { + log(WARN, "Trying to add attributes ($what) to an unexisting entry: $dn"); + log(TRACE, @_); + return undef; + } my @data = $entry->get_value($what); for my $value (@_) { diff --git a/process/ldap/update_group.pl b/process/ldap/update_group.pl index 753f831..fa13cb0 100644 --- a/process/ldap/update_group.pl +++ b/process/ldap/update_group.pl @@ -132,7 +132,6 @@ sub user_update($$) LDAP::update_attribute($ldap, $dn, "strongAuthKey", $args->{param}{strongAuthKey}) if ($args->{param}{strongAuthKey}); LDAP::update_attribute($ldap, $dn, "c", $args->{param}{c}) if ($args->{param}{c}); LDAP::update_attribute($ldap, $dn, "title", $args->{param}{title}) if ($args->{param}{title}); - LDAP::update_attribute($ldap, $dn, "intraRight", $args->{param}{intraRight}) if ($args->{param}{intraRight}); LDAP::update_attribute($ldap, $dn, "intraTheme", $args->{param}{intraTheme}) if ($args->{param}{intraTheme}); LDAP::update_attribute($ldap, $dn, "birthdate", $args->{param}{birthdate}) if ($args->{param}{birthdate}); } @@ -208,7 +207,7 @@ sub group_get_type($) return "memberUid"; } elsif ($type eq "rights") { - return "intraRights" ; + return "intraRight" ; } else { die ("Unknown type to add: ".$type); @@ -223,7 +222,7 @@ sub user_get_type($) # Extract data type if ($type eq "rights") { - return "intraRights" ; + return "intraRight" ; } elsif ($type eq "sshkeys") { return "sshPublicKey" ; @@ -242,7 +241,7 @@ sub process_group my ($given_args, $args) = @_; my $year = $args->{param}{year} // LDAP::get_year; - my $dn = "cn=".$args->{param}{cn}."ou=$year,ou=$ou,ou=groups,dc=acu,dc=epita,dc=fr"; + my $dn = "cn=".$args->{param}{cn}.",ou=$year,ou=$ou,ou=groups,dc=acu,dc=epita,dc=fr"; my $action = $args->{param}{action} // "update"; # Read action