"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/fog/fogbase.class.php" between
fogproject-1.5.8.tar.gz and fogproject-1.5.9.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.

fogbase.class.php  (fogproject-1.5.8):fogbase.class.php  (fogproject-1.5.9)
skipping to change at line 1386 skipping to change at line 1386
* @return void * @return void
*/ */
protected static function arrayChangeKey(array &$array, $old_key, $new_key) protected static function arrayChangeKey(array &$array, $old_key, $new_key)
{ {
if (!is_string($old_key)) { if (!is_string($old_key)) {
throw new Exception(_('Old key must be a string')); throw new Exception(_('Old key must be a string'));
} }
if (!is_string($new_key)) { if (!is_string($new_key)) {
throw new Exception(_('New key must be a string')); throw new Exception(_('New key must be a string'));
} }
$array[$old_key] = trim($array[$old_key]); $array[$old_key] = (
is_string($array[$old_key]) ?
trim($array[$old_key]) :
$array[$old_key]
);
if (!self::$service && is_string($array[$old_key])) { if (!self::$service && is_string($array[$old_key])) {
$item = mb_convert_encoding( $item = mb_convert_encoding(
$array[$old_key], $array[$old_key],
'utf-8' 'utf-8'
); );
$array[$new_key] = Initiator::sanitizeItems( $array[$new_key] = Initiator::sanitizeItems(
$item $item
); );
} else { } else {
$array[$new_key] = $array[$old_key]; $array[$new_key] = $array[$old_key];
skipping to change at line 1537 skipping to change at line 1541
* @param int $enctype the type of encryption to use * @param int $enctype the type of encryption to use
* @param int $mode the mode of encryption * @param int $mode the mode of encryption
* *
* @return string * @return string
*/ */
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) * 2;
if (false === strpos($encdata, '|')) { if (false === strpos($encdata, '|')) {
return $encdata; return $encdata;
} }
$data = explode('|', $encdata); $data = explode('|', $encdata);
if ($iv = pack('H*', $data[0])) { if (strlen($data[0]) != $iv_size || strlen($data[1]) != $iv_size) {
return ''; return $encdata;
}
if ($encoded != pack('H*', $data[1])) {
return '';
} }
if (!$key && $data[2]) { // add error handler to catch warnings we might get from pack() with non
if ($key != pack('H*', $data[2])) { -hex strings
return ''; set_error_handler(
function ($severity, $message, $file, $line) {
throw new ErrorException($message, $severity, $severity, $file,
$line);
} }
);
try {
$iv = pack('H*', $data[0]);
$encoded = pack('H*', $data[1]);
if (!$key && isset($data[2]) && strlen($data[2]) == $iv_size) {
$key = pack('H*', $data[2]);
}
} catch (Exception $e) {
return $encdata;
} }
restore_error_handler();
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 1692 skipping to change at line 1704
* @return array * @return array
*/ */
public static function parseMacList( public static function parseMacList(
$stringlist, $stringlist,
$image = false, $image = false,
$client = false $client = false
) { ) {
$MAClist = array(); $MAClist = array();
$MACs = $stringlist; $MACs = $stringlist;
$lowerAndTrim = function ($element) { $lowerAndTrim = function ($element) {
return filter_var(strtolower(trim($element)), FILTER_VALIDATE_MAC); return strtolower(trim($element));
}; };
if (!is_array($stringlist)) { if (!is_array($stringlist)) {
$MACs = array_map($lowerAndTrim, explode('|', $stringlist)); $MACs = array_map($lowerAndTrim, explode('|', $stringlist));
} else { } else {
$MACs = array_map($lowerAndTrim, $stringlist); $MACs = array_map($lowerAndTrim, $stringlist);
} }
$MACs = array_filter($MACs); $MACs = array_filter($MACs);
$MACs = array_unique($MACs); $MACs = array_unique($MACs);
$MACs = array_values($MACs); $MACs = array_values($MACs);
if (count($MACs) < 1) { if (count($MACs) < 1) {
skipping to change at line 2201 skipping to change at line 2213
* *
* @return string * @return string
*/ */
public static function getMasterInterface($ip_find) public static function getMasterInterface($ip_find)
{ {
if (count(self::$interface) > 0) { if (count(self::$interface) > 0) {
return self::$interface; return self::$interface;
} }
self::getIPAddress(); self::getIPAddress();
exec( exec(
"/sbin/ip route | grep '$ip_find' | awk -F'[ /]+' '/src/ {print $4}' ", "/sbin/ip route | grep '$ip_find' | awk -F'[ /]+' '/kernel.*src/ {pr int $4}'",
$Interfaces, $Interfaces,
$retVal $retVal
); );
$ip_find = trim($ip_find); $ip_find = trim($ip_find);
if (!$ip_find) { if (!$ip_find) {
return; return;
} }
self::$interface = array(); self::$interface = array();
$index = 0; $index = 0;
foreach ((array) self::$ips as &$ip) { foreach ((array) self::$ips as &$ip) {
 End of changes. 8 change blocks. 
12 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)