mimefilter-1.7+nmu1/0000755000000000000000000000000011755141721011264 5ustar mimefilter-1.7+nmu1/NEWS0000644000000000000000000000120511755141721011761 0ustar MimeFilter NEWS -- history of user-visible changes. 12 Jan 2001. Copyright (C) 2000, 2001 by Davide Giovanni Maria Salvetti. See the file COPYING for copying conditions. Please send MimeFilter bug reports to mimefilter@packages.debian.org. Version 1.2 Version 1.1 * There's a new "smartlist" subdirectory with some relevant examples for the Smartlist mailing list processing software. * You may now use regexps to list allowed MIME types, and a special list of never to be allowed types has been added. See the configuration file for details. Version 1.0 * Initial Version. Local variables: mode: indented-text end: mimefilter-1.7+nmu1/smartlist/0000755000000000000000000000000011755141721013306 5ustar mimefilter-1.7+nmu1/smartlist/rc.local.s100000644000000000000000000000052011755141721015325 0ustar :0 * filter_mime ?? y { # Pass the mail trough MimeFilter :0 fw | mimefilter # Executed if MimeFilter died :0 e { :0 hfw | formail -A "X-Diagnostic: MIME filtering failed" HOST=continue_with_rc.request } # Trash empty messages (author's already been warned by MimeFilter) :0 Bh * < 1 /dev/null } RC_LOCAL_SUBMIT_10 mimefilter-1.7+nmu1/smartlist/rc.custom0000644000000000000000000000123011755141721015142 0ustar maintainer = salve@hal.linux.it filter_mime = yes # filter nasty MIME messages filter_mime_cc_maintainer = yes # also warns maintainer about them # [ a lot of necessary stuff deleted from this example file ] #RC_LOCAL_SUBMIT_00 = rc.local.s00 # Uncomment (and change) these to RC_LOCAL_SUBMIT_10 = rc.local.s10 # call up customised local scripts #RC_LOCAL_SUBMIT_20 = rc.local.s20 # at predefined points. #RC_LOCAL_REQUEST_00 = rc.local.r00 #RC_LOCAL_REQUEST_10 = rc.local.r10 #RC_LOCAL_REQUEST_20 = rc.local.r20 #RC_LOCAL_REQUEST_30 = rc.local.r30 RC_CUSTOM # clear this one from the environment # so that we include this file only # once mimefilter-1.7+nmu1/smartlist/README0000644000000000000000000000063411755141721014171 0ustar This directory contains examples of configuration files useful with the Smartlist mailing list processing software. * rc.local.s10: though it has been thoroughly tested, bear in mind that it's just an example: you may need different rules or a different rc.local.s* file. * rc.custom: this is _not_ a complete rc.custom, rather a set of variables you should set to let MimeFilter do its work. mimefilter-1.7+nmu1/TODO0000644000000000000000000000146411755141721011761 0ustar MimeFilter TODO --- list of things to be done. Everyone is welcome to help getting some or all of these things done! Please contact Davide G. M. Salvetti if you can contribute. - Add some sort of interface to external programs; the goal would be to leave them take care of selected unadmissible MIME parts, returning some admissible MIME part (which might be an equivalent admissible representation of the same data, or some text/plain pointer to a URI to the unadmissible MIME part). - Write a mimefilter.rc(5) man page for the configuration file. - Add an option to turn on debug mode. - Add regression tests. - Translate the program messages. - (MAYBE) Rewrite the configuration file (and its sourcing) in a more user friendly fashion. Local variables: mode: indented-text end: mimefilter-1.7+nmu1/debian/0000755000000000000000000000000011755141721012506 5ustar mimefilter-1.7+nmu1/debian/rules.in0000644000000000000000000000565611755141721014204 0ustar #include "variables" <:##############################################################################:>// <:# WARNING: The rules file AUTOMATICALLY REGENERATE itself from this very one #:>// <:# Read the GNU Make Manual if you don't understand Makefile Remaking! #:>// <:##############################################################################:>// #! /usr/bin/make -f # # BEWARE: The rules file is AUTOMATICALLY GENERATED from rules.in # # rules for the Debian <:=${PACKAGE}:> package. # $Id: rules.in,v 1.6 2002/02/07 23:27:53 salve Exp $ # <:=@COPYRIGHT:>// tmp := $(shell pwd)/debian/tmp/ SHELL := /bin/bash INSTDIR := install -m 755 -d INSTPROG := install -m 755 -s INSTDATA := install -m 644 INSTSCRIPT := install -m 755 DFILES := debian/README debian/conffiles debian/copyright \ debian/preinst debian/postinst debian/prerm debian/postrm # WARNING: debian/rules SHOULD NOT be in $(DFILES), for Debian policy # (it's CVS registered), lest it will be deleted by clean. # Beside, it's automatically remade by make debian/system.variables: /home/salve/Debian/Packages/system.variables $(INSTDATA) $< $@ debian/rules: debian/variables # Eperl is simply great: thanks, Ralf! % :: %.in eperl -P -o $@ $< build: $(DFILES) $(checkdir) $(MAKE) touch build clean: $(checkdir) -rm -rf build core $(tmp) debian/files* debian/substvars -rm -f $(DFILES) -$(MAKE) clean binary: binary-indep binary-arch binary-arch: checkroot build $(checkdir) binary-indep: checkroot build $(checkdir) -rm -rf $(tmp) # install package $(MAKE) prefix=$(tmp)/<:=${usr}:> mandir=$(tmp)/<:=${man}:>\ etcdir=$(tmp)/<:=${ETC}:> install gzip -9frv $(tmp)/<:=${man}:> # install Debian doc and examples $(INSTDIR) $(tmp)/<:=${doc}:> $(INSTDATA) <:=${DOCS}:> $(tmp)/<:=${doc}:> $(INSTDATA) debian/README $(tmp)/<:=${doc}:>/README.Debian $(INSTDATA) ChangeLog $(tmp)/<:=${doc}:> $(INSTDATA) debian/changelog $(tmp)/<:=${doc}:>/changelog.Debian $(INSTDIR) $(tmp)/<:=${examples}:> $(INSTDATA) <:=${EXAMPLES}:> $(tmp)/<:=${examples}:> gzip -9frv $(tmp)/<:=${doc}:> ln -sf ChangeLog.gz $(tmp)/<:=${doc}:>/changelog.gz $(INSTDATA) debian/copyright $(tmp)/<:=${doc}:> # install Debian control files $(INSTDIR) $(tmp)/<:=${debian}:> $(INSTDATA) debian/conffiles $(tmp)/<:=${debian}:> $(INSTSCRIPT) debian/{preinst,postinst,prerm,postrm} \ $(tmp)/<:=${debian}:> # standard stuff #-# cd $(tmp) && du -k * | grep -v 'DEBIAN' | sort -k 2 -o $(tmp)/<:=${debian}:>/du cd $(tmp) && md5sum \ $$(find ./ -path './DEBIAN' -prune -o -type f -printf "%P\n") \ | sort -k 2 -o $(tmp)/<:=${debian}:>/md5sums dpkg-gencontrol -isp chown -R root.root $(tmp) chmod -R go=rX $(tmp) dpkg --build $(tmp) .. checkdir = test -f debian/rules checkroot: $(checkdir) test root = "$$(whoami)" source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false .PHONY: binary binary-arch binary-indep clean checkroot <: # Local Variables: # mode: makefile # End: :>// mimefilter-1.7+nmu1/debian/preinst.in0000644000000000000000000000127611755141721014530 0ustar #include "variables" #!/bin/bash -e # # preinst configuration file for Debian <:=${PACKAGE}:> package. # $Id: preinst.in,v 1.2 2002/01/18 16:47:35 salve Exp $ # <:=@COPYRIGHT:>// set -o posix case "${1}" in (abort-upgrade|install|upgrade) <:# abort-upgrade ${2:newver} # (undo postrm upgrade ${2} effects):>// <:# install ${2:oldver} # (of, if there aren't conffiles from ${2}) # install # (we can add diversion here, for example):>// <:# upgrade ${2:oldver} # (old-prerm upgrade has been called):>// : ;; (*) echo >&2 "${0##*/}: Called with unknown argument \`${1}'." ;; esac exit 0 <: # Local Variables: # mode: shell-script # End: :>// mimefilter-1.7+nmu1/debian/system.variables0000644000000000000000000000335611755141721015733 0ustar <:# Copyright (C) 1999, 2000, 01, 02 by Davide Giovanni Maria Salvetti.:>// <:# $Id: system.variables,v 1.7 2002/09/27 13:52:44 salve Exp $:>// <:# package specific:>// <:$debian="/DEBIAN/":>// <:$ETC="/etc/":>// <:$etc="/etc/$PACKAGE/":>// <:$doc="/usr/share/doc/$PACKAGE/":>// <:$examples="/usr/share/doc/$PACKAGE/examples/":>// <:$html="$doc/HTML":>// <:$var="/var/lib/$PACKAGE/":>// <:# usr and friends:>// <:$usr="/usr/":>// <:$share="/usr/share/":>// <:$dict="/usr/share/dict/":>// <:$bin="/usr/bin/":>// <:$man="/usr/share/man/":>// <:$sbin="/usr/sbin/":>// <:# cron:>// <:$cron_d="/etc/cron.d/":>// <:$cron_daily="/etc/cron.daily/":>// <:$cron_weekly="/etc/cron.weekly/":>// <:$cron_monthly="/etc/cron.monthly/":>// <:# debconf:>// <:$CONFMODULE="/usr/share/debconf/confmodule":>// <:# docbase:>// <:$DINSTALL="test -x /usr/sbin/install-docs && install-docs --install":>// <:$DREMOVE="test -x /usr/sbin/install-docs && install-docs --remove":>// <:$docbase="/usr/share/doc-base/":>// <:# emacs:>// <:$ELCLOG="CompilationLog":>// <:$EINSTALL="/usr/lib/emacsen-common/emacs-package-install":>// <:$EREMOVE="/usr/lib/emacsen-common/emacs-package-remove":>// <:$SSEL="/etc/emacs/site-start.el":>// <:$sstartd="/etc/emacs/site-start.d/":>// <:$ecode="/usr/lib/emacsen-common/packages/":>// <:$lisp="/usr/share/emacs/site-lisp/$PACKAGE/":>// <:# info:>// <:$IINSTALL="install-info --section \"$INFOSEC\" \"$INFOSEC\"" . " --menuentry=\"$INFOMENU\"" . " --description=\"$INFODESC\"" . " --quiet":>// <:$IREMOVE="install-info --quiet --remove":>// <:$info="/usr/share/info/":>// <:# misc:>// <:$GPL="/usr/share/common-licenses/GPL":>// <:open(COPYRIGHT,'COPYRIGHT');@COPYRIGHT=;close(COPYRIGHT):>// <: # local variables: # mode: shell-script # end: :>// mimefilter-1.7+nmu1/debian/postrm.in0000644000000000000000000000217711755141721014371 0ustar #include "variables" #!/bin/bash -e # # postrm configuration file for Debian <:=${PACKAGE}:> package. # $Id: postrm.in,v 1.2 2002/01/18 16:47:35 salve Exp $ # <:=@COPYRIGHT:>// set -o posix case "${1}" in (abort-install|abort-upgrade|failed-upgrade|remove|upgrade) <:# abort-install ${2:oldver} # (if ${2} conffiles were there, or, if there aren't any) # abort-install # (undo preinst install effects):>// <:# abort-upgrade ${2:oldver} # (undo preinst upgrade effects):>// <:# failed-upgrade ${2:oldver} # (fix old postrm bugs):>// <:# remove # (dregistered files have been removed, clean up):>// <:# upgrade ${2:newver} # (old prerm upgrade and new preinst upgrade have been called, clean up):>// : ;; (disappear|purge) <:# disappear ${2:overwriter} # (dregistered files and conffiles have been overwritten, clean up):>// <:# purge # (dregistered files and conffiles have been purged, clean up):>// : ;; (*) echo >&2 "${0##*/}: Called with unknown argument \`${1}'." ;; esac exit 0 <: # Local Variables: # mode: shell-script # End: :>// mimefilter-1.7+nmu1/debian/control0000644000000000000000000000163011755141721014111 0ustar Source: mimefilter Section: mail Priority: optional Build-Depends-Indep: eperl, perl5 Maintainer: Davide G. M. Salvetti Standards-Version: 3.5.7 Package: mimefilter Architecture: all Depends: perl5, libmailtools-perl, libmime-tools-perl Suggests: smartlist Description: Strips some unwanted MIME parts out of a MIME message. This program may be useful as a filter on a mailing list. . It strips every unwanted MIME part from a MIME compliant message, warning by email the original author about this, and outputs a MIME compliant cleaned message, to be further processed by a mailing list software. . You may find it useful if you don't want certain attachments on your mailing lists, or if you want to allow just the text part from multipart/alternative messages, and so on. You can easily fine tune the list of allowed MIME types to suit your particular needs, using normal Perl regexps. mimefilter-1.7+nmu1/debian/changelog0000644000000000000000000000443611755141721014367 0ustar mimefilter (1.7+nmu1) unstable; urgency=low * Non-maintainer upload. * Update dependency for libmime-tools-perl. Change Depends from libmime-perl (transitional package) to libmime-tools-perl to allow removal of libmime-perl. Thanks to Jari Aalto for the patch. (Closes: #601480, #665049) -- Salvatore Bonaccorso Thu, 17 May 2012 11:24:26 +0200 mimefilter (1.7) unstable; urgency=low * control(Standards-Version): Upgraded to 3.5.7. * postinst(do_link): Removed. * prerm(undo_link): Removed. -- Davide G. M. Salvetti Fri, 27 Sep 2002 15:45:27 +0200 mimefilter (1.6) unstable; urgency=medium * conffile: New file. (Closes: #132814) * rules: Install conffile. -- Davide G. M. Salvetti Fri, 8 Feb 2002 00:20:50 +0100 mimefilter (1.5) unstable; urgency=low * COPYRIGHT: Updated. * control(Standards-Version): Updated to 3.5.6. (Depends): mailtools -> libmailtools-perl. (Closes: #113018) Build-Depends -> Build-Depends-Indep. * copyright: Updated. -- Davide G. M. Salvetti Fri, 18 Jan 2002 17:46:34 +0100 mimefilter (1.4) unstable; urgency=high * rules (build): Removed debian/rules from deps. (debian/rules): Removed debian/system.variables from deps. -- Davide G. M. Salvetti Wed, 16 May 2001 14:51:35 +0200 mimefilter (1.3) unstable; urgency=medium * control (Depends): libmime-perl >= 5.311-1. (Closes: #85007) * control (Build-Depends): added eperl. -- Davide G. M. Salvetti Tue, 6 Feb 2001 14:38:24 +0100 mimefilter (1.2) unstable; urgency=low * New upstream version. * control (Description): Wording improved. * variables ($EXAMPLES): added smartlist/rc.custom. -- Davide G. M. Salvetti Tue, 23 Jan 2001 14:58:50 +0100 mimefilter (1.1) unstable; urgency=low * New upstream version. * control (Build-Depends): added perl5. * rules (debian/rules): added. * rules (build): added debian/rules. * variables ($EXAMPLES): added smartlist/rc.local.s10. -- Davide G. M. Salvetti Fri, 19 Jan 2001 17:27:44 +0100 mimefilter (1.0) unstable; urgency=low * Initial version. -- Davide G. M. Salvetti Tue, 16 Jan 2001 17:44:08 +0100 mimefilter-1.7+nmu1/debian/COPYRIGHT0000644000000000000000000000157311755141721014007 0ustar # Copyright (C) 2000, 01, 02 by Davide Giovanni Maria Salvetti. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to: The Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # On Debian GNU/Linux System you can find a copy of the GNU General Public # License in "/usr/share/common-licenses/GPL". mimefilter-1.7+nmu1/debian/postinst.in0000644000000000000000000000201711755141721014721 0ustar #include "variables" #!/bin/bash -e # # postinst configuration file for Debian <:=${PACKAGE}:> package. # $Id: postinst.in,v 1.3 2002/09/27 13:04:51 salve Exp $ # <:=@COPYRIGHT:>// set -o posix case "${1}" in (abort-remove|abort-upgrade|configure) <:# abort-remove in-favour ${3:newpkg} ${4:newver} # (undo prerm remove in-favour ${3} ${4}):>// <:# abort-upgrade ${2:newver} # (undo prerm upgrade ${2}):>// <:# configure ${2:lastconfver} # (or, if there wasn't an old version at all) # configure ${2=""|""} # (or, if dpkg version is very old) # configure # (dregistered files and conffiles have been installed):>// : ;; (abort-deconfigure) <:# abort-deconfigure in-favour ${3:newpkg} ${4:newver} removing ${6:oldpkg} ${7:oldver} # (undo prerm deconfigure in-favour ${3} ${4} removing ${6} ${7}):>// : ;; (*) echo >&2 "${0##*/}: Called with unknown argument \`${1}'." ;; esac exit 0 <: # Local Variables: # mode: shell-script # End: :>// mimefilter-1.7+nmu1/debian/copyright.in0000644000000000000000000000214511755141721015050 0ustar #include "variables" This package was written by: Davide G. M. Salvetti on Fri, 12 Jan 2001 14:15:38 CET. The Debian version is the upstream version. COPYRIGHT ========= Copyright (C) 2000, 01, 02 by Davide Giovanni Maria Salvetti. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. On Debian GNU/Linux System you can find a copy of the GNU General Public License in "<:=${GPL}:>". <: # Local variables: # mode: text # fill-column: 78 # End: # LocalWords: CET GPL :>// mimefilter-1.7+nmu1/debian/README.in0000644000000000000000000000057111755141721013776 0ustar #include "variables" The Debian Package mimefilter ----------------------------- This is the Debian GNU/Linux version of the MimeFilter program, a script useful to strip unwanted MIME parts out of a message. Davide G. M. Salvetti , <:=$_=gmtime:>. <: # Local variables: # mode: text # fill-column: 78 # End: # LocalWords: mimefilter MimeFilter gmtime :>// mimefilter-1.7+nmu1/debian/.cvsignore0000644000000000000000000000010311755141721014500 0ustar README conffiles copyright files postinst postrm preinst prerm tmp mimefilter-1.7+nmu1/debian/rules0000755000000000000000000000707211755141721013574 0ustar #! /usr/bin/make -f # # BEWARE: The rules file is AUTOMATICALLY GENERATED from rules.in # # rules for the Debian mimefilter package. # $Id: rules,v 1.8 2002/02/07 23:27:53 salve Exp $ # # Copyright (C) 2000, 01, 02 by Davide Giovanni Maria Salvetti. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to: The Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # On Debian GNU/Linux System you can find a copy of the GNU General Public # License in "/usr/share/common-licenses/GPL". tmp := $(shell pwd)/debian/tmp/ SHELL := /bin/bash INSTDIR := install -m 755 -d INSTPROG := install -m 755 -s INSTDATA := install -m 644 INSTSCRIPT := install -m 755 DFILES := debian/README debian/conffiles debian/copyright \ debian/preinst debian/postinst debian/prerm debian/postrm # WARNING: debian/rules SHOULD NOT be in $(DFILES), for Debian policy # (it's CVS registered), lest it will be deleted by clean. # Beside, it's automatically remade by make debian/system.variables: /home/salve/Debian/Packages/system.variables $(INSTDATA) $< $@ debian/rules: debian/variables # Eperl is simply great: thanks, Ralf! % :: %.in eperl -P -o $@ $< build: $(DFILES) $(checkdir) $(MAKE) touch build clean: $(checkdir) -rm -rf build core $(tmp) debian/files* debian/substvars -rm -f $(DFILES) -$(MAKE) clean binary: binary-indep binary-arch binary-arch: checkroot build $(checkdir) binary-indep: checkroot build $(checkdir) -rm -rf $(tmp) # install package $(MAKE) prefix=$(tmp)//usr/ mandir=$(tmp)//usr/share/man/\ etcdir=$(tmp)//etc/ install gzip -9frv $(tmp)//usr/share/man/ # install Debian doc and examples $(INSTDIR) $(tmp)//usr/share/doc/mimefilter/ $(INSTDATA) NEWS README TODO $(tmp)//usr/share/doc/mimefilter/ $(INSTDATA) debian/README $(tmp)//usr/share/doc/mimefilter//README.Debian $(INSTDATA) ChangeLog $(tmp)//usr/share/doc/mimefilter/ $(INSTDATA) debian/changelog $(tmp)//usr/share/doc/mimefilter//changelog.Debian $(INSTDIR) $(tmp)//usr/share/doc/mimefilter/examples/ $(INSTDATA) config/mimefilter.rc config/it-mimefilter.rc smartlist/rc.local.s10 smartlist/rc.custom $(tmp)//usr/share/doc/mimefilter/examples/ gzip -9frv $(tmp)//usr/share/doc/mimefilter/ ln -sf ChangeLog.gz $(tmp)//usr/share/doc/mimefilter//changelog.gz $(INSTDATA) debian/copyright $(tmp)//usr/share/doc/mimefilter/ # install Debian control files $(INSTDIR) $(tmp)//DEBIAN/ $(INSTDATA) debian/conffiles $(tmp)//DEBIAN/ $(INSTSCRIPT) debian/{preinst,postinst,prerm,postrm} \ $(tmp)//DEBIAN/ # standard stuff #-# cd $(tmp) && du -k * | grep -v 'DEBIAN' | sort -k 2 -o $(tmp)//DEBIAN//du cd $(tmp) && md5sum \ $$(find ./ -path './DEBIAN' -prune -o -type f -printf "%P\n") \ | sort -k 2 -o $(tmp)//DEBIAN//md5sums dpkg-gencontrol -isp chown -R root.root $(tmp) chmod -R go=rX $(tmp) dpkg --build $(tmp) .. checkdir = test -f debian/rules checkroot: $(checkdir) test root = "$$(whoami)" source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false .PHONY: binary binary-arch binary-indep clean checkroot mimefilter-1.7+nmu1/debian/variables0000644000000000000000000000063611755141721014406 0ustar <:# Copyright (C) 1999, 2000, 01, 02 by Davide Giovanni Maria Salvetti.:>// <:# $Id: variables,v 1.8 2002/01/18 16:47:35 salve Exp $:>// <:$PACKAGE="mimefilter":>// <:# Documentation:>// <:$DOCS="NEWS README TODO":>// <:$EXAMPLES="config/mimefilter.rc config/it-mimefilter.rc" . " smartlist/rc.local.s10 smartlist/rc.custom":>// #include "system.variables" <: # Local variables: # mode: shell-script # end: :>// mimefilter-1.7+nmu1/debian/prerm.in0000644000000000000000000000143411755141721014165 0ustar #include "variables" #!/bin/bash -e # # prerm configuration file for Debian <:=${PACKAGE}:> package. # $Id: prerm.in,v 1.3 2002/09/27 13:05:11 salve Exp $ # <:=@COPYRIGHT:>// set -o posix case "${1}" in (failed-upgrade|deconfigure) <:# failed-upgrade ${2:oldver} # (fix old prerm from version ${2} bugs here):>// <:# deconfigure in-favour ${3:newpkg} ${4:newver} removing ${6:oldpkg} ${7:oldver}:>// <:# remove emacs startup file if present:>// : ;; (remove|upgrade) <:# remove # (or, in case of conflict with newpkg) # remove in-favour ${3:newpkg} ${4:newver}:>// <:# upgrade ${2:newver}:>// : ;; (*) echo >&2 "${0##*/}: Called with unknown argument \`${1}'." ;; esac exit 0 <: # Local Variables: # mode: shell-script # End: :>// mimefilter-1.7+nmu1/debian/conffiles.in0000644000000000000000000000010211755141721014777 0ustar #include "variables" <:=if($_="${ETC}/${PACKAGE}.rc")=~tr|/|/|s:> mimefilter-1.7+nmu1/.cvsignore0000644000000000000000000000002311755141721013257 0ustar build mimefilter.1 mimefilter-1.7+nmu1/COPYING0000644000000000000000000004312711755141721012326 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. mimefilter-1.7+nmu1/INSTALL0000644000000000000000000000242611755141721012321 0ustar Installation instructions. If you are a happy Debian GNU/Linux user, please ignore all of the following instructions except this very one: make sure the package `dpkg-dev' is installed on your system, then you can build and install this program using debian/rules. For example type: debian/rules binary to build a .deb package in the parent of the source directory (you have to be root for that to work); then you can install that with `dpkg --install' as usual. (Of course you can also find a precompiled binary version on ftp.debian.org and its mirrors.) If you are not a Debian GNU/Linux user, please read on. 0. Since this is a Perl program, you will obviously need perl: version 5 or later will do just fine. 1. To build the program type: make 2. To install the dictionary and its man page type: make install This will install the files under /usr/local; if you wish to install them in some other location (e.g. /usr) type something like this, instead: make prefix=/usr install Look at the top of the Makefile for further interesting variables. 3. You may wish to compress the installed man page, since it is not done by default. 4. You can clean the source directory, if you wish: make clean Local variables: mode: indented-text end: mimefilter-1.7+nmu1/Makefile0000644000000000000000000000330711755141721012727 0ustar # Makefile for the MimeFilter package # $Id: Makefile,v 1.2 2001/01/16 16:30:34 salve Exp $ # # Copyright (C) 2000, 2001 by Davide Giovanni Maria Salvetti. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to: The Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # On Debian GNU/Linux System you can find a copy of the GNU General Public # License in /usr/doc/copyright/GPL. etcdir = /etc/ prefix = /usr/local/ exec_prefix = $(prefix) bindir = $(exec_prefix)/bin mandir = $(prefix)/man all: man man: mimefilter.pl pod2man --section 1 --center "Debian GNU/Linux Manual" \ --release "Debian Project" mimefilter.pl > mimefilter.1 install: all test -d $(bindir) \ || install -o root -g root -m 755 -d $(bindir) install -o root -g root -m 755 mimefilter.pl $(bindir)/mimefilter test -d $(mandir)/man1 \ || install -o root -g root -m 755 -d $(mandir)/man1 install -o root -g root -m 644 mimefilter.1 $(mandir)/man1/ test -d $(etcdir) \ || install -o root -g root -m 755 -d $(etcdir) install -o root -g root -m 644 config/mimefilter.rc $(etcdir) clean: rm -f mimefilter.1 ### Local Variables: ### mode: makefile ### End: mimefilter-1.7+nmu1/mimefilter.pl0000644000000000000000000004136211755141721013764 0ustar #!/usr/bin/perl -w # MimeFilter --- Strip unwanted MIME attachments from a message # $Id: mimefilter.pl,v 1.6 2001/01/23 14:10:00 salve Exp $ # # Copyright (C) 2000, 2001 by Davide Giovanni Maria Salvetti # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to: The Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # On Debian GNU/Linux System you can find a copy of the GNU General Public # License in /usr/doc/copyright/GPL. ########################################################################## # This is a self-documenting script: try and run it with -h or --help to # # read its manpage. Of course, you may also use man if it is available. # ########################################################################## # FLAG: debug mode BEGIN { $::DEBUG = 0, $SIG{'__WARN__'} = sub { warn $_[0] if $::DEBUG } } # Read in config files: system wide first, then directory. my $read = 0; foreach my $config ("/etc/mimefilter.rc", "mimefilter.rc") { if (-r $config) { unless ($return = do $config) { warn "couldn't parse $file: $@" if $@; warn "couldn't do $file: $!" unless defined $return; warn "couldn't run $file" unless $return; } else { $read++; } } } die "sorry, no valid configuration file found." unless $read; # we want to END before dying use sigtrap qw(die normal-signals); use strict; # east to west, you do or die use Fatal qw(open close mkdir); use Mail::Address; use MIME::Parser; # we're good netizens use Text::Wrap qw(fill $columns); $columns = 72; while ($_ = shift) { next unless /^-h|--help$/; use Pod::Text; open(\*POD, '| pod2text'); select(POD); print while <::DATA>; close(\*POD); exit 0; } # how many accepted parts? my $ok = 0; # holds the MIME types of stripped parts my @cassate = (); # the following stack tell us if we are enclosed in a multipart/ or message/ # entity (@altstack <> ()), and what type is it: if it is message/ # $altstack[$#altstack] is undefined, if it is multipart/alternative # $altstack[$#altstack] is defined and false, otherwise it is non alternative # multipart/ and $altstack[$#altstack] is defined and true # stack tracing what entity we're enclosed in my @altstack = (); # recursive function: filters an entity sub filtra { my $entity = shift; # some times a multipart entity has just one part $entity->make_singlepart; # message entity are similar to multipart ones if ($entity->is_multipart or $entity->mime_type =~ '^message/') { if ($entity->mime_type =~ '^message/') { # tell apart message from multipart push @altstack, undef; } else { push @altstack, # tell apart message/alternative from other multiparts ($entity->mime_type =~ '^multipart/alternative')?0:1; } # this brand new entity will be filled with ok parts my $cleaned = new MIME::Entity; # give it the old one header $cleaned->head($entity->head); foreach ($entity->parts) { # this is a recursive filter my $part = &filtra($_); # add ok parts or their replacements; $cleaned->add_part($part) if $part; } # we may have ended with just one part $cleaned->make_singlepart; # WARNING: WE HAVE TO POP ANYWAY! unless (defined(pop @altstack) || $cleaned->parts) { # if we are here, we are in a (now) empty message # dropped message MIME type push @cassate, $cleaned->mime_type; my @messaggio = @::messaggio; # uso $cassate[$#cassate] e non $entity->mime_type s/_TIPOMIME_/$cassate[$#cassate]/ foreach @messaggio; @messaggio = fill("", "", @messaggio); return build MIME::Entity( Type => 'text/plain', Encoding => '-SUGGEST', Data => \@messaggio, Description => $::descrizione, Top => 0, ); } return $cleaned; } if (grep { $entity->mime_type =~ m,^$_$, } @::ammessi and not grep { $entity->mime_type =~ m,^$_$, } @::nonammessi) { if (grep !/^$/, $entity->bodyhandle->as_lines) { # it should have at least a non empty line $ok++; return $entity; } else { # otherwise we just ignore it return undef; } } # dropped entity MIME type push @cassate, $entity->mime_type; if ($altstack[$#altstack]) { # neither in a multipart/alternative, nor in a message/ my @sostituto = @::sostituto; # uso $cassate[$#cassate] e non $entity->mime_type s/_TIPOMIME_/$cassate[$#cassate]/ foreach @sostituto; @sostituto = fill("", "", @sostituto); push @sostituto, "\n"; return build MIME::Entity( Type => 'text/plain', Encoding => '-SUGGEST', Data => \@sostituto, Description => $::descrizione, Top => 0, ); } return undef; # in a multipart/alternative or in a (top level) message, either nested or # not, we simply drop it } # just a convenient abbreviation sub messaggio { my @messaggio = shift; my $ord = 'A'; push @messaggio, @::tagliato if @cassate; push (@messaggio, (" " . $ord++ . ". $_\n")) foreach @cassate; return @messaggio; } # rename a given Field to Old-Field sub rinomina { my $entity = shift; my $field = shift; return undef unless $entity->head->get($field); $entity->head->combine($field); $entity->head->add("Old-$field", $entity->head->get($field)); $entity->head->delete($field); return 1; } # The code here has mostly been stolen from Mail::Internet, as the good ol' # reply method doesn't seem to work anymore with woody MIME::Tools. # Oh, well... sub replica { my $original = shift; my $reply = new MIME::Entity; # Take care of the Subject. my $subject = $original->head->get('Subject') || ""; $subject = "Re: " . $subject if($subject =~ /\S+/ && $subject !~ /Re:/i); $reply->head->replace('Subject',$subject); # Locate who are we sending to. my $to = $original->head->get('Reply-To') || $original->head->get('From') || $original->head->get('Return-Path') || ""; # Mail::Address->parse returns a list of refs to a 2 element array. my $sender = (Mail::Address->parse($to))[0]; my $name = $sender->name; my $id = $sender->address; # Ensure we do have a name. unless(defined $name) { my $fr = $original->head->get('From'); $fr = (Mail::Address->parse($fr))[0] if(defined $fr); $name = $fr->name if(defined $fr); } $reply->replace('To', $id); # Take care of the references. my $refs = $original->head->get('References') || ""; my $mid = $original->head->get('Message-Id'); $refs .= " " . $mid if(defined $mid); $reply->replace('References',$refs); # Take care of the In-Reply-To field. my $date = $original->head->get('Date'); my $inreply = ""; if(defined $mid) { $inreply = $mid; $inreply .= " from " . $name if(defined $name); $inreply .= " on " . $date if(defined $date); } elsif(defined $name) { $inreply = $name . "'s message"; $inreply .= "of " . $date if(defined $date); } $reply->replace('In-Reply-To', $inreply); # We're done. return $reply; } # send a given message entity sub invia { my $entity = shift; my $to = shift; my $xdiagnostic = shift; if ($to) { # we're cc'ing, so to speak &rinomina($entity, 'Date'); &rinomina($entity, 'Return-Receipt-To'); &rinomina($entity, 'Read-Receipt-To'); &rinomina($entity, 'Acknowledge-To'); } $entity->head->add('X-Diagnostic', $xdiagnostic) if $xdiagnostic; ### Qui si potrebbe anche usare | $SENDMAIL $sendmailOPT $sendmailOPTp, ### prendendo tutto dall'ambiente, se si gira sotto Smartlist. my $sendmail = '| /usr/lib/sendmail -f' . $ENV{'listreq'} . ' -i ' . ($to?$to:'-t'); $::DEBUG || open(\*MAIL, $sendmail); $entity->print($::DEBUG?\*STDOUT:\*MAIL); $::DEBUG || close(\*MAIL); return 1 } # Existing unwritable files with the same name as the one the parser would like # to use would cause the parsing to fail. To guard against this, we use a # private directory and clean it before use (i.e., /tmp is not a good choice to # store attachments); we create it under /var/list/ (where archived # message already are stored). # the directory attachment will go into my $outdir = "tmp.mimefilter-$$"; # Since we work in a private space (under /var/list//), we assume it's # safe to wipe out $outdir: it may be had left here by a previous mimefilter # died before unlinking it, or it may be here because something else, we just # don't (and shouldn't) care. # $outdir had better not to exist system "rm -rf $outdir" if -e $outdir; # create our _private_ directory mkdir ($outdir, 0700) and my $rmdir = 1; # don't forget to clean it when we're done! END { rmdir $outdir or warn "rmdir $outdir: $!" if defined($rmdir); } my $parser = new MIME::Parser(output_dir => $outdir); # recursive parsing on 'message/' types $parser->extract_nested_messages('NEST'); # parse the message my $original = $parser->read(\*STDIN); unless ($original) { # parsing failed # top level MIME header my $header = $parser->last_head; my $reply = &replica($header); $reply->head->replace('From', $::from); $reply->head->add('X-Loop', $ENV{'listaddr'}); $reply->bodyhandle(new MIME::Body::InCore(\@::invalido)); $::DEBUG?$reply->print(\*STDERR):&invia($reply); # Smartlist will recover the original message for us die "MIME parsing failed"; } my $processed = &filtra($original); if ($processed && $ok) { # we have at least a good part to send $processed->print; if (@cassate) { my $reply = &replica($original); $reply->head->replace('From', $::from); $reply->head->add('X-Loop', $ENV{'listaddr'}); $reply->bodyhandle(new MIME::Body::InCore([&messaggio(@::mutilato)])); $::DEBUG?$reply->print(\*STDERR):&invia($reply); &invia($original, $ENV{'maintainer'}, "Message cleaned (@cassate)") if $ENV{'filter_mime_cc_maintainer'} =~ /y/i and $ENV{'maintainer'}; } } else { # we ended with an empty message my $reply = &replica($original); $reply->head->replace('From', $::from); $reply->head->add('X-Loop', $ENV{'listaddr'}); $reply->bodyhandle(new MIME::Body::InCore([&messaggio(@::vuoto)])); $::DEBUG?$reply->print(\*STDERR):&invia($reply); &invia($original, $ENV{'maintainer'}, "Empty message (@cassate)") if $ENV{'filter_mime_cc_maintainer'} =~ /y/i and $ENV{'maintainer'}; } # don't forget to clean up $outdir $original->purge; # make Procmail happy exit 0; __END__ =head1 NAME mimefilter - filter a MIME message stripping unwanted MIME parts =head1 SYNOPSIS mimefilter [OPTIONS] =head1 DESCRIPTION The B script accept on STDIN a MIME conforming message, and outputs on STDOUT a MIME conforming message. It strips every unwanted MIME part, warning by email the original author about this, and outputs a MIME compliant cleaned message, to be further processed by a mailing list software. You may find it useful if you don't want certain attachments on your mailing lists, or if you want to allow just the text part from multipart/alternative messages, and so on. You can easily fine tune the list of allowed MIME types to suit your particular needs, using normal Perl regexps. =head1 OPTIONS The B script may take just an option, in either its short or long form: =over 4 =item I<-h>, I<--help> Causes the script to print this very manpage and then succesfully exit. =back However, the B script won't bark at you if it discovers you supplied some other options as well, it'll just politely ignore them. =head1 ARGUMENTS The B script cheerfully takes an unlimited number of command line arguments and happily discards them all. =head1 FILES The B script will look for a system wide configuration file in F, and for a local, per working directory, configuration file in F<./mimefilter.rc>. The latter may be used to override any or all of the parameters defined by the former, thus allowing easily per mailing list customization. Several configuration parameters are provided, the most important being the list of admissible MIME types (where Perl regexps may be used), along with the list of never to be allowed ones (so that you may even specify, e.g., 'text/.*' in the admissible types list and 'text/html' in the never to be allowed one, to allow every text part but html ones). See the default configuration file for examples of use and further documentation. =head1 ENVIRONMENT The B script will look for the following environment variables: =over 4 =item I The name of the mailing list this message is intended for. Used as the return address of the warning issued to the orginal author if the message is not already clean. The Smartlist mailing list software will automatically pass this variable to B. =item I The address of the mailing list this message is inteded for. Used in the B field of the warning issued to the original author if the message is not already clean. The Smartlist mailing list software will automatically pass this variable to B. =item I The administrative (owner) address of the mailing list this message is inteded for. Used in the return address of the warning issued to the original author if the message is not already clean. The Smartlist mailing list software will automatically pass this variable to B. =item I The email address of the maintainer of the mailing list this message is inteded for. If it is defined, it is used to send the maintainer original carbon copies of messages that have been modified by this filter -- if I is affermative, of course. The Smartlist mailing list software will automatically pass this variable to B. =item I A boolean flag: if affermative (i.e., if it matches the /y/i Perl regular expression), the B script will send carbon copies of every cleaned (modified) message to the maintainer of the mailing list the message is intended for. Users of the Smartlist mailing list software may conveniently set this variable in rc.custom. =item I The B script itself will pay no attention to this variable, but if you have followed what the author suggests in L, you will need to define it affermative in rc.custom to activate this script: filter_mime = yes =back =head1 RETURN VALUE The B script returns 0 on success and a positive integer on errors. =head1 RECOMMENDED USE WITH THE SMARTLIST MAILING LIST SOFTWARE Put the following lines in rc.local.s[012]0 (the right one just depends on your specific needs, look at rc.submit for more info): :0 * filter_mime ?? y { # Pass the mail trough mimefilter :0 fw | mimefilter # Executed if mimefilter died :0 e { :0 hfw | formail -A "X-Diagnostic: MIME filtering failed" HOST=continue_with_rc.request } # Trash empty messages (author's already been warned by mimefilter) :0 Bh * < 1 /dev/null } Also remember to uncomment the appropriate line in rc.custom, to activate rc.local.s[012]0, and don't forget to customize the list of admissibile and never to be allowed MIME types in the configuration file(s). =head1 USING THIS SCRIPT WITH OTHER MAILING LIST SOFTWARE The author believes no particular arrangements are necessary to use this script with mailing list software other than Smartlist, altough one should remember that B expects to find at least the B, B, and B environment variables set. =head1 SEE ALSO L, L. =head1 BUGS Naaa... ;-) =head1 UNRESTRICTIONS This program is copylefted. Refer to the GNU General Public License for conditions of use. =head1 AUTHOR This program has been written and is actively maintained by S Salvetti, Esalve@linux.itE. =head1 HISTORY This script was originally aimed for use with a bunch of Smartlist served maling lists the author administers. He believes it can be successfully used with other mailing list softwares as well. =cut mimefilter-1.7+nmu1/config/0000755000000000000000000000000011755141721012531 5ustar mimefilter-1.7+nmu1/config/it-mimefilter.rc0000644000000000000000000001706511755141721015637 0ustar ### This is plain Perl code -*- mode: perl -*- ### $Id: it-mimefilter.rc,v 1.4 2001/01/23 14:10:00 salve Exp $ ### Dear user, ### ### this configuration is admittedly very hackish, and should be simplified. ### No doubt I will do it some day, but it's not on top of my todo list. ### Feel free to improve it, and send me your patches back! ### ### Thanks, DGMS. # Our address: this should ultimately be $ENV{'listreq'}. $::from = "Il gestore di $ENV{'list'} <$ENV{'listreq'}>"; # List of admissible MIME types -- beside "multipart/*" and "message/*", which # both act as containers (don't ever even think to list "multipart/something" # and/or "message/something" here: that would be a VERY BAD idea). # # Each item in the list may be a regexp. The regexps are applied anchored with # "^" and "$" added in front and back, so they should match the entire MIME # type token, not just some substring. # # Parts of a type listed here will be accepted; you probably want to have # at least '/text/plain', as a minimum. @::ammessi = ( 'text/plain', 'application/pgp-signature', # 'foo/.*', # '.*bar/foo', ); # List of inadmissibile MIME types. # # Each item in the list may be a regexp. The regexps are applied anchored with # "^" and "$" added in front and back, so they should match the entire MIME # type token, not just some substring. # # Parts of a type listed here will never be accepted, even if they match some # regexp listed in @::ammessi. # # This list may be used to easily complement @::ammessi, but you should bear in # mind that if a MIME type doesn't match some regexp in @::ammessi it won't be # accepted in any way, even if it isn't listed here. To be more clear, you do # not need to list here every conceivable MIME type that you don't want in your # messages, rather just the ones (if any) that would be otherwise accepted by # some item in your @::ammessi list. @::nonammessi = ( ); ### The following here documents get included in our messages if the conditions ### hereby listed happen. # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: MIME parsing of the original message has failed; this is very # very unlikely, but possible nevertheless. @::invalido = <<'EOF;'; Ciao, questa risposta automatica ti è stata inviata per avvertirti che il tuo messaggio NON È STATO INVIATO IN LISTA perché era tecnicamente non corretto (ovvero non rispondente allo standard MIME). Questo probabilmente significa che il programma che hai usato per mandarlo ha avuto qualche problema di funzionamento ed ha generato un messaggio tecnicamente non valido. Questo è un problema molto raro: se non sai cosa possa essere successo e questo problema persiste, se trovi qualcosa che non ti è chiaro o hai domande, scrivi pure al moderatore della lista, replicando a questo messaggio. EOF; # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: Filtering resulted in an empty message (i.e., it was empty, or it # has become empty after filtering away unaccettable MIME parts). @::vuoto = <<'EOF;'; Ciao, questa risposta automatica ti è stata inviata per avvertirti che il tuo messaggio NON È STATO INVIATO IN LISTA perché è risultato vuoto dopo aver eventualmente automaticamente eliminato le parti non testuali (puoi controllare in fondo a questo messaggio la lista delle parti eventualmente eliminate). Le cause più comuni di questo problema sono: * Il tuo messaggio era vuoto; in questo caso si sarà probabilmente trattato di un errore: non è possibile inviare messaggi vuoti in lista (un messaggio è vuoto se il suo corpo non contiene almeno una linea che non sia vuota). * Il tuo programma di posta elettronica è configurato in modo da inviare il messaggio in HTML (il linguaggio usato per la scrittura delle pagine Web); in questo caso devi cambiare le impostazioni opportune per fargli generare messaggi in formato testo. * Era tua intenzione inviare in lista un allegato, per esempio un programma, un documento o una immagine: non è possibile inviare materiale di questo tipo direttamente in lista. Se pensi di aver trovato qualcosa che possa interessare molte delle persone iscritte in lista, mettiti prima in contatto col moderatore: ti spiegherà come fare per metterlo a disposizione di tutti senza bisogno di inviarlo in lista. Se trovi qualcosa che non ti è chiaro o hai domande, scrivi pure al moderatore della lista, replicando a questo messaggio. EOF; # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: Some MIME parts have been stripped from the original message # before letting it through. @::mutilato = <<'EOF;'; Ciao, questa risposta automatica ti è stata inviata per avvertirti che anche se il tuo messaggio È STATO CORRETTAMENTE INVIATO IN LISTA, alcune delle parti non testuali che esso conteneva sono state tagliate prima che esso fosse inoltrato. NON HAI BISOGNO DI RIMANDARE IL MESSAGGIO. Le cause più comuni di questo problema sono: * Il tuo programma di posta elettronica è configurato in modo da inviare nello stesso messaggio due copie del testo che scrivi: una pura e semplice e una in formato HTML (il linguaggio usato per la scrittura delle pagine Web). Il programma "Microsoft Outlook Express", per esempio, è impostato così dalla fabbrica: se questo è il tuo caso, puoi eliminare il problema seguendo, nel menù, il percorso: strumenti -> opzioni -> invio -> "testo normale" e premendo quindi "applica" e "ok"; * Era tua intenzione inviare in lista un allegato, per esempio un programma, un documento o una immagine: non è possibile inviare materiale di questo tipo direttamente in lista. Se pensi di aver trovato qualcosa che possa interessare molte delle persone iscritte in lista, mettiti prima in contatto col moderatore: ti spiegherà come fare per metterlo a disposizione di tutti senza bisogno di inviarlo in lista. Se trovi qualcosa che non ti è chiaro o hai domande, scrivi pure al moderatore della lista, replicando a questo messaggio. EOF; # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: Added to the bottom of our message to the author if there has # been any stripped part. A complete list of every stripped part # will be added to this message. @::tagliato = <<'EOF;'; Ecco una lista dei tipi MIME di ciascuna parte tagliata: EOF; ### When we strip some part, we replace it with a short text explaining what ### was there. # MIME descriptions of part and message replacements: think of it as a title. $::descrizione = 'AVVERTIMENTO AUTOMATICO'; # This text replaces a stripped part (W: _TIPOMIME_ is a KEYWORD). @::sostituto = <<"EOF;"; Qui era presente una parte di messaggio non ammessa di tipo \'_TIPOMIME_\' che è stata automaticamente eliminata prima dell\'invio in lista. EOF; # This text replaces a stripped message (W: _TIPOMIME_ is a KEYWORD). # Embedded messages are discarded if, and only if, they are or become empty. # If the top most message entity becomes empty, nothing will get through. @::messaggio = <<"EOF;"; Qui era presente un messaggio annidato di tipo \'_TIPOMIME_\' che è stato automaticamente eliminato prima dell\'invio in lista perché privo di parti testuali. EOF; mimefilter-1.7+nmu1/config/mimefilter.rc0000644000000000000000000001421211755141721015214 0ustar ### This is plain Perl code -*- mode: perl -*- ### $Id: mimefilter.rc,v 1.3 2001/01/23 14:10:00 salve Exp $ ### Dear user, ### ### this configuration is admittedly very hackish, and should be simplified. ### No doubt I will do it some day, but it's not on top of my todo list. ### Feel free to improve it, and send me your patches back! ### ### Thanks, DGMS. # Our address: this should ultimately be $ENV{'listreq'}. $::from = "The administrator of $ENV{'list'} <$ENV{'listreq'}>"; # List of admissible MIME types -- beside "multipart/*" and "message/*", which # both act as containers (don't ever even think to list "multipart/something" # and/or "message/something" here: that would be a VERY BAD idea). # # Each item in the list may be a regexp. The regexps are applied anchored with # "^" and "$" added in front and back, so they should match the entire MIME # type token, not just some substring. # # Parts of a type listed here will be accepted; you probably want to have # at least '/text/plain', as a minimum. @::ammessi = ( 'text/plain', 'application/pgp-signature', # 'foo/.*', # '.*bar/foo', ); # List of inadmissibile MIME types. # # Each item in the list may be a regexp. The regexps are applied anchored with # "^" and "$" added in front and back, so they should match the entire MIME # type token, not just some substring. # # Parts of a type listed here will never be accepted, even if they match some # regexp listed in @::ammessi. # # This list may be used to easily complement @::ammessi, but you should bear in # mind that if a MIME type doesn't match some regexp in @::ammessi it won't be # accepted in any way, even if it isn't listed here. To be more clear, you do # not need to list here every conceivable MIME type that you don't want in your # messages, rather just the ones (if any) that would be otherwise accepted by # some item in your @::ammessi list. @::nonammessi = ( ); ### The following here documents get included in our messages if the conditions ### hereby listed happen. # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: MIME parsing of the original message has failed; this is very # very unlikely, but possible nevertheless. @::invalido = <<'EOF;'; Hi, this is an automatic reply. Your message to this list HAS NOT BEEN DELIVERED, because it was not a valid MIME message. This probably means that your MUA had some technical problem. If you find something unclear about this warning, feel free to reply to this message. EOF; # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: Filtering resulted in an empty message (i.e., it was empty, or it # has become empty after filtering away unaccettable MIME parts). @::vuoto = <<'EOF;'; Hi, this is an automatic reply. Your message to this list HAS NOT BEEN DELIVERED, because it was empty after being processed to strip (any) non textual part. Most often, this may be due to the following conditions: * You really sent an empty message: you may not send empty message to this list (a message is empty if its body contains no text). * Your MUA send messages in HTML only mode: you have to change your MUA configurations, we do not welcome HTML on this list. * You meant to send an attachment, such as a program, an image or a file: you may not send anything of this sort to this list. If you have something you think worthwile, please, get in contact with the moderator of this list (you may reply to this message, for example), and s/he will tell you what to do. If you find something unclear about this warning, feel free to reply to this message. EOF; # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: Some MIME parts have been stripped from the original message # before letting it through. @::mutilato = <<'EOF;'; Hi, this is an automatic reply. Your message to this list HAS BEEN REGULARLY DELIVERED. However, some non textual MIME parts have been stripped from it. YOU DO NOT NEED TO RESEND THIS MESSAGE. Most often, this may be due to the following conditions: * Your MUA send messages both in text and HTML mode: you have to select text only mode for your messages to this list. * You meant to send an attachment, such as a program, an image or a file: you may not send anything of this sort to this list. If you have something you think worthwile, please, get in contact with the moderator of this list (you may reply to this message, for example), and s/he will tell you what to do. If you find something unclear about this warning, feel free to reply to this message. EOF; # TO.......: Author of the original message, as seen from (in decreasing order # of priority) Reply-To, From or Return-Path. # CONDITION: Added to the bottom of our message to the author if there has # been any stripped part. A complete list of every stripped part # will be added to this message. @::tagliato = <<'EOF;'; This is a list of the MIME types of every stripped part: EOF; ### When we strip some part, we replace it with a short text explaining what ### was there. # MIME descriptions of part and message replacements: think of it as a title. $::descrizione = 'AUTOMATIC WARNING'; # This text replaces a stripped part (W: _TIPOMIME_ is a KEYWORD). @::sostituto = <<"EOF;"; Here was a non admissible message part of \'_TIPOMIME_\' MIME type. It has been automatically discarded before sending the message to the list. EOF; # This text replaces a stripped message (W: _TIPOMIME_ is a KEYWORD). # Embedded messages are discarded if, and only if, they are or become empty. # If the top most message entity becomes empty, nothing will get through. @::messaggio = <<"EOF;"; Here was an embedded message of \'_TIPOMIME_\' MIME type. It has been automatically discarded before sending the whole message to the list, since it didn\'t contain any(more) textual part. EOF; mimefilter-1.7+nmu1/config/README0000644000000000000000000000165411755141721013417 0ustar This directory contains an example of the configuration file for MimeFilter, along with some foreign translations. There should be a system wide configuration file in "/etc/mimefilter.rc". In addition, each mailing list directory can have a customized configuration file named "mimefilter.rc", that may override any system wide item. BEWARE: The program _won't work_ at all without a valid configuration file. Internationalization ==================== The Author will gladly accept national translation of the message contained in mimefilter.rc. He will add them to the distribution, if you promise to keep them updated once in a while. Since the Author himself is Italian, obviously an Italian translation is already included here, under the name "it-mimefilter.rc". Note, however, that it's not a plain translation of the English version, but rather an "extended" version the Author uses on certain mailing lists he administers. mimefilter-1.7+nmu1/ChangeLog0000644000000000000000000000372511755141721013045 0ustar 2001-01-23 Davide G. M. Salvetti * Version 1.2 released. * smartlist/rc.local.s10: empty messages detection rule fixed. * mimefilter.pl (manpage): rc.local.s10 example fixed. 2001-01-20 Davide G. M. Salvetti * mimefilter.pl (manpage): Wording improved. Added a section about the configuration file. Sections presentation order reorganized. * INSTALL: There are other useful configuration variables in the Makefile. * TODO: Don't list the date of the TODO list. * README: Wording improved. * NEWS: Updated. * config/mimefilter.rc: Wording improved. * config/it-mimefilter.rc: Wording improved. * smartlist/README (rc.custom): added. * smartlist/rc.custom: New file. 2001-01-19 Davide G. M. Salvetti * Version 1.1 released. * TODO: Regression tests would be a very nice addition. * smartlist/rc.local.s10: New file. * smartlist/README: New file. * config/README: Directory explanation added. * config/it-mimefilter.rc: Wording improved. * mimefilter.pl (filtra): Empty parts detection improved. 2001-01-17 Davide G. M. Salvetti * TODO: It would be useful to have a mimefilter.rc(5) man page. * config/mimefilter.rc, config/it-mimefilter.rc: state that @::ammessi elements can now be regexps; added @::nonammessi. * mimefilter.pl (filtra): @::ammessi elements can now be regexps; added check for @::nonammessi. 2001-01-16 Davide G. M. Salvetti * Version 1.0 released (first public release). * mimefilter.pl: Put configuration stuff in a separate file. * config: New directory. * config/README: New file. * config/mimefilter.rc: New file. * config/it-mimefilter.rc: New file. 2001-01-14 Davide G. M. Salvetti * mimefilter.pl: Typo in the man page fixed. 2001-01-12 Davide G. M. Salvetti * The ChangeLog begins here, but MimeFilter has been there since at least 2000-05-16. mimefilter-1.7+nmu1/README0000644000000000000000000000101511755141721012141 0ustar MimeFilter ---------- Copyright (C) 2000, 2001 by Davide Giovanni Maria Salvetti. MimeFilter is a Perl script that strips unwanted MIME attachments from a MIME compliant message. It outputs a MIME compliant message with the remaining (accepted) MIME parts. See the file INSTALL for building and installation instructions. Please send all bug reports by electronic mail to: mimefilter@packages.debian.org This program is free software. See the file COPYING for copying conditions. Local variables: mode: text end: