[Greylist-users] greylist lib in C?

Graham Toal gtoal at gtoal.com
Tue Aug 24 14:04:46 PDT 2004


Before I start writing one, has anyone written a generic library to
handle greylisting actions, written in C (not C++)?  (Or any other C
implementation that I could raid for good bits :-) )

I'm ready to add greylisting to my SMTP relay (Evan lists it in his
links page as if it were complete but I never meant to give that
impression when I was speaking to him!; it was _planned_ and now it
is being implemented...) and if I have to write it from scratch
anyway, I might as well make it a generic library that anyone can
call.  I'm afraid perl and C++ implementations are of no use to me,
sorry.  This has to fit in an existing C program and I would prefer
not to have to call it using system() :-)

[The rest of this post is on the assumption that there isn't a 
ready-to-use library available...]

Question: is a full database like SQL really necessary for storing the
timing information, or are there any robust but cheap hacks that work
just as well that you can recommend?  (Don't say "Berkeley DB" as I've
not had very good experiences with it, having frequently found myself
with corrupt and unrepairable databases for some reason.)  Anyone have
any experience with pbl? (http://mission.base.com/peter/source/pbl/doc/)
- it's what spamprobe uses for tokens and seems fairly robust.  I guess
the main reason for using a proper database here is record locking?

I'm giving serious thought to just keeping the data in memory - just
data structures, no database, and handling all requests via a single
daemon and sockets...  is that too complicated?  It would lose all
records on a reboot, which is probably not a bad thing.  (I'm assuming
unix-like uptimes here of many months, not Windoze uptimes of days ;-) )

Would it be too much of a hack simply to use the filing system directories
as an implicit ISAM index? something like
            .../sender_ip/env_from/env_to/timestamp.txt ?
I've seen mail systems which do that for the sending queue, maybe it's
not entirely silly?

(to some extent I'm being driven here by the need for a quick proof-
of-concept hack, that I can always rewrite later using a better structure,
once I've had time to learn another package, while preserving the
library interface...)

thanks


Graham <gtoal @ gtoal.com>


More information about the Greylist-users mailing list