fix warning about use of regexp on undef string

This commit is contained in:
Jamie Cameron
2014-01-06 16:26:50 -08:00
parent a58de54bf1
commit 1614896156

View File

@@ -29,11 +29,11 @@ sub encrypt_md5
{
my ($passwd, $salt) = @_;
my $magic = '$1$';
if ($salt =~ /^\$1\$([^\$]+)/) {
if ($salt && $salt =~ /^\$1\$([^\$]+)/) {
# Extract actual salt from already encrypted password
$salt = $1;
}
if ($salt !~ /^[a-z0-9\/\.]{8}$/i) {
if ($salt && $salt !~ /^[a-z0-9\/\.]{8}$/i) {
# Non-MD5 salt
$salt = undef;
}