added fix for MCrypt activation in a running LAM session

This commit is contained in:
Roland Gruber 2007-07-02 18:55:59 +00:00
parent acb418b82b
commit 606a0c42f3
1 changed files with 4 additions and 0 deletions

View File

@ -350,6 +350,8 @@ class Ldap{
function encrypt($data) { function encrypt($data) {
// use MCrypt if available // use MCrypt if available
if (function_exists('mcrypt_create_iv')) { if (function_exists('mcrypt_create_iv')) {
// MCrypt may have been enabled in a running session
if (!isset($_COOKIE["IV"]) || ($_COOKIE["IV"] == '')) return $data;
// read key and iv from cookie // read key and iv from cookie
$iv = base64_decode($_COOKIE["IV"]); $iv = base64_decode($_COOKIE["IV"]);
$key = base64_decode($_COOKIE["Key"]); $key = base64_decode($_COOKIE["Key"]);
@ -371,6 +373,8 @@ class Ldap{
function decrypt($data) { function decrypt($data) {
// use MCrypt if available // use MCrypt if available
if (function_exists('mcrypt_create_iv')) { if (function_exists('mcrypt_create_iv')) {
// MCrypt may have been enabled in a running session
if (!isset($_COOKIE["IV"]) || ($_COOKIE["IV"] == '')) return $data;
// read key and iv from cookie // read key and iv from cookie
$iv = base64_decode($_COOKIE["IV"]); $iv = base64_decode($_COOKIE["IV"]);
$key = base64_decode($_COOKIE["Key"]); $key = base64_decode($_COOKIE["Key"]);