***********************************************************************/
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);
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;
$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');
$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;