Hello,

First of all, the isa_plugin method is available is the debian version. But there is a problem with loading path. I get the following :

could not open plugins/spamassassin: No such file or directory at /usr/share/perl5/Qpsmtpd/Plugin.pm line 121.

I put the wrapper plugin in :

/usr/local/share/qpsmtpd/plugins/
and
/usr/share/qpsmtpd/plugins/

my plugin_dir file indicate the two previous place

But the isa_plugin() method and compile() method does not load the correct file.

In the isa_plugin() method I replace the call to compile by adding the complete path


----- 0.32-6 version ----
  $self->compile($self->plugin_name . "_isa_$cleanParent",
                    $newPackage,
                    "plugins/$parent"); # assumes Cwd is qpsmtpd root
  warn "---- $newPackage\n";

--- modified version -------
  $self->compile($self->plugin_name . "_isa_$cleanParent",
                    $newPackage,
                    "/usr/share/qpsmtpd/plugins/$parent");
  warn "---- $newPackage\n";

It works ! but if I want to write a wrapper for a "local" plugins in /usr/local/share/qpsmtpd/plugins I need to change the path in /usr/share/perl5/Qpsmtpd/Plugin.pm

Is it possible to modify the Plugin.pm in order to search the "parent" plugin in directory listing in /etc/qpsmtpd/plugin_dir like :

$dirs = file_contents("/etc/qpsmtpd/plugin_dir");

foreach($dirs as $dir){

   if(file_exists($dir.$parent)){
       $self->compile(....,
                    $dir.$parent);
       break;
   }
}

I known it is not a perl code but I have just a little experience in this language.


Julien.


Quoting [EMAIL PROTECTED]:

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