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

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@525 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 16 years ago
parent 23afeac839
commit a1a81c9823

@ -88,6 +88,7 @@ $CONF['smtp_port'] = '25';
// 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

@ -1146,6 +1146,20 @@ function pacrypt ($pw, $pw_db="")
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;
}

Loading…
Cancel
Save