-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 24 Apr 2014, Michael Lazar wrote:

I am having difficulty preserving the original attachment.

sub filter{
if (lc($type) eq 'application/zip' ) {

action_add_entity($entity,-1);

my $cmd = 'zipc -silent -extract -directories FILTERINPUT extractf
-keypass=xxxxxxxx; zipc -silent -add FILTEROUTPUT ./extractf/*.*';

   action_external_filter($entity, $cmd);

my $name=Œclear.zip';
    my $fname=Œclear.zip';
    my $type='application/zip';
    action_defang($entity, $name, $fname, $type);

    #undocumented hack to preserve body
    pop(@Warnings);

}

Hmm, I would actually try this way:

1) in sub filter() detect encrypted files and spool them into $CWD/my_spool. Make sure, you use a different name per attachment of the message

2) in filter_end(), if there are spooled files:
my $e = action_add_part($entity, "text/plain", "-suggest",
  "Unencrypted attachments", "Unencrypted_attachments_".time());
$e->make_multipart("mixed");
foreach my $file (@files) {
        # decrypt $file
        my $new = MIME::Entity->build(...)
        $e->add_part($new);
}

David's advice will save you from the additional HD space needed in step 1).

- -- Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEVAwUBU1n9SlGgR0+MU/4GAQIMDQf8D8J8qVDcNi4KZN03pRZJNqLLJGQjC17s
SmWCBx3lJmDVvPZFtHCqGrL/Rsl2aOAESKduXvh0d/EUSMtQ7qBefMtzzRuItJE+
4wh3KKwhpH4Zk0Oo5WEDjYPuS+xYFTEmcIYmWGIiFOgW8aJYVpsEiONa+eeyCw0u
crAdtg/uC+Vet8bNSg9v0iFTmsBVtcmT4ypD+13jSoHI9MQu2j3SvNRDr4ri46Xe
NaQDXUTV/AtFAtgubvnLemRm+FSq+ORTtYhlWLYvbUANU6zUC8nCzKLx03MvqUHp
K+MNcbLsKVqRaVNq+AosIBLv1YpYsZHqPxxROVv8hpun+kiTbe/O1A==
=V/4i
-----END PGP SIGNATURE-----
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to