Applied. tor 2010-07-08 klockan 12:35 +0300 skrev Milen Pankov: > Hi, > > Recently I needed to use squid_db_auth against mysql database with md5 > encrypted passwords. > > I read a recent discussion on this list (Joomla DB authentication > support hits Squid!:)) that was regarding integration with joomla > database, but this wasn't working for me. > > Here's a patch that makes it possible to read md5 encrypted passwords > from the database with the --md5 option. > > *** helpers/basic_auth/DB/squid_db_auth.in 2010-05-30 > 09:21:12.000000000 -0400 > --- helpers/basic_auth/DB/squid_db_auth.in.milen 2010-07-08 > 08:17:21.000000000 -0400 > *************** > *** 22,27 **** > --- 22,28 ---- > 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,77 **** > --- 73,82 ---- > > Database contains plain-text passwords > > + =item B<--md5> > + > + Database contains md5 passwords > + > =item B<--salt> > > Selects the correct salt to evaluate passwords > *************** > *** 98,103 **** > --- 103,109 ---- > 'passwdcol=s' => \$db_passwdcol, > 'cond=s' => \$db_cond, > 'plaintext' => \$plaintext, > + 'md5' => \$md5, > 'persist' => \$persist, > 'joomla' => \$isjoomla, > 'debug' => \$debug, > *************** > *** 143,148 **** > --- 149,155 ---- > return 1 if defined $hashsalt && crypt($password, $hashsalt) > eq $key; > return 1 if crypt($password, $key) eq $key; > return 1 if $plaintext && $password eq $key; > + return 1 if $md5 && md5_hex($password) eq $key; > } > > return 0;
