summaryrefslogtreecommitdiff
path: root/src/dbase.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbase.c')
-rw-r--r--src/dbase.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/dbase.c b/src/dbase.c
index 98a7629..c3e83b7 100644
--- a/src/dbase.c
+++ b/src/dbase.c
@@ -37,6 +37,8 @@ static const char id[]="$Id$";
#include "config.h"
#include "util.h"
+static const char header_id[]=KBS_DBASE_H;
+
/* ---------------------------------------- TYPES
*/
@@ -66,9 +68,9 @@ static int no_blacklist=0;
static char **trusted_user=NULL;
static char **trusted_domain=NULL;
-static RE_Expression **blacklist=NULL;
+static RE_Expression *blacklist=NULL;
-static const char *reason;
+static DString reason=NULL;
/* ---------------------------------------- PRVIVATE FUNCTIONS
@@ -236,8 +238,11 @@ int DBBlockMessage(const POP3Message *msg)
DString ds;
const Domain *dom;
int f;
+ int show;
+
+ show=ConfigInt(CONFIG_SHOWMATCH);
- reason="None";
+ reason=DSReset(reason);
if (IsTrustedDomain(msg->from_domain))
return FALSE;
@@ -249,7 +254,7 @@ int DBBlockMessage(const POP3Message *msg)
(strncmp(msg->content_type,html,strlen(html))==0 ||
strcmp(msg->content_type,"UNKNOWN")==0))
{
- reason="HTML message";
+ DSAddCP(reason,"HTML message");
return TRUE;
}
@@ -257,7 +262,14 @@ int DBBlockMessage(const POP3Message *msg)
{
if (RESearch(blacklist[f],msg->from_domain))
{
- reason="blacklisted";
+ if (show)
+ {
+ DSAddCP(reason,"blacklisted - ");
+ DSAddCP(reason,REGetExpression(blacklist[f]));
+ }
+ else
+ DSAddCP(reason,"blacklisted");
+
return TRUE;
}
}
@@ -293,7 +305,14 @@ int DBBlockMessage(const POP3Message *msg)
if (res==0)
{
DSFree(ds);
- reason="disallowed name";
+
+ if (show)
+ {
+ DSAddCP(reason,"disallowed name - ");
+ DSAddCP(reason,dom->user[f]);
+ }
+ else
+ DSAddCP(reason,"disallowed name");
return TRUE;
}
}
@@ -302,13 +321,19 @@ int DBBlockMessage(const POP3Message *msg)
{
if (RESearch(dom->block[f],ds->text))
{
- reason="disallowed subject";
+ if (show)
+ {
+ DSAddCP(reason,"disallowed subject - ");
+ DSAddCP(reason,REGetExpression(dom->block[f]));
+ }
+ else
+ DSAddCP(reason,"disallowed subject");
DSFree(ds);
return TRUE;
}
}
- reason="default";
+ DSAddCP(reason,"default block");
DSFree(ds);
return dom->def_block;
}
@@ -316,7 +341,7 @@ int DBBlockMessage(const POP3Message *msg)
const char *DBBlockReason(void)
{
- return reason;
+ return reason->text;
}
@@ -325,6 +350,8 @@ void DBClose(void)
Domain *d;
int f;
+ DSFree(reason);
+
for(f=0;f<no_trusted_domains;f++)
free(trusted_domain[f]);