Changeset 316


Ignore:
Timestamp:
04/25/12 17:07:22 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix embarrasing bug in login process; account status was ignored
and disabled accounts could still log in.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r314 r316  
    11491149## DNSDB::login()
    11501150# Takes a database handle, username and password
    1151 # Returns a userdata hash (UID, GID, username, fullname parts) if username exists
    1152 # and password matches the one on file
     1151# Returns a userdata hash (UID, GID, username, fullname parts) if username exists,
     1152# password matches the one on file, and account is not disabled
    11531153# Returns undef otherwise
    11541154sub login {
     
    11571157  my $pass = shift;
    11581158
    1159   my $userinfo = $dbh->selectrow_hashref("SELECT user_id,group_id,password,firstname,lastname FROM users WHERE username=?",
     1159  my $userinfo = $dbh->selectrow_hashref("SELECT user_id,group_id,password,firstname,lastname,status".
     1160        " FROM users WHERE username=?",
    11601161        undef, ($user) );
    11611162  return if !$userinfo;
     1163  return if !$userinfo->{status};
    11621164
    11631165  if ($userinfo->{password} =~ m|^\$1\$([A-Za-z0-9/.]+)\$|) {
Note: See TracChangeset for help on using the changeset viewer.