]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Milen Pankov <mail@milen.pankov.eu>
authorAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 1 Aug 2010 13:13:10 +0000 (07:13 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Sun, 1 Aug 2010 13:13:10 +0000 (07:13 -0600)
squid_db_auth support md5 encrypted passwords

--md5 option supporting unsalted MD5 password

helpers/basic_auth/DB/squid_db_auth.in

index b49782da96f4f3268118c9e2ed432d9b7c652835..615c47bc287a1bcf8458f14a866d9586e1d9578e 100644 (file)
@@ -22,6 +22,7 @@ my $db_usercol = "user";
 my $db_passwdcol = "password";
 my $db_cond = "enabled = 1";
 my $plaintext = 0;
+my $md5 = 0;
 my $persist = 0;
 my $isjoomla = 0;
 my $debug = 0;
@@ -72,6 +73,10 @@ If you use --joomla flag, this condition will be changed to block=0
 
 Database contains plain-text passwords
 
+=item   B<--md5>
+
+Database contains unsalted md5 passwords
+
 =item  B<--salt>
 
 Selects the correct salt to evaluate passwords
@@ -98,6 +103,7 @@ GetOptions(
        'passwdcol=s' => \$db_passwdcol,
        'cond=s' => \$db_cond,
        'plaintext' => \$plaintext,
+       'md5' => \$md5,
        'persist' => \$persist,
        'joomla' => \$isjoomla,
        'debug' => \$debug,
@@ -142,6 +148,7 @@ sub check_password($$)
     else{
         return 1 if defined $hashsalt && crypt($password, $hashsalt) eq $key;
         return 1 if crypt($password, $key) eq $key;
+        return 1 if $md5 && md5_hex($password) eq $key;
         return 1 if $plaintext && $password eq $key;
     }