diff -r 46ba051d29bd -r f095f28db247 lib/Exim/Grey.pm --- a/lib/Exim/Grey.pm Sat Jun 04 22:08:13 2016 +0200 +++ b/lib/Exim/Grey.pm Sat Jun 04 23:05:29 2016 +0200 @@ -52,11 +52,13 @@ # we do not know anything about the client -> unknown if (not exists $h{$key}) { - $h{$key} = "$now $now 0\0"; + $h{$key} = "$now $now 0" + . (defined $auto ? " auto=$auto" : '') + . "\0"; return 'yes'; } - my ($created, undef, $count) = split /[ \0]/, $h{$key}; + my ($created, undef, $count, $flags) = split /[ \0]/, $h{$key}; # we know the client, but last contact was recently (too fast) if ($now - $created < $delay) { @@ -66,7 +68,7 @@ # we know the client, was patiently enough ++$count; $h{$key} = "$created $now $count\0"; - whitelist($auto, \%h) if defined $auto; + whitelist(\%h, $auto, $flags =~ /auto=(\S+)/) if defined $auto; return 'no'; } @@ -91,9 +93,15 @@ # same greylist criteria sub whitelist { - my ($item, $h) = @_; + my ($h, @items) = @_; my $now = time; - $h->{"$item\0"} = "$now $now 1 auto\0"; + $h->{"$_\0"} = "$now $now 1 auto\0" + foreach uniq(@items); +} + +sub uniq { + my %h = map { $_, undef } @_; + return keys %h; } sub is_whitelisted {