Bug 5840 - unable to use ldap+sql
Summary: unable to use ldap+sql
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: 3.2.4
Hardware: All All
: P3 normal
Target Milestone: Future
Assignee: SpamAssassin Developer Mailing List
Depends on:
Reported: 2008-02-28 14:36 UTC by Gennady G. Marchenko
Modified: 2022-03-06 11:59 UTC (History)
1 user (show)

Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Gennady G. Marchenko 2008-02-28 14:36:41 UTC
Hello guys!

When I use ldap for user's scores & sql for bayes store I got following error (&
nothing work at all, but there exists bug for this):

config: failed to load user (user@domain.ltd) scores from SQL database: Can't
connect to data source
no database driver specified and DBI_DSN env var not set at
/usr/local/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/Conf/SQL.pm line 125
spamd: service unavailable: Error fetching user preferences via SQL at
/usr/local/bin/spamd line 2006, <GEN99> line 2.

my config looks like:

user_scores_ldap_username       uid=spamd,ou=daemon,dc=domain,dc=ltd
user_scores_ldap_password       pass
bayes_store_module Mail::SpamAssassin::BayesStore::SQL
bayes_sql_dsn DBI:mysql:spamassassin:localhost:3306
bayes_sql_username spamd
bayes_sql_password pass

But I need to get scores from ldap (where stored all information about users) &
store bayes/awl in sql. 

What I'm doing wrong? Why it's not possible? Can it be fixed?

Comment 1 Gennady G. Marchenko 2008-02-28 14:45:05 UTC
my run options:

spamd_flags="-d -q --ldap-config -c -x -m 20 -u spamd"
Comment 2 Gennady G. Marchenko 2009-05-16 11:37:08 UTC
Hey! Is anybody here? :(
Comment 3 Henrik Krohns 2019-06-27 14:36:05 UTC
It does seem that current code doesn't handle ldap and sql at the same time.

If -q is enabled it will always try to load scores there through handle_user_sql

  if ($opt{'sql-config'} && !defined($current_user)) {
    unless (handle_user_sql('nobody')) {
      service_unavailable_error("Error fetching user preferences via SQL");
      return 0;

  if ($opt{'ldap-config'} && !defined($current_user)) {
Comment 4 Henrik Krohns 2022-03-06 11:59:15 UTC
Postponing into future, I don't think many people have this problem..