develooper Front page | perl.qpsmtpd | Postings from August 2007

Re: ANNOUNCE: Plugins check_content_type / check_user

Thread Previous | Thread Next
Jens Weibler
August 28, 2007 10:42
Re: ANNOUNCE: Plugins check_content_type / check_user
Message ID:
Ernesto wrote:
> Jens Weibler wrote on 28.08.2007 08:27:
>> Ernesto wrote:
>>> *check_user*
>>> Check User looks up a recipient during smtp phase in a database
>>> It is suitable for mailer configurations qpsmtpd-exim4 with virtual
>>> users in a database.
>> Do I see it right, that you're sharing one mysql-connection for all
>> connections?
> Yes. It is safe and no table locking is needed, because we do only
> reads. Moreover the SQL statements are prepared in advance and reused,
> what should give another performance gain.
>> What about threaded qpsmtpd?
> On my server I'm using Debian Etch with Perl 5.8.8, MySql 5.0.32 and
> Qpsmtpd 0.32 started with qpsmtpd-forkserver - so Qpsmtpd uses the good
> old Perl fork. But I'm not that deep into Perl's bowels to give a
> complete answer.
> It just works with the named environment.
mmh, I think the problem is that two threads could execute a query over
one connection at the same time.

>> btw: customize the fields isn't as nice as customize the query.
>> See dovecot - you can control and customize the authentication process
>> much better if you can customize the whole query..
> Dovecot is doing much more than the plugin check_user. Here we only need
> the results "user exists or not" and "domain is ours or not". I think,
> there is no need for special queries.
scroll down ;)
>> btw2: if you got spare time: custom session variables read from the
>> query result would be a great improvment :)
> Sorry, I don't understand this joke.
no koje - I've written a plugin which reads the spam-level for the
spamcheck and validates the recipient:

        my $sth = $dbh->prepare("select count(*) as count,
MAX(spam_reject_threshold) from mailbox where username = ? HAVING count
> 0 "
                . " UNION select count(*) as count,
MAX(spam_reject_threshold) from alias where address = ? HAVING count > 0");

        $sth->execute( $address, $address );
        # Wir bekommen immer nur eine Zeile!
        my @data = $sth->fetchrow_array();
        my $count = $data[0];
        # Falls threshold null dann nehmen wir 99.99
        my $spam_reject_threshold = defined $data[1] ? $data[1] : 99.99;

$spam_reject_threshold is written into $transaction->notes where it's
later read by the spamassassin plugin.
As you can see I need a custom query because I also check a alias-table.

My idea: every column starting with "notes_" could be automatically
imported into the transaction notes (=session variable)..


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About