Package: apt-cacher
Version: 0.8.6
Followup-For: Bug #267680

In the spirit of some of the discussion that went on in #298458, here's a
(tested, working here) patch for this bug for the latest release 0.8.6. It 
allows the possibility of extending in the future to enable the list of allowed
files to be (or be supplemented by) a configuration file option. It's also
neater I think.

--- apt-cacher.pl.orig  2005-03-07 23:01:30.000000000 +0000
+++ apt-cacher.pl       2005-03-22 20:13:13.000000000 +0000
@@ -166,6 +166,16 @@
 
 my $path = $ENV{PATH_INFO};
   
+my @allowed_files = (
+       'Packages.gz',
+       'Packages.bz2',
+       'Release',
+       'Release.gpg',
+       'Sources.gz',
+       'Contents-.+\.gz',
+);
+my $allowed_files_regexp = '(' . join('|', @allowed_files) . ')$';
+
 # Include the library for the config file parser
 require '/usr/share/apt-cacher/apt-cacher-lib.pl';
 
@@ -369,7 +379,7 @@
        # Place the file in the cache with just its basename
        $new_filename = $filename;
        debug_message("new filename with just basename:
        $new_filename");
-} elsif ($filename =~ 
/(Packages.gz|Packages.bz2|Release|Release.gpg|Sources.gz)$/) {
+} elsif ($filename =~ /$allowed_files_regexp/) {
        # It's a Packages.gz or related file: make a long filename so we can 
cache these files without
        # the names colliding
        $new_filename = "$host$uri";
@@ -392,7 +402,7 @@
 #print STDERR "--- Looking for $cached_file\n";
 debug_message("looking for $cached_file");
 
-if ($filename =~ /(Packages.gz|Packages.bz2|Release|Release.gpg|Sources.gz)$/) 
{
+if ($filename =~ /$allowed_files_regexp/) {
        debug_message("filename complies: $filename");
        # Unlink the file if it is older than our configured time
        if (-f _) {

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.10
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)

Versions of packages apt-cacher depends on:
pn  apache | apache-ssl                      Not found.
ii  bzip2                         1.0.2-5    high-quality block-sorting file co
ii  perl                          5.8.4-8    Larry Wall's Practical Extraction 
ii  wget                          1.9.1-8    retrieves files from the web


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to