ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Slava Dubrovskiy <slava@elan.com.ua>
To: community@altlinux.ru
Subject: Re: [Comm] sa-learn and spam
Date: Wed, 06 Apr 2005 14:32:55 +0300
Message-ID: <4253C8E7.4060301@elan.com.ua> (raw)
In-Reply-To: <4253BCA6.4070003@elan.com.ua>

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

Slava Dubrovskiy пишет:

>>Автору треда: http://jousset.org/pub/sa-postfix.en.html -- для твоего
>>случая
>>должно подойти ...
>>    
>>
>2. Теперь письмо отдается sa-wrapper.pl но он вываливается вот с таким
>сообщением:
>Apr  6 13:22:04 server postfix/pipe[6650]: D6F4D5F1E4:
>to=<spam@spam.spam>, orig_to=<spam@elan.com.ua>, relay=sa-spam, delay=3,
>status=bounced (Command died with status 255:
>"/usr/local/bin/sa-wrapper.pl")
>
>  
>
Знатоки перла, объясните пожалуйста, что означает последняя строчка в
скрипте и почему она не работает?

-- 
С уважением,
Дубровский Вячеслав.


[-- Attachment #2: sa-wrapper.pl --]
[-- Type: text/plain, Size: 1495 bytes --]

#!/usr/bin/perl -w
# Time-stamp: <05 April 2004, 13:37 home>
#
# sa-wrapper.pl
#
# SpamAssassin sa-learn wrapper
# (c) Alexandre Jousset, 2004
# This script is GPL'd
#
# Thanks to: Chung-Kie Tung for the removal of the dir
#            Adam Gent for bug report
#
# v1.2

use strict;
use MIME::Tools;
use MIME::Parser;

my $DEBUG = 0;
my $UNPACK_DIR = '/var/spool/amavis/mime';
my $SA_LEARN = '/usr/bin/sa-learn';
my @DOMAINS = qw/gtmp.org winnink.org/;

my ($spamham, $sender) = @ARGV;

sub recurs
{
    my $ent = shift;

    if ($ent->head->mime_type eq 'message/rfc822') {
	if ($DEBUG) {
	    unlink "/tmp/spam.log.$$" if -e "/tmp/spam.log.$$";
	    open(OUT, "|$SA_LEARN -D --$spamham --single >>/tmp/spam.log.$$ 2>&1") or die "Cannot pipe $SA_LEARN: $!";
	} else {
	    open(OUT, "|$SA_LEARN --$spamham --single") or die "Cannot pipe $SA_LEARN: $!";
	}
    
	$ent->bodyhandle->print(\*OUT);

	close(OUT);
	return;
    }

    my @parts = $ent->parts;

    if (@parts) {
	map { recurs($_) } @parts;
    }
}

my ($domain) = $sender =~ /\@(.*)$/;
unless (grep { $_ eq $domain } @DOMAINS) {
    die "I don't recognize your domain !";
}

if ($DEBUG) {
    MIME::Tools->debugging(1);
    open(STDERR, ">/tmp/spam_err.log");
}
my $parser = new MIME::Parser;
$parser->extract_nested_messages(0);
$parser->output_under($UNPACK_DIR);

my $entity;
eval {
    $entity = $parser->parse(\*STDIN);
};

if ($@) {
    die $@;
} else {
    recurs($entity);
}

$parser->filer->purge;
rmdir $parser->output_dir;

  reply	other threads:[~2005-04-06 11:32 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-05  7:28 Alexey Morsov
2005-04-05  8:08 ` Slava Dubrovskiy
2005-04-05  9:04   ` Alexey Morsov
2005-04-05  9:08     ` [Comm] [offtop]: " Arioch
2005-04-05  9:37       ` Alexey Morsov
2005-04-05 10:32         ` iLL
2005-04-05 10:56           ` Alexey Morsov
2005-04-05 11:02             ` Nick S. Grechukh
2005-04-05 11:12               ` Alexey Morsov
2005-04-05 11:17                 ` Nick S. Grechukh
2005-04-05 13:44                   ` Alexey Morsov
2005-04-05 13:50                     ` Eugene Ostapets
2005-04-05 13:53                       ` Nick S. Grechukh
2005-04-05 14:27                         ` Eugene Ostapets
2005-04-05 14:32                           ` [OFFF] (причем злостный) [JT][JT] " Nick S. Grechukh
2005-04-05 14:45                             ` Eugene Ostapets
2005-04-05 14:53                               ` Nick S. Grechukh
2005-04-05 15:05                                 ` Eugene Ostapets
2005-04-05 14:05                       ` Alexey Morsov
2005-04-05 14:17                         ` Nick S. Grechukh
2005-04-05 14:20                           ` Alexey Morsov
2005-04-05 13:51                     ` Nick S. Grechukh
2005-04-05 14:06                       ` Alexey Morsov
2005-04-05 14:19                         ` Nick S. Grechukh
2005-04-05 14:25                           ` Alexey Morsov
2005-04-05 14:20                         ` Nick S. Grechukh
2005-04-05 11:06             ` Stanislav Yadykin
2005-04-05 11:11               ` Alexey Morsov
2005-04-05 11:22                 ` Stanislav Yadykin
2005-04-05 10:35     ` [Comm] " Slava Dubrovskiy
2005-04-05 10:57       ` Alexey Morsov
2005-04-05 11:09         ` Slava Dubrovskiy
2005-04-05 11:14           ` Alexey Morsov
2005-04-05 14:15             ` Dmitry Lebkov
2005-04-06  4:07               ` Mike Lykov
2005-04-06 10:40               ` Slava Dubrovskiy
2005-04-06 11:32                 ` Slava Dubrovskiy [this message]
2005-04-12  6:00                   ` Re[2]: " Oleksandr Chuchko
2005-04-12  6:17                     ` Slava Dubrovskiy
2005-04-12  9:23                       ` Re[2]: " Oleksandr Chuchko
2005-04-13 18:00               ` [Comm] amavis при превышении числа $MAXFILES не удаляет временные файлы (possible DoS) Oleksandr Chuchko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4253C8E7.4060301@elan.com.ua \
    --to=slava@elan.com.ua \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git