X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=maps%2Fbin%2Fmaps;h=17047f42c6995032fda2a0979d98ee7ef5afae28;hb=bd6ea31741c339e295df02884dbdb6801cda49c1;hp=22a7bb8f953bb06aeba4d650541a73f6b5a02ea0;hpb=c8340526ed9b2d0f13a96015090c921ebad114ea;p=clearscm.git diff --git a/maps/bin/maps b/maps/bin/maps index 22a7bb8..17047f4 100755 --- a/maps/bin/maps +++ b/maps/bin/maps @@ -122,6 +122,12 @@ sub ValidDomainUser($) { return defined $uid ? 1 : 0; } # ValidDomainUser +sub formatRule($) { + my ($rec) = @_; + + return "Rule: $rec->{pattern}\@$rec->{domain}:$rec->{sequence}/$rec->{hit_count}"; +} # formatRule + sub ProcessMsgs ($$$) { my ($msgfile, $username, $user_email) = @_; @@ -130,7 +136,7 @@ sub ProcessMsgs ($$$) { while (!eof $msgfile) { my ($sender, $sender_long, $reply_to, $subject, $data) = ReadMsg ($msgfile); - my ($onlist, $rule, $sequence, $hit_count); + my ($onlist, $rec, $sequence, $hit_count); # Algorithm change: We now first check to see if the sender is not found # in the message and skip it if so. Then we handle if we are the sender @@ -156,20 +162,22 @@ sub ProcessMsgs ($$$) { (lc ($sender_long) !~ lc ("\"$username\" <$user_email>") and lc ($sender_long) !~ lc ("$username <$user_email>"))) { $log->msg("Nulllisting message from sender ($sender_long) pretending to be $user_email"); + Nulllist $sender; + next; } # if # Check whitelist: - ($onlist, $rule, $sequence, $hit_count) = OnWhitelist $sender; + ($onlist, $rec) = OnWhitelist $sender; if ($onlist) { if (ValidDomainUser $sender) { - $log->msg("Whitelisting $sender"); + $log->msg("Whitelisting $sender - Rule: " . formatRule($rec)); - Whitelist $sender, $data, $sequence, $hit_count; + Whitelist $sender, $data, $rec->{sequence}, $rec->{hit_count}; } else { - $log->msg("Sender from this domain but user not found"); + $log->msg("Sender ($sender) from this domain but user not found"); Nulllist $sender; } # if @@ -178,16 +186,16 @@ sub ProcessMsgs ($$$) { } # if # Check blacklist: - ($onlist, $rule, $sequence, $hit_count) = OnBlacklist $sender; + ($onlist, $rec) = OnBlacklist $sender; if ($onlist) { - $log->msg("Blacklisting $sender"); + $log->msg("Blacklisting $sender - Rule: " . formatRule($rec)); Blacklist( userid => $userid, sender => $sender, - sequence => $sequence, - hit_count => $hit_count, + sequence => $rec->{sequence}, + hit_count => $rec->{hit_count}, data => $data, ); @@ -195,11 +203,13 @@ sub ProcessMsgs ($$$) { } # if # Check nulllist: - ($onlist, $rule, $sequence, $hit_count) = OnNulllist $sender; + ($onlist, $rec) = OnNulllist $sender; if ($onlist) { - $log->msg("Nulllisting $sender"); - Nulllist $sender, $sequence, $hit_count; + $log->msg("Nulllisting $sender - Rule: " . formatRule($rec)); + + Nulllist $sender, $rec->{sequence}, $rec->{hit_count}; + next; } # if