mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-12 00:49:04 +01:00
Check for array or object on decrypt/unserialize. Return this even if empty.
This commit is contained in:
parent
93c063bd6c
commit
3cfb82e06d
@ -37,9 +37,9 @@
|
|||||||
|
|
||||||
function crypto($vars='')
|
function crypto($vars='')
|
||||||
{
|
{
|
||||||
if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'login' ||
|
if($GLOBALS['egw_info']['flags']['currentapp'] == 'login' ||
|
||||||
$GLOBALS['phpgw_info']['flags']['currentapp'] == 'logout' ||
|
$GLOBALS['egw_info']['flags']['currentapp'] == 'logout' ||
|
||||||
$GLOBALS['phpgw_info']['flags']['currentapp'] == 'home'
|
$GLOBALS['egw_info']['flags']['currentapp'] == 'home'
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->debug = False;
|
$this->debug = False;
|
||||||
@ -56,15 +56,15 @@
|
|||||||
$key = $vars[0];
|
$key = $vars[0];
|
||||||
$iv = $vars[1];
|
$iv = $vars[1];
|
||||||
|
|
||||||
if($GLOBALS['phpgw_info']['server']['mcrypt_enabled'] && extension_loaded('mcrypt'))
|
if($GLOBALS['egw_info']['server']['mcrypt_enabled'] && extension_loaded('mcrypt'))
|
||||||
{
|
{
|
||||||
if($GLOBALS['phpgw_info']['server']['mcrypt_algo'])
|
if($GLOBALS['egw_info']['server']['mcrypt_algo'])
|
||||||
{
|
{
|
||||||
$this->algo = $GLOBALS['phpgw_info']['server']['mcrypt_algo'];
|
$this->algo = $GLOBALS['egw_info']['server']['mcrypt_algo'];
|
||||||
}
|
}
|
||||||
if($GLOBALS['phpgw_info']['server']['mcrypt_mode'])
|
if($GLOBALS['egw_info']['server']['mcrypt_mode'])
|
||||||
{
|
{
|
||||||
$this->mode = $GLOBALS['phpgw_info']['server']['mcrypt_mode'];
|
$this->mode = $GLOBALS['egw_info']['server']['mcrypt_mode'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
@ -74,7 +74,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->enabled = True;
|
$this->enabled = True;
|
||||||
$this->mcrypt_version = $GLOBALS['phpgw_info']['server']['versions']['mcrypt'];
|
$this->mcrypt_version = $GLOBALS['egw_info']['server']['versions']['mcrypt'];
|
||||||
if($this->mcrypt_version == 'old')
|
if($this->mcrypt_version == 'old')
|
||||||
{
|
{
|
||||||
$this->td = False;
|
$this->td = False;
|
||||||
@ -155,7 +155,7 @@
|
|||||||
echo '<br>' . time() . ' crypto->encrypt() unencrypted data: ---->>>>' . $data . "\n";
|
echo '<br>' . time() . ' crypto->encrypt() unencrypted data: ---->>>>' . $data . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_array($data) || is_object($data))
|
if(@is_array($data) || @is_object($data))
|
||||||
{
|
{
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
@ -273,8 +273,10 @@
|
|||||||
$data = chop($data);
|
$data = chop($data);
|
||||||
|
|
||||||
$newdata = @unserialize($data);
|
$newdata = @unserialize($data);
|
||||||
if($newdata)
|
/* Check whether an array or object exists, even if empty. These should be the only ones originally serialized. */
|
||||||
|
if(@is_array($newdata) || @is_object($newdata))
|
||||||
{
|
{
|
||||||
|
/* array or object */
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
echo '<br>' . time() . ' crypto->decrypt() found serialized "' . gettype($newdata) . '". Unserializing...' . "\n";
|
echo '<br>' . time() . ' crypto->decrypt() found serialized "' . gettype($newdata) . '". Unserializing...' . "\n";
|
||||||
@ -284,6 +286,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Other types */
|
||||||
if($this->debug)
|
if($this->debug)
|
||||||
{
|
{
|
||||||
echo '<br>' . time() . ' crypto->decrypt() found UNserialized "' . gettype($data) . '". No unserialization...' . "\n";
|
echo '<br>' . time() . ' crypto->decrypt() found UNserialized "' . gettype($data) . '". No unserialization...' . "\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user