diff options
Diffstat (limited to 'src/dbase.c')
-rw-r--r-- | src/dbase.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/dbase.c b/src/dbase.c index 43fe0b5..98a7629 100644 --- a/src/dbase.c +++ b/src/dbase.c @@ -62,9 +62,11 @@ static Domain *tail; static int no_trusted_users=0; static int no_trusted_domains=0; +static int no_blacklist=0; static char **trusted_user=NULL; static char **trusted_domain=NULL; +static RE_Expression **blacklist=NULL; static const char *reason; @@ -220,6 +222,14 @@ void DBTrustedDomain(const char *domain) } +void DBBlacklist(RE_Expression re) +{ + no_blacklist++; + blacklist=Realloc(blacklist,sizeof(RE_Expression)*no_blacklist); + blacklist[no_blacklist-1]=re; +} + + int DBBlockMessage(const POP3Message *msg) { static const char *html="text/html"; @@ -243,6 +253,15 @@ int DBBlockMessage(const POP3Message *msg) return TRUE; } + for(f=0;f<no_blacklist;f++) + { + if (RESearch(blacklist[f],msg->from_domain)) + { + reason="blacklisted"; + return TRUE; + } + } + if (!(dom=GetDomain(msg->from_domain))) return FALSE; @@ -316,6 +335,11 @@ void DBClose(void) free(trusted_user); + for(f=0;f<no_blacklist;f++) + REFree(blacklist[f]); + + free(blacklist); + d=head; while(d) @@ -337,7 +361,7 @@ void DBClose(void) free(t->block); for(f=0;f<t->no_allow;f++) - free(t->allow[f]); + REFree(t->allow[f]); free(t->allow); |