Hello, 

I finish to write the plugin so Qpsmtpd is compatible with Domain
aliasing patch for QMail. This plugin read the same config
file /var/qmail/control/aliasdomains. Here is a link to the patch :

http://www.qmail-ldap.org/wiki/index.php/Domain_aliasing

Thanks for your help !
Julien

My plugin for qpsmtpd :

------------------------------------------------------------
use Qpsmtpd::DSN;

sub hook_rcpt {
  my ($self, $transaction) = (shift, shift);

  my $old_domain = $_[0]->host;
  
  my @replacment = $self->qp->config('aliasdomains');

  $self->log(LOGDEBUG,"Original Domain : '".$old_domain."'");

  for my $line (@replacment) {

      my ($from, $to) = split(/:/,$line);

      if($old_domain eq $from){
          
$self->log(LOGINFO,"rewriting '".$old_domain."' to '".$to."'");

          $_[0]->host($to);
          return DECLINED;
      }
  }
  return DECLINED;
}
----------------------------------------------------------









Le mercredi 28 janvier 2009 à 16:23 +0100, Julien a écrit :
> It's working with the SVN version, recipient is rewrite when it came to
> rcpt_ldap. 
> 
> I have other problem with the upgrade (coying config is not enough,
> maybe I have change something else) anyway I will correct this myself. 
> 
> But I still have a request to the mailling list, my perl skill is not
> already enough to make the complete plugin code. Could I have some help
> about reading the config file and remplacing the domain part if it match
> any line of the config file.
> 
> The config file (/var/qmail/control/aliasdomains) contain one
> remplacment per line, each remplacment consist of 'olddomain' and
> 'newdomain' seperate by a ':' like :
> 
> test.domain.com:domain.com
> 
> So address jul...@test.domain.com sould be rewrite to jul...@domain.com
> 
> I'm sure there is a very elegant way to do this in perl ...
> 
> The config file is available in $self->qp->config('aliasdomains'); ?
> 
> Then a map { (split ...   /(.*):(.*)/ ...
> 
> Thanks again
> Julien.
> 
> Le mercredi 28 janvier 2009 à 15:26 +0100, Julien a écrit :
> > I'm running a qpsmtpd-0.40 from website 
> > 
> > Le mercredi 28 janvier 2009 à 09:24 -0500, Matt Sergeant a écrit :
> > > On Wed, 28 Jan 2009 15:13:31 +0100, Julien wrote:
> > > > Without any success, I still got/get the original recipient.
> > > 
> > > What version of qpsmtpd? I think changing these values was only added 
> > > in SVN.
> > > 
> > > Matt.
> > 
> 

Reply via email to