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

config.inc.php:

- Added configuration for courier authlib authentication flavors

function.inc.php:
- changed pa_crypt to make it handle courier authlib authentication flavors

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@560 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
Jan Roehrich
2009-02-03 17:50:13 +00:00
parent 0c97fb861a
commit e218b81af2
2 changed files with 29 additions and 1 deletions

View File

@@ -256,7 +256,7 @@ function check_domain ($domain)
flash_error("emailcheck_resolve_domain is enabled, but function (checkdnsrr) missing!");
}
}
return true;
}
@@ -1160,6 +1160,27 @@ function pacrypt ($pw, $pw_db="")
$l = db_row($res["result"]);
$password = $l[0];
}
if ($CONF['encrypt'] == 'authlib') {
$flavor = $CONF['authlib_default_flavor'];
$salt = ' ';
if(ereg('^{.*}', $pw_db)) {
// we have a flavor in the db -> use it instead of default flavor
$result = split('{|}', $pw_db, 3);
$flavor = $result[1];
$salt = substr($result[2], 0, 2);
}
if(stripos($flavor, 'md5raw') === 0) {
$password = '{' . $flavor . '}' . md5($pw);
} else if(stripos($flavor, 'md5') === 0) {
$password = '{' . $flavor . '}' . base64_encode(md5($pw, TRUE));
} else if(stripos($flavor, 'crypt') === 0) {
$password = '{' . $flavor . '}' . crypt($pw, $salt);
}
}
$password = escape_string ($password);
return $password;
}