From 4a6391ce910b5f71574e20b31f1e9429d756b96d Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 5 Jun 2004 01:09:58 +0000 Subject: Fixed checking of trusted users. Tweaks to compile under FreeBSD 4.10. Added debug output option. --- src/dbase.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 7 deletions(-) (limited to 'src/dbase.c') diff --git a/src/dbase.c b/src/dbase.c index e1caa04..563de25 100644 --- a/src/dbase.c +++ b/src/dbase.c @@ -35,6 +35,7 @@ static const char id[]="$Id$"; #include "dbase.h" #include "dstring.h" #include "config.h" +#include "debug.h" #include "util.h" static const char header_id[]=KBS_DBASE_H; @@ -77,17 +78,27 @@ static DString reason=NULL; /* ---------------------------------------- PRVIVATE FUNCTIONS */ -static int IsTrustedUser(const char *username) +static int IsTrustedUser(const char *username, const char *domain) { + char *p; int f; + int res=FALSE; - for(f=0;fid)); + KBSDEBUG(("msg.to='%s'\n",msg->to)); + KBSDEBUG(("msg.from='%s'\n",msg->from)); + KBSDEBUG(("msg.from_uname='%s'\n",msg->from_uname)); + KBSDEBUG(("msg.from_domain='%s'\n",msg->from_domain)); + KBSDEBUG(("msg.subject='%s'\n",msg->subject)); + KBSDEBUG(("msg.content_type='%s'\n",msg->content_type)); + show=ConfigInt(CONFIG_SHOWMATCH); reason=DSReset(reason); @@ -259,7 +278,7 @@ int DBBlockMessage(const POP3Message *msg) if (IsTrustedDomain(msg->from_domain)) return FALSE; - if (IsTrustedUser(msg->from_uname)) + if (IsTrustedUser(msg->from_uname,msg->from_domain)) return FALSE; if (ConfigInt(CONFIG_BLOCKHTML) && @@ -428,7 +447,7 @@ void DBClose(void) free(t->allow); - for(f=0;fno_allow;f++) + for(f=0;fno_allow_to;f++) REFree(t->allow_to[f]); free(t->allow_to); @@ -445,4 +464,46 @@ void DBClose(void) } +void DBDump(void) +{ + Domain *d; + int f; + + for(f=0;fname,d->def_block ? "block":"allow")); + + for(f=0;fno_user;f++) + KBSDEBUG((" user[%d]='%s'\n", + f,d->user[f])); + + for(f=0;fno_block;f++) + KBSDEBUG((" block[%d]='%s'\n", + f,REGetExpression(d->block[f]))); + + for(f=0;fno_allow;f++) + KBSDEBUG((" allow[%d]='%s'\n", + f,REGetExpression(d->allow[f]))); + + for(f=0;fno_allow_to;f++) + KBSDEBUG((" allow_to[%d]='%s'\n", + f,REGetExpression(d->allow_to[f]))); + + d=d->next; + } +} + + /* END OF FILE */ -- cgit v1.2.3