summaryrefslogtreecommitdiff
path: root/src/dbase.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbase.c')
-rw-r--r--src/dbase.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/dbase.c b/src/dbase.c
index 563de25..356e1c9 100644
--- a/src/dbase.c
+++ b/src/dbase.c
@@ -174,6 +174,7 @@ Domain *DBNewDomain(RE_Expression name)
dom->no_user=0;
dom->no_block=0;
dom->no_allow=0;
+ dom->no_allow_to=0;
dom->user=NULL;
dom->block=NULL;
@@ -276,15 +277,23 @@ int DBBlockMessage(const POP3Message *msg)
reason=DSReset(reason);
if (IsTrustedDomain(msg->from_domain))
+ {
+ KBSDEBUG(("**** ALLOWED - trusted domain '%s'\n",msg->from_domain));
return FALSE;
+ }
if (IsTrustedUser(msg->from_uname,msg->from_domain))
+ {
+ KBSDEBUG(("**** ALLOWED - trusted user '%s@%s'\n",
+ msg->from_uname,msg->from_domain));
return FALSE;
+ }
if (ConfigInt(CONFIG_BLOCKHTML) &&
(strncmp(msg->content_type,html,strlen(html))==0 ||
strcmp(msg->content_type,"UNKNOWN")==0))
{
+ KBSDEBUG(("**** BLOCKED - content_type '%s'\n",msg->content_type));
DSAddCP(reason,"HTML message or unknown content type");
return TRUE;
}
@@ -301,12 +310,17 @@ int DBBlockMessage(const POP3Message *msg)
else
DSAddCP(reason,"blacklisted");
+ KBSDEBUG(("**** BLOCKED - blacklisted '%s'\n",msg->from_domain));
+
return TRUE;
}
}
if (!(dom=GetDomain(msg->from_domain)))
+ {
+ KBSDEBUG(("**** ALLOWED - no domain for '%s'\n",msg->from_domain));
return FALSE;
+ }
ds=DSInit();
@@ -319,6 +333,7 @@ int DBBlockMessage(const POP3Message *msg)
{
if (RESearch(dom->allow[f],ds->text))
{
+ KBSDEBUG(("**** ALLOWED - allowed subject '%s'\n",ds->text));
DSFree(ds);
return FALSE;
}
@@ -343,6 +358,8 @@ int DBBlockMessage(const POP3Message *msg)
else
DSAddCP(reason,"disallowed to address");
+ KBSDEBUG(("**** BLOCKED - bad to address '%s'\n",msg->to));
+
DSFree(ds);
return TRUE;
}
@@ -368,6 +385,10 @@ int DBBlockMessage(const POP3Message *msg)
}
else
DSAddCP(reason,"disallowed name");
+
+ KBSDEBUG(("**** BLOCKED - bad from username '%s'\n",
+ msg->from_uname));
+
return TRUE;
}
}
@@ -384,10 +405,18 @@ int DBBlockMessage(const POP3Message *msg)
else
DSAddCP(reason,"disallowed subject");
DSFree(ds);
+
+ KBSDEBUG(("**** BLOCKED - bad subject '%s'\n",ds->text));
+
return TRUE;
}
}
+ if (dom->def_block)
+ KBSDEBUG(("**** BLOCKED - default block\n"));
+ else
+ KBSDEBUG(("**** ALLOWED - default no block\n"));
+
DSAddCP(reason,"default block");
DSFree(ds);
return dom->def_block;
@@ -483,7 +512,7 @@ void DBDump(void)
while(d)
{
KBSDEBUG(("DOMAIN '%s' default:%s\n",
- d->name,d->def_block ? "block":"allow"));
+ REGetExpression(d->name),d->def_block ? "block":"allow"));
for(f=0;f<d->no_user;f++)
KBSDEBUG((" user[%d]='%s'\n",