Bug Tracker item #2896879, was opened at 2009-11-12 15:19
Message generated for change (Comment added) made by aredridel
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2896879&group_id=250683

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: daemon
Group: v3.9.0
Status: Open
Resolution: None
Priority: 9
Private: No
Submitted By: Aria Stewart (aredridel)
Assigned to: Stevan Bajic (sbajic)
Summary: Crash with webui training a fallbackDomain user

Initial Comment:
(gdb) bt
#0  0x000000310987bc70 in strcasecmp () from /lib64/libc.so.6
#1  0x0000000000407458 in ctx_init (ATX=0x7fffbf5e8d40, username=0x0)
    at dspam.c:2429
#2  0x000000000040a5bf in process_message (ATX=0x7fffbf5e8d40, 
    message=0x1005ad0, username=0x0, result_string=0x7fffbf5e8cd8)
    at dspam.c:358
#3  0x000000000040c069 in process_users (ATX=0x7fffbf5e8d40, message=0x1001a60)
    at dspam.c:1865
#4  0x000000000040cbb8 in main (argc=6, argv=0x7fffbf5e9cd8) at dspam.c:265


this is with a user that's a shared group in the groups file, and is a fallback 
user in the preferences.

3.9.0 git

----------------------------------------------------------------------

>Comment By: Aria Stewart (aredridel)
Date: 2009-11-17 11:18

Message:
Looking at it now. Still happens with current git, but I'm trying other
usernames in the group to see if that's the problem.

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2009-11-15 15:41

Message:
Hallo Aredridel,

do you have any update on this case?

--
Kind Regards from Switzerland,

Stevan Bajić

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2009-11-13 04:48

Message:
Hallo Aredridel,

when looking at your stack trace I see that ctx_init() get's called with
an NULL username. This should NOT happen. I could trap that case in
ctx_init(). Better: I must trap that case. Can you apply this patch to the
latest GIT source and try if the crash still presists:
------------------------
diff --git a/src/dspam.c b/src/dspam.c
index 7bfe301..b97f4a5 100644
--- a/src/dspam.c
+++ b/src/dspam.c
@@ -1,4 +1,4 @@
-/* $Id: dspam.c,v 1.378 2009/11/13 02:26:19 sbajic Exp $ */
+/* $Id: dspam.c,v 1.379 2009/11/13 12:44:59 sbajic Exp $ */

 /*
  DSPAM
@@ -2367,6 +2367,12 @@ NEXT:
  */

 DSPAM_CTX *ctx_init(AGENT_CTX *ATX, const char *username) {
+
+  if (username == NULL) {
+    LOG (LOG_CRIT, ERR_AGENT_USER_UNDEFINED);
+    return NULL;
+  }
+
   DSPAM_CTX *CTX;
   char filename[MAX_FILENAME_LENGTH];
   char ctx_group[128] = { 0 };
------------------------

I would say that the crash is gone but you will have a run time error
because DSPAM can not work on a undefined user name.


Kind Regards from Switzerland,

Stevan Bajić

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2009-11-13 04:34

Message:
Hallo Aredridel,

I can not reproduce this here. What I have done so far:

dspam.conf:
FallbackDomains on

MySQL:
insert into dspam_virtual_uids (uid,username) values
(null,'@domain.com');

Shell (I run a DSPAM in OptIn mode):
dspam_admin change preference @domain.com fallbackDomain on
dspam_admin change preference @domain.com optOut off
dspam_admin change preference @domain.com optIn on

After that my data in MySQL looks like this:
dspam_virtual_uids:
+------+-------------+
| uid  | username    |
+------+-------------+
| 2087 | @domain.com |
+------+-------------+

dspam_preferences:
+------+----------------+-------+
| uid  | preference     | value |
+------+----------------+-------+
| 2087 | fallbackDomain | on    |
| 2087 | optIn          | on    |
| 2087 | optOut         | off   |
+------+----------------+-------+

group file:
@domain.com:shared:*...@domain.com

Forced a learning for a bunch of messages. All of them resulted in the
same output:
nyx ~ # dspam --user @domain.com --deliver=summary --stdout
--source=corpus --class=spam < path/to/message1.txt
X-DSPAM-Result: @domain.com; result="Spam"; class="Spam";
probability=1.0000; confidence=1.00; signature=N/A
nyx ~ #

Tokens where added to the MySQL table:
> select count(*) from dspam_token_data where uid=2087;
+----------+
| count(*) |
+----------+
|    36377 |
+----------+

Now did a test with a user that does NOT exist in dspam_virtual_uids:
nyx ~ # dspam --user t...@domain.com --deliver=summary --stdout --process
< path/to/message1000.txt | grep "^X\-DSPAM\-"
X-DSPAM-Result: @domain.com; result="Spam"; class="Spam";
probability=1.0000; confidence=0.99; signature=2087,4afd3dd512221635636504
X-DSPAM-Result: Spam
X-DSPAM-Processed: Fri Nov 13 12:07:01 2009
X-DSPAM-Confidence: 0.9899
X-DSPAM-Improbability: 1 in 9809 chance of being ham
X-DSPAM-Probability: 1.0000
X-DSPAM-Signature: 2087,4afd3dd512221635636504
nyx ~ #

Looks okay to me. The uid used for that user is the one from the user
"@domain.com". Okay. Now let's try to retrain that message:
nyx ~ # dspam --user t...@domain.com --stdout --source=error
--class=innocent --signature=2087,4afd3dd512221635636504
nyx ~ #

Works. I see in the Web-UI that the message got changed. Now retrain it
back (undo) to spam:
nyx ~ # dspam --user t...@domain.com --stdout --source=error --class=spam
--signature=2087,4afd3dd512221635636504
nyx ~ #

Works as well.

The only difference I see in your and my setup is that I used "@domain" as
the group name for the shared group. You used "domain.com" but "domain.com"
does not exist as user in the dspam_virtual_uids table so I used
"@domain.com". Anyway... going back to just use "domain.com" for the group
(@domain.com:shared:*...@domain.com) lead in the same result. Except that this
time the result from DSPAM was innocent instead of spam but that is
probably because the used user "domain.com" for the shared group does not
exist (only @domain.com exists as an user):
nyx ~ # dspam --user t...@domain.com --deliver=summary --stdout --process
< path/to/message1000.txt | grep "^X\-DSPAM\-"
X-DSPAM-Result: @domain.com; result="Innocent"; class="Innocent";
probability=0.0000; confidence=0.70; signature=2087,4afd3f6b15271305324895
nyx ~ #

==> The strange thing here is that I get a summary result but "--stdout"
should FORCE the whole message to be displayed to the console (incl. a
summary). Something is strange here. I can however force deliver to show up
on screen by instructing DSPAM to deliver innocent or spam mails (which
should have been selected by the "--stdout" switch already):
nyx ~ # dspam --user t...@domain.com --deliver=innocent,spam --stdout
--process < path/to/message1000.txt | grep "^X\-DSPAM\-"
X-DSPAM-Result: Innocent
X-DSPAM-Processed: Fri Nov 13 12:22:48 2009
X-DSPAM-Confidence: 0.6701
X-DSPAM-Improbability: 1 in 204 chance of being spam
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: 2087,4afd418820052092820584
nyx ~ #

--> BINGO! That is the right output. It should have been that output from
the beginning. Anyway... this is another issue I need to look after later.

I went ahead and retrained that message to be spam:
nyx ~ # dspam --user t...@domain.com --stdout --source=error --class=spam
--signature=2087,4afd3f6b15271305324895
nyx ~ #

The Web-UI changed and the message was switched to spam.


What have I done on my setup that you have not? Can you attach your
dspam.conf and post the output of "dspam --version"?


Kind Regards from Switzerland,

Stevan Bajić

----------------------------------------------------------------------

Comment By: Aria Stewart (aredridel)
Date: 2009-11-12 23:29

Message:
I do have the rest as you suggested.

----------------------------------------------------------------------

Comment By: Aria Stewart (aredridel)
Date: 2009-11-12 16:40

Message:
I have:

domain.com:shared:*...@domain.com

The docs were a little unclear how it all fits together, the username
munging, etc.

----------------------------------------------------------------------

Comment By: Stevan Bajic (sbajic)
Date: 2009-11-12 15:38

Message:
Hallo Aredridel,

how can you mirror that setup on my end? What do I need to have in the
group file and what in the preference extension?

If I have understood your setup then it's +/- like this:

group file:
@domain.com:shared,managed:*...@another.com

preferences for domain.com:
fallbackDomain=on

dspam.conf:
FallbackDomains on


Right?



Kind Regards from Switzerland,

Stevan Bajic

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2896879&group_id=250683

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to