diff options
author | Ian C <ianc@noddybox.co.uk> | 2003-12-09 01:25:08 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2003-12-09 01:25:08 +0000 |
commit | b0feacc0fe2d006ac4536f5069c9373beffe2cf5 (patch) | |
tree | a8f78032fe66f9be35383c27851bd65189b693f9 /src/dbase.c | |
parent | 1c161a8cbe16aa59cc8bf4d60d5fa64fdcbc6aa5 (diff) |
Added blacklist command; fixed a few dodgy frees (oops)
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); |