1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2025-08-07 17:42:53 +03:00

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
This commit is contained in:
David Goodwin
2009-01-15 14:32:43 +00:00
parent 23afeac839
commit a1a81c9823
2 changed files with 15 additions and 0 deletions

View File

@@ -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;
}