[Mimedefang] greylisting stats

Jonas Eckerman jonas at truls.org
Thu Dec 11 18:49:13 EST 2003


On Wed, 10 Dec 2003 20:28:28 -0500, Security wrote:

>  worked with the Berkeley DB format before.  In reading about it,
>  it looks to me that you can only have one value per key.  Is that
>  true?

Kind of. When you tie it to a hash and don't use any of the special functions for it you can only use key-value pairs, but IIRC it does support multiple keys if you accept a little extra work.

> assume that you would have to use a relational DB like MySQL in order to get
> anymore.

You could do it that way, or a number of other ways. But for this purpose one value/key is perfectly fine. You only need something more when you want more than one key per value.

>  If it isn't true how would you log, for example, the last time the
>  triad was used and the number of times it was used?

One value in the database could easily be multiple values in the application. If you check my greylist implementation at http://whatever.frukt.org you'll see that this is what my database stores:

my $key = "I:<$ip><$sender><$recipient>";
$GDB{$key} = join(';',$created,$now,$reset,$now,$count,$ip,$sender,$recipient,$x);

That's just one value per key, but the value contains values from 9 different variables. :-) If you don't like to save it as a string and the split it, you could store a binary struct instead.

You could also use DWH_File to tie a hash of hashes to a Berkley DB, but that'd be overkill for this and would probably just slow it down.

Regards
/Jonas

-- 
Jonas Eckerman, jonas at truls.org
http://www.truls.org/




More information about the MIMEDefang mailing list