(2005-09の一覧)
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

2005-09-14 Wed (他の年の同じ日: 2004)

先頭の1文字を消す
2005-09-14-2 / カテゴリ: [programming][c] / [permlink]

memmove を使う
char string[] = "foobarbaz";
memmove(string, string + 1, strlen(string));
これで、[string + 1] から [strlen(string)] バイト分を [string] へコピーする。
つまり、"oobarbaz[NULL]" を f のところへコピーする。
memcpy と異なり、第一引数と第二引数が重なっていても正しく動く。

末尾を消すなら、消したいところで '\0' をいれればいい。

spamassassin インストール
2005-09-14-1 / カテゴリ: [linux][debian][メール] / [permlink]

バージョンは 3.0.3-2 (2005/09/14 現在)
# aptitude install spamassassin
:
The following NEW packages will be automatically installed:
  libdigest-hmac-perl libdigest-sha1-perl libhtml-parser-perl 
  libhtml-tagset-perl libnet-dns-perl spamc 
The following NEW packages will be installed:
  libdigest-hmac-perl libdigest-sha1-perl libhtml-parser-perl 
  libhtml-tagset-perl libnet-dns-perl spamassassin spamc 
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 1194kB of archives. After unpacking 3912kB will be used.
Do you want to continue? [Y/n/?]
htmlメールにも対応??

debconf はなし。
メッセージに
SpamAssassin Mail Filter Daemon: disabled, see /etc/default/spamassassin
とあるのでチェック。
動かすためには
ENABLED=0
を 1 にせよ、とのこと。ユーザごとの設定で、システムワイドの設定をすべて上書きできるみたいなので、とりあえず 1 にして daemon start. すると 783/tcp が LISTEN した。

うーん、次に何をすればよいのやら…
ユーザ用の実行ファイルは dpkg -L を見た感じでは /usr/bin/spamassassin と /usr/bin/spamc の2つ。man をさらっと見た限りでは spamc は smapd (daemon) とおしゃべりするコマンドかな。spamassassin がフィルタぽい。
よくわからんので、とりあえず
$ spamassassin --lint
を実行。rule ファイルの syntax error を報告するオプション。
すると
Created user preferences file: /home/zaki/.spamassassin/user_prefs
と、なったので、ひとまず、Maildir/.Junk 以下に Thunderbird さんが振り分けてくれた spam たちで遊んでみる。

とりあえず動作に影響がでなさそうなオプションで
$ spamassassin -tL ~/Maildir/.Junk/cur/xxx
-t は test mode で、レポートを追加
-L は local test mode でサーバと接続しない(?)
で、結果は stdout に吐かれて、ヘッダの最後に
X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on cheddar
X-Spam-Level: ***
X-Spam-Status: No, score=3.0 required=5.0 tests=NO_REAL_NAME,
        SUBJ_ILLEGAL_CHARS autolearn=no version=3.0.3
メール本文の後ろにpreviewと
Content analysis details:   (3.0 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.1 NO_REAL_NAME           From: does not include a real name
 2.9 SUBJ_ILLEGAL_CHARS     Subject contains too many raw illegal characters
というレポートが出力された。
デフォルトだと、points(3.0になってる値)が5.0を超えると spam 判定されるようだ。でもって、spam 扱いになると、multipart メールになって、警告文が追加される。
Subject の書き換え("[spam]"の追加等)は
header_rewrite Subject [spam]
multipart への書き換え禁止は
report_safe 0
を ~/.spamassassin/user_prefs に追加。
ヘッダの追加は許すが、ヘッダの書き換え・本文の書き換えは個人的にキライ。

現在の判定材料は NO_REAL_NAME, SUBJ_ILLEGAL_CHARS のみ(?)ってことかね。

って、よくみたら、/usr/share/doc/spamassassin/USAGE.gz が。
まずは
      spamassassin -t < sample-nonspam.txt > nonspam.out
      spamassassin -t < sample-spam.txt > spam.out
せよ、とのこと ^^; 遅いっつーの。

うーん、結構チューニングが面倒か?
って、ベイジアンフィルタはどうすんだ?

きっと続く。
Referrer (Inside): [2005-09-18-1]
前の日 / 次の日 / 最新 / 2005-09

2013 : 01 02 03 04 05 06 07 08 09 10 11 12
2012 : 01 02 03 04 05 06 07 08 09 10 11 12
2011 : 01 02 03 04 05 06 07 08 09 10 11 12
2010 : 01 02 03 04 05 06 07 08 09 10 11 12
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12
2006 : 01 02 03 04 05 06 07 08 09 10 11 12
2005 : 01 02 03 04 05 06 07 08 09 10 11 12
2004 : 01 02 03 04 05 06 07 08 09 10 11 12

最終更新時間: 2013-05-02 16:12