#!/usr/bin/perl # # Copyright (c) 2002 Hajimu UMEMOTO . # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $Mahoroba: src/misc/adfilter,v 1.5 2002/09/12 15:46:37 ume Exp $ # # 「電子メールによる一方的な商業広告の送りつけ(いわゆる迷惑メール)に # 関する新たな表示義務について」で規定される「!広告!」をフィルタする。 # # http://www.meti.go.jp/kohosys/press/0002285/0/020110syoutorihiki.pdf # # 「未承諾広告※」 # http://www.meti.go.jp/policy/consumer/tokusho_amend.html # http://www.zdnet.co.jp/news/0206/26/njbt_01.html # # 使用法: # # - 本スクリプトを /usr/local/libexec/adfilter に EUC で保存し、実行 # 権限を付ける。 # # - .mc ファイルに以下の定義を追加し sendmail.cf を再作成する。 # # LOCAL_CONFIG # Kadsign program /usr/local/libexec/adfilter # # LOCAL_RULESETS # HSubject: $>CheckSubject # # SCheckSubject # R$* $: $(adsign $1 $) # R@MATCH $#discard $: discard use Jcode; use strict; my $str = $ARGV[0]; # 空白、タブ、改行は sendmail によって空白代替文字に置換されている。空 # 白代替文字は cf では confBLANK_SUB で指定され、デフォルトは「.」であ # る。 my $s = $str; $s =~ s/(=\?=)\.(=\?ISO-2022-JP\?B\?)/$1 $2/igo; my $jconv = new Jcode($s); $str = '@MATCH' if ( $jconv->mime_decode =~ /(^(!|!)広告(!|!)|未承諾広告※)/o ); print "$str"; exit 0;