]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Milen Pankov <mail@milen.pankov.eu>
authorHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 13 Jul 2010 20:23:02 +0000 (22:23 +0200)
committerHenrik Nordstrom <henrik@henriknordstrom.net>
Tue, 13 Jul 2010 20:23:02 +0000 (22:23 +0200)
squid_db_auth support md5 encrypted passwords

--md5 option supporting unsalted MD5 password

helpers/basic_auth/DB/basic_db_auth.pl.in

index 0af586d05f4da66453c3927b6a1620b09d1ae121..9a809e1264d513e0822d8764ddf9f229f2b35231 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;
     }