lib/Exim/Grey.pm
author heiko
Wed, 01 Jun 2016 11:18:48 +0200
changeset 66 16b4815a6a15
parent 63 8525154c1389
child 67 da29842506b4
permissions -rw-r--r--
Do not include the "autokey" in the "greykey"
58
27440e1334b7 Use lib/ and ExtUtils::MakeMaker
heiko
parents: 57
diff changeset
     1
package Exim::Grey;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
     2
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
     3
use strict;
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
     4
use warnings;
58
27440e1334b7 Use lib/ and ExtUtils::MakeMaker
heiko
parents: 57
diff changeset
     5
use base 'Exporter';
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
     6
use Carp;
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
     7
63
8525154c1389 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 61
diff changeset
     8
our @EXPORT_OK   = qw(unseen getDBDir connectDB getDefault);
8525154c1389 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 61
diff changeset
     9
our %EXPORT_TAGS = (all => \@EXPORT_OK,);
8525154c1389 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 61
diff changeset
    10
our $VERSION     = '2.0';
58
27440e1334b7 Use lib/ and ExtUtils::MakeMaker
heiko
parents: 57
diff changeset
    11
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    12
# You may choose, but DB_File's footprint is smaller.
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    13
# perl -MDB_File -e 'tie %h, ...':	real    0m0.063s
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    14
# perl -MBerkeleyDB -e 'tie %h, ...':	real	0m0.112s
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    15
# And DB_File is part of the Perl core distribution (?)
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    16
# use BerkeleyDB;
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    17
# use DB_File;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    18
# But we need locking! DB_File::Lock isn't part of the corelist.
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    19
use DB_File::Lock;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    20
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    21
my %DEFAULT = (
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    22
    delay => 600,
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    23
    db    => "seen",
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    24
);
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    25
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    26
sub unseen;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    27
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    28
# some helper functions
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    29
sub getDBDir();
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    30
sub findExim(;$);
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    31
sub connectDB($$);
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
    32
sub getDefault() { %DEFAULT }
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    33
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    34
# Usage:
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    35
# 	${perl{unseen}{KEY}}
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    36
# 	${perl{unseen}{KEY}{600}}
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    37
# 	${perl{unseen}{KEY}{600}{seen}}
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    38
# 	${perl{unseen}{KEY}{600}{$spool_directory/grey/seen}}
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    39
#
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    40
# With KEY being something to identify the second delivery attempt
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    41
# I recommend using <$sender_address>:<$local_part@$domain>
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    42
#
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    43
# If KEY has a /... suffix, this suffix is used for auto-whitelisting.
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    44
# I recommend using $sender_host_address.
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    45
#
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    46
# defer  condition = ${perl{unseen}{<$sender_address>:<$local_part@$domain>/$sender_host_address}}
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    47
#
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
    48
# record structure: key:   item\0
57
9db6f9fdba12 Tag the auto-whitelist keys
heiko
parents: 55
diff changeset
    49
#                   value: timestamp(creation) timestamp(usage)[ auto]\0
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    50
# (This way we're compatible with ${lookup{...}dbm{...}})
31
7d2c9f3186f4 wildcard behaviour cleaned
heiko
parents: 23
diff changeset
    51
#
7d2c9f3186f4 wildcard behaviour cleaned
heiko
parents: 23
diff changeset
    52
# dbm file is relativ to $spool_directory/grey, EXCEPT its name
7d2c9f3186f4 wildcard behaviour cleaned
heiko
parents: 23
diff changeset
    53
# starts with "./" or "/".
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
    54
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    55
sub unseen {
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    56
    my $item   = shift;
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    57
    my $delay  = shift // $DEFAULT{delay};
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    58
    my $db     = shift // $DEFAULT{db};
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    59
    my $now    = time();
66
16b4815a6a15 Do not include the "autokey" in the "greykey"
heiko
parents: 63
diff changeset
    60
    my ($auto) = $item =~ /.*?\/(.+?)$/ # remove the /<autokey> from the item
16b4815a6a15 Do not include the "autokey" in the "greykey"
heiko
parents: 63
diff changeset
    61
        and $item =~ s/\/.*?$//;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    62
    my $rc;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    63
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    64
    connectDB(\my %h, $db);
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    65
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    66
    return 'no'    # not unseen, ergo known
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    67
      if defined $auto and is_whitelisted($auto, \%h);
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    68
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    69
    my $key = "$item\0";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    70
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    71
    # we do not know anything about the client -> unknown
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    72
    if (not exists $h{$key}) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    73
        $h{$key} = "$now $now 0\0";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    74
        return 'yes';
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    75
    }
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    76
59
8088c95fac5d Fix small bugs
heiko
parents: 58
diff changeset
    77
    my ($created, undef, $count) = split /[ \0]/, $h{$key};
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    78
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    79
    # we know the client, but last contact was recently (too fast)
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    80
    if ($now - $created < $delay) {
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    81
        return 'yes';
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    82
    }
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    83
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    84
    # we know the client, was patiently enough
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    85
    ++$count;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    86
    $h{$key} = "$created $now $count\0";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    87
    whitelist($auto, \%h) if defined $auto;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    88
    return 'no';
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    89
}
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    90
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    91
# According to a thought from "David Woodhouse <dwmw2@infradead.org>"
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    92
# on exim-users@exim.org (Thu, 08 May 2008 13:10:21 +0100,
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    93
# Message-Id: <1210248621.25560.1088.camel@pmac.infradead.org>) we
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    94
# should have the ability to "auto whitelist" hosts which are known
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    95
# for retries, because there is no benefit in greylisting them.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    96
#
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    97
# Most safe approach would be something based on message id.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    98
# If we see the message id a second time it indicates successful retry.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    99
# But we do not see the message id the first time we reject the message.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   100
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   101
# This function has to be called twice per message delivery attempt
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   102
# <KEY> <$sender_host_address> <$sender_helo_name>
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   103
# (Where <KEY> is something like <$sender_address>+<$local_part@$domain>
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   104
# If we see the same message a second time (same message means here:
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   105
# same greylist criteria
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   106
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   107
sub whitelist {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   108
    my ($item, $h) = @_;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   109
    my $now = time;
57
9db6f9fdba12 Tag the auto-whitelist keys
heiko
parents: 55
diff changeset
   110
    $h->{"$item\0"} = "$now $now 1 auto\0";
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   111
}
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   112
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   113
sub is_whitelisted {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   114
    my ($item, $h) = @_;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   115
    my $key = "$item\0";
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   116
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   117
    return 0 if not exists $h->{$key};
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   118
59
8088c95fac5d Fix small bugs
heiko
parents: 58
diff changeset
   119
    my ($t0, undef, $cnt, $flag) = split /[ \0]/, $h->{$key};
57
9db6f9fdba12 Tag the auto-whitelist keys
heiko
parents: 55
diff changeset
   120
    $h->{$key} = join(' ' => $t0, time, ++$cnt, $flag ? $flag : ()) . "\0";
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   121
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   122
    return 1;
38
329e69e5c6dd - started some auto whitelist implementation
heiko
parents: 36
diff changeset
   123
}
329e69e5c6dd - started some auto whitelist implementation
heiko
parents: 36
diff changeset
   124
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   125
# Get the directory where we could store the database file(s)
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   126
# If we're running under exim it's easy, otherwise we've to find exim
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   127
# and then ask...
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   128
sub getDBDir() {
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   129
    my ($spooldir, $dbdir);
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   130
    eval { $spooldir = Exim::expand_string('$spool_directory') };
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   131
    if (not defined $spooldir) {
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   132
        my $exim = findExim();
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   133
        chomp($spooldir = `$exim -be '\$spool_directory'`);
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   134
        die "Can't find spooldir" if not defined $spooldir;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   135
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   136
    -d ($dbdir = "$spooldir/grey") and return $dbdir;
16
b47059897e9b DB-Autocreation
heiko
parents: 12
diff changeset
   137
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   138
    my ($mode, $owner, $group) = (stat $spooldir)[2, 4, 5];
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   139
    {
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   140
        local $) = $group;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   141
        local $> = $owner;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   142
        $mode &= 0777;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   143
        mkdir $dbdir, $mode or die "Can't create $dbdir: $!";
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   144
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   145
    return $dbdir;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   146
}
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   147
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   148
sub findExim(;$) {
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   149
    my $path = shift || $ENV{PATH};
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   150
    my $exim;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   151
    foreach (split /:/, $ENV{PATH}) {
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   152
        -x ($exim = "$_/exim")  and return $exim;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   153
        -x ($exim = "$_/exim4") and return $exim;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   154
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   155
    die "Can't find exim binary (missing .../sbin dirs in PATH?";
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   156
}
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   157
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   158
sub connectDB($$) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   159
    my ($h, $db) = @_;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   160
    $db = getDBDir() . "/$db" unless $db =~ m(^\.?/);
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
   161
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   162
    # Creation of DB-File if it doesn't exist
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   163
    # to avoid races we change our own uid/gid for creation of
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   164
    # this file.
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   165
    if (!-f $db) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   166
        (my $dir = $db) =~ s/^(.*)\/.*?$/$1/;
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
   167
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   168
        # copy mode, uid, gid from the directory
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   169
        my ($mode, $user, $group) = (stat $dir)[2, 4, 5]
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   170
          or die "Can't stat $dir: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   171
        my $umask = umask(($mode & 0777) ^ 0777);
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   172
        local $) = $group;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   173
        local $> = $user;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   174
        open(X, ">>$db") or die "Can't create $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   175
        close(X);
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   176
        umask $umask;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   177
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   178
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   179
    # now test which of the DB-Modules has been loaded
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   180
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   181
    if (exists &BerkeleyDB::Hash::TIEHASH) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   182
        no strict;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   183
        my $umask = umask 077;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   184
        tie %$h, "BerkeleyDB::Hash", -Filename => $db
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   185
          or die "$0: $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   186
        return $db;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   187
    }
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   188
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   189
    if (exists &DB_File::Lock::TIEHASH) {
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   190
        tie %$h, 'DB_File::Lock', [$db], 'write'
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   191
          or die "$0: $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   192
        return $db;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   193
    }
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   194
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   195
    if (exists &DB_File::TIEHASH) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   196
        tie %$h, 'DB_File', $db or die "$0: $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   197
        warn "$0: using DB_File, no locking is possible!\n";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   198
        return $db;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   199
    }
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   200
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   201
    die "Can't connect to database driver";
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
   202
}
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   203
50
79b972eb8990 - exim-exigrey.pl: end with 1 (true)
heiko
parents: 48
diff changeset
   204
1;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   205
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   206
# vim:aw et sw=4 ts=4: