Bug 5840

Summary: unable to use ldap+sql
Product: Spamassassin Reporter: Gennady G. Marchenko <gennady.marchenko>
Component: spamc/spamdAssignee: SpamAssassin Developer Mailing List <dev>
Status: NEW ---    
Severity: normal CC: apache
Priority: P3    
Version: 3.2.4   
Target Milestone: Future   
Hardware: All   
OS: All   
Whiteboard:

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
ldap://localhost:389/dc=domain,dc=ltd?spamassassin?sub?(|(mailalternateAddress=__USERNAME__)(mail=__USERNAME__)(mailForwardingAddress=__USERNAME__)),
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_dsn
ldap://localhost:389/dc=domain,dc=ltd?spamassassin?sub?(|(mailalternateAddress=__USERNAME__)(mail=__USERNAME__)(mailForwardingAddress=__USERNAME__))
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?

Thanks.
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)) {
    handle_user_ldap('nobody');
  }
Comment 4 Henrik Krohns 2022-03-06 11:59:15 UTC
Postponing into future, I don't think many people have this problem..