---
src/dspam.c | 2 --
src/libdspam.c | 43 +++++++++++++++----------------------------
2 files changed, 15 insertions(+), 30 deletions(-)
diff --git a/src/dspam.c b/src/dspam.c
index e8771e5..00a7429 100644
--- a/src/dspam.c
+++ b/src/dspam.c
@@ -1945,7 +1945,6 @@ int process_users(AGENT_CTX *ATX, buffer *message) {
/* Processing Error */
if (result != DSR_ISINNOCENT &&
- ATX->classification != DSR_NONE &&
ATX->classification != DSR_NONE)
{
deliver = 0;
@@ -1955,7 +1954,6 @@ int process_users(AGENT_CTX *ATX, buffer *message) {
if (result != DSR_ISINNOCENT && ATX->classification == DSR_NONE)
{
- deliver = 1;
LOG (LOG_WARNING,
"process_message returned error %d. delivering.", result);
}
diff --git a/src/libdspam.c b/src/libdspam.c
index 8f6bab7..ae9eb52 100644
--- a/src/libdspam.c
+++ b/src/libdspam.c
@@ -460,7 +460,7 @@ dspam_process (DSPAM_CTX * CTX, const char *message)
struct timezone tzp;
#endif
buffer *header, *body;
- int spam_result = 0, is_toe = 0, is_undertrain = 0;
+ int spam_result = 0, is_toe = 0, is_undertrain = 0, retcode = 0;
#ifdef DEBUG
gettimeofday(&tp1, &tzp);
@@ -520,12 +520,8 @@ dspam_process (DSPAM_CTX * CTX, const char *message)
&& CTX->flags & DSF_SIGNATURE
&& (CTX->tokenizer != DSZ_SBPH))
{
- int i = _ds_process_signature (CTX);
- if (is_toe)
- CTX->operating_mode = DSM_PROCESS;
- if (is_undertrain)
- CTX->training_mode = DST_TOE;
- return i;
+ retcode = _ds_process_signature (CTX);
+ goto outundertrain;
}
header = buffer_create (NULL);
@@ -535,11 +531,8 @@ dspam_process (DSPAM_CTX * CTX, const char *message)
LOG (LOG_CRIT, ERR_MEM_ALLOC);
buffer_destroy (header);
buffer_destroy (body);
- if (is_toe)
- CTX->operating_mode = DSM_PROCESS;
- if (is_undertrain)
- CTX->training_mode = DST_TOE;
- return EUNKNOWN;
+ retcode = EUNKNOWN;
+ goto outtoe;
}
/* Parse the message if it hasn't already been by the client app */
@@ -587,12 +580,15 @@ dspam_process (DSPAM_CTX * CTX, const char *message)
/* Fail if _ds_operate() was unable to process message */
if (spam_result != DSR_ISSPAM && spam_result != DSR_ISINNOCENT) {
+ LOG(LOG_WARNING, "received invalid result (! DSR_ISSPAM || DSR_INNOCENT) "
+ ": %d", spam_result);
+ retcode = EFAILURE;
goto outtoe;
}
/* Force decision if a classification was specified */
- if (CTX->classification != DSR_NONE && spam_result >= 0)
+ if (CTX->classification != DSR_NONE)
{
if (CTX->classification == DSR_ISINNOCENT)
spam_result = DSR_ISINNOCENT;
@@ -603,15 +599,16 @@ dspam_process (DSPAM_CTX * CTX, const char *message)
/* Apply results to context */
CTX->result = spam_result;
if (CTX->class[0] == 0) {
- if (CTX->result == DSR_ISSPAM)
+ if (spam_result == DSR_ISSPAM)
strcpy(CTX->class, LANG_CLASS_SPAM);
- else if (CTX->result == DSR_ISINNOCENT)
+ else if (spam_result == DSR_ISINNOCENT)
strcpy(CTX->class, LANG_CLASS_INNOCENT);
}
outtoe:
if (is_toe)
CTX->operating_mode = DSM_PROCESS;
+ outundertrain:
if (is_undertrain)
CTX->training_mode = DST_TOE;
@@ -626,14 +623,7 @@ dspam_process (DSPAM_CTX * CTX, const char *message)
}
#endif
- if (CTX->result == DSR_ISSPAM || CTX->result == DSR_ISINNOCENT)
- return 0;
- else
- {
- LOG(LOG_WARNING, "received invalid result (! DSR_ISSPAM || DSR_INNOCENT) "
- ": %d", spam_result);
- return EFAILURE;
- }
+ return retcode;
}
/*
@@ -839,7 +829,6 @@ _ds_operate (DSPAM_CTX * CTX, char *headers, char *body)
if (!diction)
{
- ds_diction_destroy(diction);
LOG (LOG_CRIT, ERR_MEM_ALLOC);
errcode = EUNKNOWN;
goto bail;
@@ -1198,8 +1187,7 @@ _ds_process_signature (DSPAM_CTX * CTX)
CTX->learned = 1;
/* INNOCENT */
- if (CTX->classification == DSR_ISINNOCENT &&
- CTX->operating_mode != DSM_CLASSIFY)
+ if (CTX->classification == DSR_ISINNOCENT)
{
if (CTX->flags & DSF_UNLEARN) {
CTX->totals.innocent_learned -= (CTX->totals.innocent_learned) > 0 ? 1:0;
@@ -1219,8 +1207,7 @@ _ds_process_signature (DSPAM_CTX * CTX)
}
/* SPAM */
- else if (CTX->classification == DSR_ISSPAM &&
- CTX->operating_mode != DSM_CLASSIFY)
+ else if (CTX->classification == DSR_ISSPAM)
{
if (CTX->flags & DSF_UNLEARN) {
CTX->totals.spam_learned -= (CTX->totals.spam_learned > 0) ? 1 : 0;
--
1.6.3.3
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Dspam-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-devel