Oliver,

> i wonder if anyone has made a module to handle stuffit-archives
> (sit,sit-x) from Macintosh with amavis.
> There is a Linux commandline-unpacker freely available at stuffit.com.

Here is a patch to get you going.
I only tried it casually for the lack of interesting archives.

  Mark

-------------------
--- amavisd.orig        Wed Nov 30 14:03:27 2005
+++ amavisd     Fri Dec 16 19:42:25 2005
@@ -308,5 +308,5 @@
       $arc $bzip2 $lzop $lha $unarj $gzip $uncompress $unfreeze
       $unrar $zoo $pax $cpio $ar $rpm2cpio $cabextract $ripole $tnef
-      $gunzip $bunzip2 $unlzop
+      $gunzip $bunzip2 $unlzop $unstuff
     )],
   );
@@ -785,4 +785,5 @@
   [qr/^(\S+\s+)?tar archive\b/i       => 'tar'],
   [qr/^(\S+\s+)?cpio archive\b/i      => 'cpio'],
+  [qr/^StuffIt Archive\b/i            => 'sit'],
   [qr/^Debian binary package\b/i      => 'deb'],  # standard Unix archive (ar)
   [qr/^current ar archive\b/i         => 'a'],    # standard Unix archive (ar)
@@ -849,4 +850,5 @@
 sub Amavis::Unpackers::do_tnef($$);
 sub Amavis::Unpackers::do_tnef_ext($$$);
+sub Amavis::Unpackers::do_unstuff($$$);
 sub Amavis::Unpackers::do_executable($$@);
 
@@ -879,4 +881,5 @@
 *do_tnef_ext     = \&Amavis::Unpackers::do_tnef_ext;
 *do_tnef         = \&Amavis::Unpackers::do_tnef;
+*do_unstuff      = \&Amavis::Unpackers::do_unstuff;
 *do_executable   = \&Amavis::Unpackers::do_executable;
 sub new_RE { Amavis::Lookup::RE->new(@_) }
@@ -920,4 +923,5 @@
     ['tnef', \&Amavis::Unpackers::do_tnef_ext,   \$tnef],
     ['tnef', \&Amavis::Unpackers::do_tnef],
+    ['sit',  \&Amavis::Unpackers::do_unstuff,    \$unstuff],
     ['exe',  \&Amavis::Unpackers::do_executable, \$unrar,\$lha,\$unarj],
   );
@@ -14272,4 +14276,27 @@
   if ($eval_stat ne '') { chomp($eval_stat); die "do_pax_cpio: $eval_stat\n" }
   $name_clash ? 2 : 1;
+}
+
+# command line unpacker from stuffit.com for Linux
+# decodes Macintosh StuffIt archives and others
+sub do_unstuff($$$) {
+  my($part, $tempdir, $archiver) = @_;
+  my($archiver_name) = basename((split(' ',$archiver))[0]);
+  snmp_count("OpsDecBy\u${archiver_name}");
+  ll(4) && do_log(4,sprintf("Expanding archive %s, using %s",
+                            $part->base_name, $archiver_name));
+  mkdir("$tempdir/parts/unstuff", 0750)
+    or die "Can't mkdir $tempdir/parts/unstuff: $!";
+  my($proc_fh,$pid) = run_command(undef, "&1", $archiver, '-q',
+                               "-d=$tempdir/parts/unstuff", $part->full_name);
+  my($nbytes,$buff); my($output) = '';
+  while (($nbytes=$proc_fh->read($buff,4096)) > 0) { $output .= $buff }
+  defined $nbytes or die "Error reading: $!";
+  my($err); $proc_fh->close or $err = $!;
+  $?==0 or die (exit_status_str($?,$err).' '.$output);
+  my($b) = flatten_and_tidy_dir("$tempdir/parts/unstuff",
+                                "$tempdir/parts", $part);
+  consumed_bytes($b, 'do_unstuff');
+  1;
 }
 
------------


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to