From c4728332b26b9401589691eeb430a08659c412c8 Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sat, 29 Oct 2011 22:34:01 +0200 Subject: [PATCH] Fixed problem in package repository communication. --- includes/packages.inc | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/includes/packages.inc b/includes/packages.inc index 6e97e7d..bb7a096 100644 --- a/includes/packages.inc +++ b/includes/packages.inc @@ -289,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'); @@ -319,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; -- 2.30.2