[2.11.0rc1 PATCH] do_7zip: Handle completely encrypted archives

Thomas Jarosch thomas.jarosch at intra2net.com
Thu Apr 14 17:59:39 CEST 2016


7zip has two modes for encrypted archives:

- Visible file index, the contained file can be encrypted
- Complete encrypted archive including the file index

Signed-off-by: Thomas Jarosch <thomas.jarosch at intra2net.com>

--- amavisd	2016-04-14 17:06:52.576782623 +0200
+++ amavisd.7zip_new.pl	2016-04-14 17:35:37.013245243 +0200
@@ -24184,6 +24184,10 @@ sub do_7zip($$$;$) {
       elsif ($ln =~ /^Size = ([0-9]+)\z/s)   { $size = $1 }
       elsif ($ln =~ /^Attributes = (.*)\z/s) { $attr = $1 }
       elsif ($ln =~ /^Encrypted = \+\z/s)    { $enc = $any_encrypted = 1 }
+      elsif ($ln =~ /^ERROR: .* Can not open encrypted archive. Wrong password\?\z/s) {
+        do_log(5,'do_7zip: archive is encrypted');
+        $part->attributes_add('U','C');
+      }
     }
     defined $ln || $! == 0 || $! == EAGAIN  or die "Error reading (1): $!";
     do_log(-1,"unexpected(do_7zip_1): %s",$!) if !defined($ln) && $! == EAGAIN;



More information about the amavis-users mailing list