You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Nate Carlson <na...@natecarlson.com> on 2004/12/08 21:11:06 UTC

Questions about clearing LDAP preferences between runs

[Originally sent this to dev, realized it's more of a user question, 
posting here.]

Hey all,

I've been doing some hacks to Mimedefang to allow per-user configuration 
to be read from LDAP (using the SA ldap stuff), and have it working, 
except for the fact that preferences do not get cleared between runs of 
SpamAssassin. I took a look at the way Mimedefang is doing spam checking 
and hacked up a test script (attached) to verify this behavior. I've also 
included the .cf file I use to grab prefs out of LDAP.

For this script, I have two users defined in ldap - 'testuser1' and 
'testuser2'. testuser1 has no specific sa configuration set; testuser2 has a 
all_spam_to entry for 'user@example.com'. The script runs 3 SA tests on the 
message 'mailmessage'. The first test is run as 'testuser1', the session is 
ended, it's run as testuser2, session is ended again, and then run as testuser1 
again. Here's the results I get:

$ perl sa-ldap-test.pl
Initializing SpamAssassin... compiling... done.
Testing for testuser1... -2.755 hits with ALL_TRUSTED,AWL.
Testing for testuser2... -102.705 hits with 
ALL_TRUSTED,AWL,USER_IN_ALL_SPAM_TO.
Testing for testuser1... -102.666 hits with 
ALL_TRUSTED,AWL,USER_IN_ALL_SPAM_TO.

I thought that doing a $status->finish (see script) would clear out all of the 
whitelist/blacklist it learns from LDAP (so when going from testuser2 back to 
testuser1 it would clear out the all_spam_to entry learned from testuser2), but 
it doesn't seem to do it. I tried taking a look at the spamd code to see what 
I'm doing differently, but can't figure it out - if someone could look at the 
script I'm running, and let me know what's necessary to clear out the conf 
files when switching users, I'd much appreciate it!

------------------------------------------------------------------------
| nate carlson | natecars@natecarlson.com | http://www.natecarlson.com |
|       depriving some poor village of its idiot since 1981            |
------------------------------------------------------------------------

Re: Questions about clearing LDAP preferences between runs

Posted by Nate Carlson <na...@natecarlson.com>.
On Wed, 8 Dec 2004, Nate Carlson wrote:
> I've been doing some hacks to Mimedefang to allow per-user configuration 
> to be read from LDAP (using the SA ldap stuff), and have it working, 
> except for the fact that preferences do not get cleared between runs of 
> SpamAssassin. I took a look at the way Mimedefang is doing spam checking 
> and hacked up a test script (attached) to verify this behavior. I've 
> also included the .cf file I use to grab prefs out of LDAP.

<...>

Any comments on this?

See message at:

http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=users@spamassassin.apache.org&msgNo=20540

if you don't have the original message.

------------------------------------------------------------------------
| nate carlson | natecars@natecarlson.com | http://www.natecarlson.com |
|       depriving some poor village of its idiot since 1981            |
------------------------------------------------------------------------

Re: Questions about clearing LDAP preferences between runs

Posted by Nate Carlson <na...@natecarlson.com>.
On Wed, 8 Dec 2004, Loren Wilton wrote:
> This sounds like it has something to do with the switching users code. 
> I don't know how it is done, but I know it is in spamd somewhere, and 
> uses Storable to store the user configs.  There is special stuff (I 
> believe) somewhere that is supposed to get invoked when switching users 
> in a database case that is a little different than the non-database 
> case.  I may be wrong on that though.

I've copied the part that I thought was relevant from spamd 
(load_scoreonly_ldap, and signal_user_changed), but I may've well missed 
something - I'll take a look at the Storable stuff.

> I'd think your best bet for an answer would be Theo or Michael, and I'm 
> surprised one of them didn't respond.

Well, I did just post this a couple hours ago.  :)  I then saw the type of 
traffic that's usually on the -dev list (bugzilla reports, etc), and 
figured this was probably more of an end-user question (it's probably my 
issue, not a bug in the code), so I reposted here.

------------------------------------------------------------------------
| nate carlson | natecars@natecarlson.com | http://www.natecarlson.com |
|       depriving some poor village of its idiot since 1981            |
------------------------------------------------------------------------

Re: Questions about clearing LDAP preferences between runs

Posted by Loren Wilton <lw...@earthlink.net>.
This sounds like it has something to do with the switching users code.  I
don't know how it is done, but I know it is in spamd somewhere, and uses
Storable to store the user configs.  There is special stuff (I believe)
somewhere that is supposed to get invoked when switching users in a database
case that is a little different than the non-database case.  I may be wrong
on that though.

I'd think your best bet for an answer would be Theo or Michael, and I'm
surprised one of them didn't respond.

        Loren