SF.net SVN: postfixadmin:[525] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2009-01-15 14:32:48
|
Revision: 525 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=525&view=rev Author: GingerDog Date: 2009-01-15 14:32:43 +0000 (Thu, 15 Jan 2009) Log Message: ----------- config.inc.php, functions.inc.php - add support for mysql_encrypt method for password encrpytion - useful for pam integration, apparently - see https://sourceforge.net/tracker/?func=detail&atid=937966&aid=1793352&group_id=191583 Modified Paths: -------------- trunk/config.inc.php trunk/functions.inc.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-01-15 12:27:55 UTC (rev 524) +++ trunk/config.inc.php 2009-01-15 14:32:43 UTC (rev 525) @@ -88,6 +88,7 @@ // md5 = md5 sum of the password // system = whatever you have set as your PHP system default // cleartext = clear text passwords (ouch!) +// mysql_encrypt = useful for PAM integration $CONF['encrypt'] = 'md5crypt'; // Minimum length required for passwords. Postfixadmin will not Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-01-15 12:27:55 UTC (rev 524) +++ trunk/functions.inc.php 2009-01-15 14:32:43 UTC (rev 525) @@ -1146,6 +1146,20 @@ if ($CONF['encrypt'] == 'cleartext') { $password = $pw; } + + // See https://sourceforge.net/tracker/?func=detail&atid=937966&aid=1793352&group_id=191583 + // this is apparently useful for pam_mysql etc. + if ($CONF['encrypt'] == 'mysql_encrypt') + { + if ($pw_db!="") { + $salt=substr($pw_db,0,2); + $res=db_query("SELECT ENCRYPT('".$pw."','".$salt."');"); + } else { + $res=db_query("SELECT ENCRYPT('".$pw."');"); + } + $l = db_row($res["result"]); + $password = $l[0]; + } $password = escape_string ($password); return $password; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |