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: 4.0.0
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-28 14:36 UTC by Gennady G. Marchenko
Modified: 2019-06-27 14:36 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
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');
  }