functions.inc.php: enable md5 password hashing (thanks to Levente Farkas (lfarkas) on the forum)

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@64 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent 91589bf6d6
commit fd3c471126

@ -964,37 +964,35 @@ function pacrypt ($pw, $pw_db="")
$password = "";
$salt = "";
if ($CONF['encrypt'] == 'md5crypt')
{
if ($CONF['encrypt'] == 'md5crypt') {
$split_salt = preg_split ('/\$/', $pw_db);
if (isset ($split_salt[2])) $salt = $split_salt[2];
if (isset ($split_salt[2])) {
$salt = $split_salt[2];
}
$password = md5crypt ($pw, $salt);
}
if ($CONF['encrypt'] == 'system')
{
if (ereg ("\$1\$", $pw_db))
{
if($CONF['encrypt'] == 'md5') {
$password = md5($pw);
}
if ($CONF['encrypt'] == 'system') {
if (ereg ("\$1\$", $pw_db)) {
$split_salt = preg_split ('/\$/', $pw_db);
$salt = $split_salt[2];
}
else
{
if (strlen($pw_db) == 0)
{
else {
if (strlen($pw_db) == 0) {
$salt = substr (md5 (mt_rand ()), 0, 2);
}
else
{
else {
$salt = substr ($pw_db, 0, 2);
}
}
$password = crypt ($pw, $salt);
}
if ($CONF['encrypt'] == 'cleartext')
{
if ($CONF['encrypt'] == 'cleartext') {
$password = $pw;
}
$password = escape_string ($password);
@ -1744,8 +1742,8 @@ function gen_show_status ($show_alias)
$stat_string .= "; ";
}
// $stat_string .= "<span style='background-color:green'> &nbsp; </span> &nbsp;" .
// "<span style='background-color:blue'> &nbsp; </span> &nbsp;";
// $stat_string .= "<span style='background-color:green'> &nbsp; </span> &nbsp;" .
// "<span style='background-color:blue'> &nbsp; </span> &nbsp;";
return $stat_string;
}
@ -1758,4 +1756,3 @@ $table_log = table_by_key ('log');
$table_mailbox = table_by_key ('mailbox');
$table_vacation = table_by_key ('vacation');
/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
?>

Loading…
Cancel
Save