Re: [squid-users] squid_db_auth to support md5 encrypted passwords patch

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 08 Jul 2010 22:21:25 +1200

Milen Pankov wrote:
> 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;

Looks okay. Please send as an attachment with subject line starting
"[PATCH]" to the squid-dev mailing list.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.5
Received on Thu Jul 08 2010 - 10:21:35 MDT

This archive was generated by hypermail 2.2.0 : Thu Jul 08 2010 - 12:00:04 MDT