Hi all.

I do hope that this question is not outside the scope of the list and
I apologize in advance if that is the case.

Currently I'am running this configuration on an email gateway server:

- Debian Linux Wheezy
- Postfix 2.9.6-2
- Spamassassin 3.3.2
- Amavisd-new 2.7.1
- Perl 5.14.2
- MySQL 5.5.30 (which holds awl/bayes_vars/bayes_token/etc.)

The filtering and the interaction between SA and Amavis works without 
problems: every mail that pass through the filter is scanned by SA and 
then reported back to the Amavis daemon which will reinsert it on the 
Postfix queue for the final delivery. 

But there's one issue: every time SA try to insert a record of one of 
the user recipient on the bayes_vars table I will get this error:

(...)
SA dbg: info: user has changed
SA dbg: bayes: learner_new 
self=Mail::SpamAssassin::Plugin::Bayes=HASH(0x5a1b270), 
bayes_store_module=Mail::SpamAssassin::BayesStore::MySQL
SA dbg: bayes: using username: matt@test.domain
SA dbg: bayes: learner_new: got 
store=Mail::SpamAssassin::BayesStore::MySQL=HASH(0x5fef0e0)
SA dbg: bayes: database connection established
SA dbg: bayes: found bayes db version 3
SA dbg: bayes: unable to initialize database for matt@test.domain user, 
aborting!
(...)

Currently there are no records for this user, so it should be ok. But after
many tests I still get the error while at the same time SA is able to update
the AWL table on MySQL.                    

The only way to make SA write the record on the bayes_vars table is insert a
row in it with the username "matt@user.domain". In that case I will get what 
I am expecting:

(...)
SA dbg: info: user has changed
SA dbg: bayes: learner_new 
self=Mail::SpamAssassin::Plugin::Bayes=HASH(0x5d3e270), 
bayes_store_module=Mail::SpamAssassin::BayesStore::MySQL
SA dbg: bayes: using username: matt@test.domain
SA dbg: bayes: learner_new: got 
store=Mail::SpamAssassin::BayesStore::MySQL=HASH(0x63120c8)
SA dbg: bayes: database connection established
SA dbg: bayes: found bayes db version 3
SA dbg: bayes: using userid: 10
SA dbg: bayes: not available for scanning, only 0 spam(s) in bayes DB < 200
(...)

Not so many spam emails for this user, so that's absolutely the correct answer 
from SA.

Searching for a reason of why this is not working I gave also a look to the
 (...)/perl5/Mail/SpamAssassin/BayesStore/MySQL.pm module. 
Inside the sub _initialize_db, at the line 725, I have found:

(...)
# Do not create an entry for this user unless we were specifically asked to
return 0 unless ($create_entry_p);
(...)

If I comment out the 'return' line SA will be able to create the record on the 
table even if the
user is not already there.

I always thought that SA would be able to operate autonomously and that it will 
create the
proper records in all the tables of the DB. Am I missing something? Is this the 
designed behaviour?

Thanks in advance.

Matt

Reply via email to