[milters] Archive

Lists Index Date Thread Search

Article: 280
From: Willi Burmeister
Date: 2004-12-12 09:51:49 -0500
Subject: Re: Milter-Sender cache db

Removal...........: milters-request@milter.info?subject=remove
More information..: http://www.milter.info/#Support
--------------------------------------------------------

Hi,

> Rather than delete the cacehe, you could stop the milter, use a ruby or 
> perl script to modify it, then restart. But I've not written such a script.

try this:

----------------------------------------------------------------------
#!/usr/local/bin/perl
#
# milter-rmentry.pl by Willi Burmeister <wib@cs.uni-kiel.de>
# based on milter-cachedump.pl by Chris M. Miller.
# 

use Fcntl;
use DB_File;

my $HANDLE = tie %db, 'DB_File', $ARGV[0], O_RDWR, 0666, $DB_HASH
        or die "Cannot open file $ARGV[0]: $! \n" ;

my $key = sprintf "%s\0", $ARGV[1];

if ($db{$key})
{
  my $status = $HANDLE->del($key);
  printf "entry %s (%d/%d)\n", $status == 0 ? "deleted" : "not
found", $status, $!;
}
else
{
  printf "%s not found\n", $ARGV[1];
}

untie %db;

exit 0;
----------------------------------------------------------------------


Willi


Lists Index Date Thread Search