Commit fb162242 authored by Florian Vessaz's avatar Florian Vessaz

Correct syntax in GnuGeneration::Member

parent c871d2d2
......@@ -193,7 +193,7 @@ sub create {
my $ldap = _connect_ldap();
_bind_admin($ldap);
my $home = '/home/' . $username;
my $home = '/home/' . $args{username};
my $id = _next_uid();
my $userdn = 'cn=' . escape_dn_value($args{cn})
......@@ -230,20 +230,20 @@ sub create {
# Create the user entry
my $mesg = $ldap->add($userdn, attrs => \@userattrs);
if ($res->code) {
warn "Failed to user entry: ", $res->error;
if ($mesg->code) {
warn "Failed to user entry: ", $mesg->error;
return;
}
# Synchronize concurrent user creation
$id = _fixup_new_user_id($userdn);
$id = _fixup_new_user_id($ldap, $userdn);
# Create the group entry
$mesg = $ldap->add($groupdn, attrs => \@groupattrs);
if ($res->code) {
warn "Failed to add private group entry: ", $res->error;
if ($mesg->code) {
warn "Failed to add private group entry: ", $mesg->error;
$ldap->delete($userdn);
warn "User entry was deleted due to previous errors."
warn "User entry was deleted due to previous errors.";
return;
}
......@@ -283,7 +283,7 @@ sub create {
# If not, update the entry with an unique uidNumber.
# Returns the uidNumber of the entry.
sub _fixup_new_user_id {
my $dn = shift;
my ($ldap, $dn) = @_;
my $mesg = $ldap->search(base => $USERS_BASE,
base => $dn,
......@@ -696,9 +696,9 @@ sub _next_uid {
}
# Return the first unused uid
my $uid = $FIRS_UID;
$uid++ while (defined $uids{$uid}) {
return $uid_last;
my $uid = $FIRST_UID;
$uid++ while (defined $uids{$uid});
return $uid;
}
1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment