Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enable case-insensitivity in UserDB for unencrypted passwords.

This patch makes ignore_case function correctly on unencrypted passwords
even when mixed-case passwords exist in the UserDB table.

Currently, ignore_case only works if the stored passwords are lower case.
There are at least two ways for mixed-case passwords to make it into the
UserDB table:

 * If some user records were created with UserDB before ignore_case was set.
   (In this case, newer accounts get the expected behavior while older ones
   don't -- a recipe for "fun".)

 * If the password column is populated by more than just UserDB, such as
   through custom IC code or integration with other software.

Case-insensitivity is a nice convenience; both for users who tend not to
notice when caps lock has been toggled, and for help desk workers who field
their calls. The cost is that it reduces the effective number of ASCII
password characters by about one quarter. While it's true that it makes it
ever so slightly easier to crack passwords, other factors (e.g. password
length, use of dictionary words) far outweigh its importance.

One alternative to this patch would be to change all current and future
passwords in the UserDB table to lower case, then the existing ignore_case
would suffice to provide case-insensitive functionality. One downside of
that approach would be that it's irreversible, whereas this patch allows
switching back and forth by simply changing the ignore_case configuration.

This feature is enabled under the following example configuration:

UserDB    default    crypt         0
UserDB    default    ignore_case   1
  • Loading branch information...
commit 46ecfa0dbf49a134564650c01c7005804aa0a9bf 1 parent 8c64cc5
@danielbr danielbr authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/Vend/UserDB.pm
View
3  lib/Vend/UserDB.pm
@@ -1514,6 +1514,9 @@ sub login {
if ($self->{CRYPT}) {
$self->{PASSWORD} = $self->do_crypt($pw, $db_pass);
}
+ else {
+ $db_pass = lc $db_pass if $self->{OPTIONS}{ignore_case};
+ }
unless ($self->{PASSWORD} eq $db_pass) {
$self->log_either(errmsg("Denied attempted login by user '%s' with incorrect password",
$self->{USERNAME}));
Please sign in to comment.
Something went wrong with that request. Please try again.