Thanks for your reply !

I'm using the etch version 0.32-6. I have been using the 0.40 version before (on some server). I recently install debian version (on other server) for the simplicity of installation.

So I write my own wrapper plugin called "sa_norelay" with the following code :
--------------------
sub init {
    my ($self, $qp, @args) = @_;
    $self->isa_plugin("spamassassin");
}

sub hook_data_post {
    my ($self, $transaction) = @_;
    return DECLINED if $self->qp->connection->relay_client;
    return $self->SUPER::hook_data_post($transaction);
}
------------------
Then I replace the spamassin call in config/plugins file by sa_norelay, and switch to the 0.40 version or newer.

Am I right ?

It is more elegant to leave the spam plugins unchange !

Thanks you Hanno ! and thanks to qpsmtpd developper and contributor !

Julien





Quoting Hanno Hecker <[EMAIL PROTECTED]>:

Hi Julien,

On Fri, 26 Sep 2008 12:00:36 +0200
[EMAIL PROTECTED] wrote:
I'd like to disable spamassassin check for mail coming from relay
clients. Is there a way to do that with the config file
/etc/qpsmtpd/plugins without modifying the plugin code ?
Not with a/the config file, but with a simple wrapper plugin.

So far, I added the following lines to the spamassasin plugin
code in the hook_data_post function :

    # no spam check for relay client
    if ( $self->qp->connection->relay_client ) {
        $self->log(LOGDEBUG,"No spam check from relay client");
        return (OK);
    }
You should return DECLINED here, else no other plugin will be run (like
a virus checker).

[...]
The code is working. But is there a more elegant way to do that?
[...]
I am using the debian relase of qpsmtpd.
Hmm... etch or lenny/sid? I'm not sure when the "isa_plugin" was added,
but the etch version is too old for that. For lenny this may work as
"sa_norelay" plugin. Not sure, I've never used the debian packages, just
SVN  checkouts (even if all my systems are debian :))
Use this instead of "spamassassin" in the config file. Arguments and
usage is the same as the original spamassassin plugin.
--------------------
sub init {
    my ($self, $qp, @args) = @_;
    $self->isa_plugin("spamassassin");
}

sub hook_data_post {
    my ($self, $transaction) = @_;
    return DECLINED if $self->qp->connection->relay_client;
    return $self->SUPER::hook_data_post($transaction);
}
------------------

        Hanno



Reply via email to