diff options
author | Ian C <ianc@noddybox.co.uk> | 2004-01-26 02:01:49 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2004-01-26 02:01:49 +0000 |
commit | c378e8f900d85d59a8a616bf0b8b14e426d898e1 (patch) | |
tree | 0dbf84eab213d73e58b8041c7d0b2057ba5bcb0f /src/dbase.c | |
parent | f3a485b283141787667ea98b8e0a8687f07d9062 (diff) |
Added allow_to in domain; Added include; Update docs; Fixed folding header lines
Diffstat (limited to 'src/dbase.c')
-rw-r--r-- | src/dbase.c | 43 |
1 files changed, 42 insertions, 1 deletions
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;f<dom->no_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;f<dom->no_user;f++) { int res; @@ -392,6 +428,11 @@ void DBClose(void) free(t->allow); + for(f=0;f<t->no_allow;f++) + REFree(t->allow_to[f]); + + free(t->allow_to); + free(t); } |