AUTH_LOCKOUT
USER_PASSWORD_MIN_LENGTH
+ USER_PASSWORD_MAX_LENGTH
LOGIN_OPTIONAL
LOGIN_NORMAL
use constant AUTH_NO_SUCH_USER => 5;
use constant AUTH_LOCKOUT => 6;
-# The minimum length a password must have.
+# The minimum and maximum length a password will have.
# BMO uses 8 characters.
use constant USER_PASSWORD_MIN_LENGTH => 8;
+use constant USER_PASSWORD_MAX_LENGTH => 4096;
use constant LOGIN_OPTIONAL => 0;
use constant LOGIN_NORMAL => 1;
sub bz_crypt {
my ($password, $salt) = @_;
+ # We shorten the password to protect against system
+ # resource exhaustion attacks
+ $password = substr $password, 0, USER_PASSWORD_MAX_LENGTH;
+
my $algorithm;
if (!defined $salt) {