From c378e8f900d85d59a8a616bf0b8b14e426d898e1 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 26 Jan 2004 02:01:49 +0000 Subject: Added allow_to in domain; Added include; Update docs; Fixed folding header lines --- src/dbase.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'src/dbase.c') diff --git a/src/dbase.c b/src/dbase.c index c3e83b7..e1caa04 100644 --- a/src/dbase.c +++ b/src/dbase.c @@ -49,9 +49,11 @@ struct Domain int no_user; int no_block; int no_allow; + int no_allow_to; char **user; RE_Expression *block; RE_Expression *allow; + RE_Expression *allow_to; Domain *next; Domain *prev; }; @@ -165,6 +167,7 @@ Domain *DBNewDomain(RE_Expression name) dom->user=NULL; dom->block=NULL; dom->allow=NULL; + dom->allow_to=NULL; if (tail) tail->next=dom; @@ -208,6 +211,15 @@ void DBBlockSubject(Domain *domain, RE_Expression re) } +void DBAllowTo(Domain *domain, RE_Expression re) +{ + domain->no_allow_to++; + domain->allow_to=Realloc(domain->allow_to, + sizeof(RE_Expression)*domain->no_allow_to); + domain->allow_to[domain->no_allow_to-1]=re; +} + + void DBTrustedUser(const char *username) { no_trusted_users++; @@ -254,7 +266,7 @@ int DBBlockMessage(const POP3Message *msg) (strncmp(msg->content_type,html,strlen(html))==0 || strcmp(msg->content_type,"UNKNOWN")==0)) { - DSAddCP(reason,"HTML message"); + DSAddCP(reason,"HTML message or unknown content type"); return TRUE; } @@ -293,6 +305,30 @@ int DBBlockMessage(const POP3Message *msg) } } + if (dom->no_allow_to) + { + int found=FALSE; + int f; + + for(f=0;fno_allow_to && !found;f++) + if (RESearch(dom->allow_to[f],msg->to)) + found=TRUE; + + if (!found) + { + if (show) + { + DSAddCP(reason,"disallowed to address - "); + DSAddCP(reason,msg->to); + } + else + DSAddCP(reason,"disallowed to address"); + + DSFree(ds); + return TRUE; + } + } + for(f=0;fno_user;f++) { int res; @@ -392,6 +428,11 @@ void DBClose(void) free(t->allow); + for(f=0;fno_allow;f++) + REFree(t->allow_to[f]); + + free(t->allow_to); + free(t); } -- cgit v1.2.3