X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fpackages.inc;h=bb7a096e0d79aaf8f0d711a25e3867cca07b77d8;hb=aeef2bf17512535dcdc1b37dc41bee9d7e517da5;hp=aa6304228e0d354ee786860c5db4942b76678278;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/includes/packages.inc b/includes/packages.inc index aa630422..bb7a096e 100644 --- a/includes/packages.inc +++ b/includes/packages.inc @@ -11,6 +11,7 @@ ***********************************************************************/ include_once($path_to_root. "/includes/archive.inc"); include_once($path_to_root. "/includes/remote_url.inc"); +include_once($path_to_root. "/includes/hooks.inc"); define('PKG_CACHE_PATH', $path_to_root.'/modules/_cache'); define('PUBKEY_PATH', $path_to_root); @@ -186,7 +187,7 @@ function get_control_file($file, $index = false) { if ($index !== true) { if ($index === false) break; if (!isset($pkg[$index])) { - display_error(_("No key field '$index' in file '$file'")); + display_error(sprintf(_("No key field '%s' in file '%s'"), $index, $file)); return null; } $repo[$pkg[$index]] = $pkg; @@ -288,14 +289,19 @@ function get_pkg_or_list($type = null, $pkgname = null, $filter=array(), $outkey $data = file_get_contents($loclist); $cert = file_get_contents(PUBKEY_PATH.'/FA.pem'); if (!openssl_verify($data, $sig, $cert)) { - if ($refresh) - @unlink($loclist); - else { + if ($refresh) { + if (!@unlink($loclist)) + { + display_error(sprintf(_("Cannot delete outdated '%s' file."), $loclist)); + return null; + } + } else { display_error(_('Release file in repository is invalid, or public key is outdated.')); return null; } } else $refresh = false; + } while($refresh); $Release = get_control_file($loclist, 'Filename'); @@ -318,9 +324,12 @@ function get_pkg_or_list($type = null, $pkgname = null, $filter=array(), $outkey $refresh = false; } if ($parms['SHA1sum'] != sha1_file($locindex)) { // check subdir index consistency - if ($refresh) - @unlink($locindex); - else { + if ($refresh) { + if (!@unlink($locindex)) { + display_error(sprintf(_("Cannot delete outdated '%s' file."), $locindex)); + return null; + } + } else { display_error(sprintf( _("Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."), $fname)); return null;