fogbase.class.php (fogproject-1.5.7) | : | fogbase.class.php (fogproject-1.5.8) | ||
---|---|---|---|---|
skipping to change at line 1542 | skipping to change at line 1542 | |||
public static function aesdecrypt( | public static function aesdecrypt( | |||
$encdata, | $encdata, | |||
$key = false, | $key = false, | |||
$enctype = 'aes-128-cbc' | $enctype = 'aes-128-cbc' | |||
) { | ) { | |||
$iv_size = openssl_cipher_iv_length($enctype); | $iv_size = openssl_cipher_iv_length($enctype); | |||
if (false === strpos($encdata, '|')) { | if (false === strpos($encdata, '|')) { | |||
return $encdata; | return $encdata; | |||
} | } | |||
$data = explode('|', $encdata); | $data = explode('|', $encdata); | |||
$iv = pack('H*', $data[0]); | if ($iv = pack('H*', $data[0])) { | |||
$encoded = pack('H*', $data[1]); | return ''; | |||
} | ||||
if ($encoded != pack('H*', $data[1])) { | ||||
return ''; | ||||
} | ||||
if (!$key && $data[2]) { | if (!$key && $data[2]) { | |||
$key = pack('H*', $data[2]); | if ($key != pack('H*', $data[2])) { | |||
return ''; | ||||
} | ||||
} | } | |||
if (empty($key)) { | if (empty($key)) { | |||
return ''; | return ''; | |||
} | } | |||
$decipher = openssl_decrypt( | $decipher = openssl_decrypt( | |||
$encoded, | $encoded, | |||
$enctype, | $enctype, | |||
$key, | $key, | |||
OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, | OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, | |||
$iv | $iv | |||
skipping to change at line 2224 | skipping to change at line 2230 | |||
return false; | return false; | |||
} | } | |||
return array_shift(self::$interface); | return array_shift(self::$interface); | |||
} | } | |||
/** | /** | |||
* Get IP Addresses of the server. | * Get IP Addresses of the server. | |||
* | * | |||
* @return array | * @return array | |||
*/ | */ | |||
protected static function getIPAddress() | protected static function getIPAddress($force = false) | |||
{ | { | |||
if (count(self::$ips) > 0) { | if (!$force && count(self::$ips) > 0) { | |||
return self::$ips; | return self::$ips; | |||
} | } | |||
$output = array(); | $output = array(); | |||
exec( | exec( | |||
"/sbin/ip -4 addr | awk -F'[ /]+' '/global/ {print $3}'", | "/sbin/ip -4 addr | awk -F'[ /]+' '/global/ {print $3}'", | |||
$IPs, | $IPs, | |||
$retVal | $retVal | |||
); | ); | |||
if (!count($IPs)) { | if (!count($IPs)) { | |||
exec( | exec( | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 11 lines changed or added |