Commit 43de8238 authored by Leigh Stoller's avatar Leigh Stoller

Just noticed that the backend does not make the same unique uid checks

that the web interface does; must be sure to include archived users in
the backend newuser script for when the web interface no longer makes
those checks.
parent f3e7d857
......@@ -239,7 +239,7 @@ foreach my $key (keys(%{ $xmlparse->{'attribute'} })) {
#
if (exists($newuser_args{'uid'})) {
UserError("User already exists; pick another login name!")
if (User->Lookup($newuser_args{'uid'}));
if (User->LookupByUidAll($newuser_args{'uid'}));
UserError("Reserved user name; pick another login name!")
if (getpwnam($newuser_args{'uid'}));
......
......@@ -188,6 +188,22 @@ sub LookupByUid($$)
return User->Lookup($uid);
}
# Include archived users, as for checking a newuser account.
sub LookupByUidAll($$)
{
my ($class, $uid) = @_;
my $query_result =
DBQueryFatal("select uid_idx from users where uid='$uid'");
return undef
if (! $query_result || !$query_result->numrows);
my ($uid_idx) = $query_result->fetchrow_array();
return User->Lookup($uid_idx);
}
#
# Lookup user given the unix uid ($UID typically).
#
......
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