projects
/
clearscm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed uninitialized var
[clearscm.git]
/
maps
/
bin
/
maps
diff --git
a/maps/bin/maps
b/maps/bin/maps
index
6050269
..
594d2d9
100755
(executable)
--- a/
maps/bin/maps
+++ b/
maps/bin/maps
@@
-122,15
+122,21
@@
sub ValidDomainUser($) {
return defined $uid ? 1 : 0;
} # ValidDomainUser
return defined $uid ? 1 : 0;
} # ValidDomainUser
+sub formatRule($) {
+ my ($rec) = @_;
+
+ return "$rec->{pattern}\@$rec->{domain}:$rec->{sequence}/$rec->{hit_count} $rec->{comment}";
+} # formatRule
+
sub ProcessMsgs ($$$) {
my ($msgfile, $username, $user_email) = @_;
return unless $opts{execute};
while (!eof $msgfile) {
sub ProcessMsgs ($$$) {
my ($msgfile, $username, $user_email) = @_;
return unless $opts{execute};
while (!eof $msgfile) {
- my
($sender, $sender_long, $reply_to, $subject, $data) = ReadMsg ($msgfile)
;
+ my
%msgInfo = ReadMsg $msgfile
;
- my ($onlist, $r
ule
, $sequence, $hit_count);
+ my ($onlist, $r
ec
, $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
# 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
@@
-150,70
+156,78
@@
sub ProcessMsgs ($$$) {
# Finally, we handle return processing
# Discard any email with an invalid email address
# Finally, we handle return processing
# Discard any email with an invalid email address
- next unless Email::Valid->address($
sender
);
+ next unless Email::Valid->address($
msgInfo{sender}
);
- if ($
sender
eq $user_email and
- (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
");
+ if ($
msgInfo{sender}
eq $user_email and
+ (lc ($
msgInfo{sender_long}
) !~ lc ("\"$username\" <$user_email>") and
+ lc ($
msgInfo{sender_long}
) !~ lc ("$username <$user_email>"))) {
+ $log->msg("Nulllisting message from sender ($
msgInfo{sender_long}) pretending to be $user_email - Subject: $msgInfo{subject}
");
- Nulllist $sender;
+ next;
+ } # if
+
+ # Discard messges coming from andrew@clearscm.com because I don't send from
+ # that email address
+ if (lc $msgInfo{to} eq 'andrew@clearscm.com') {
+ $log->msg("Nulllisting message from Andrew\@ClearSCM.com since I don't send from that email address - Subject: $msgInfo{subject}");
next;
} # if
# Check whitelist:
next;
} # if
# Check whitelist:
- ($onlist, $r
ule, $sequence, $hit_count) = OnWhitelist $sender
;
+ ($onlist, $r
ec) = OnWhitelist $msgInfo{sender}
;
if ($onlist) {
if ($onlist) {
- if (ValidDomainUser $
sender
) {
- $log->msg("Whitelisting $
sender - Rule: $rule:$sequence/$hit_count
");
+ if (ValidDomainUser $
msgInfo{sender}
) {
+ $log->msg("Whitelisting $
msgInfo{sender} - Rule: " . formatRule($rec) . " - Subject: $msgInfo{subject}
");
- Whitelist $
sender, $data, $sequence, $hit_count
;
+ Whitelist $
msgInfo{sender}, $msgInfo{data}, $rec->{sequence}, $rec->{hit_count}
;
} else {
} else {
- $log->msg("Sender ($
sender) from this domain but user not found
");
+ $log->msg("Sender ($
msgInfo{sender}) from this domain but user not found - Subject: $msgInfo{subject}
");
- Nulllist $
sender
;
+ Nulllist $
msgInfo{sender}
;
} # if
next;
} # if
# Check blacklist:
} # if
next;
} # if
# Check blacklist:
- ($onlist, $r
ule, $sequence, $hit_count) = OnBlacklist $sender
;
+ ($onlist, $r
ec) = OnBlacklist $msgInfo{sender}
;
if ($onlist) {
if ($onlist) {
- $log->msg("Blacklisting $
sender - Rule: $rule:$sequence/$hit_count
");
+ $log->msg("Blacklisting $
msgInfo{sender} - Rule: " . formatRule($rec) . " - Subject: $msgInfo{subject}
");
Blacklist(
userid => $userid,
Blacklist(
userid => $userid,
- sender => $
sender
,
- sequence => $
sequence
,
- hit_count => $
hit_count
,
- data => $
data
,
+ sender => $
msgInfo{sender}
,
+ sequence => $
rec->{sequence}
,
+ hit_count => $
rec->{hit_count}
,
+ data => $
msgInfo{data}
,
);
next;
} # if
# Check nulllist:
);
next;
} # if
# Check nulllist:
- ($onlist, $r
ule, $sequence, $hit_count) = OnNulllist $sender
;
+ ($onlist, $r
ec) = OnNulllist $msgInfo{sender}
;
if ($onlist) {
if ($onlist) {
- $log->msg("Nulllisting $sender - Rule: $rule:$sequence/$hit_count");
- Nulllist $sender, $sequence, $hit_count;
+ $log->msg("Nulllisting $msgInfo{sender} - Rule: " . formatRule($rec) . " - Subject: $msgInfo{subject}");
+
+ Nulllist $msgInfo{sender}, $rec->{sequence}, $rec->{hit_count};
+
next;
} # if
# Return processing:
next;
} # if
# Return processing:
- $log->msg("Returning message from $
sender
");
+ $log->msg("Returning message from $
msgInfo{sender} - Subject: $msgInfo{subject}
");
ReturnMsg(
userid => $userid,
ReturnMsg(
userid => $userid,
- sender => $
sender
,
- reply_to => $
reply_to
,
- subject => $
subject
,
- data => $
data
,
+ sender => $
msgInfo{sender}
,
+ reply_to => $
msgInfo{reply_to}
,
+ subject => $
msgInfo{subject}
,
+ data => $
msgInfo{data}
,
);
} # while
} # ProcessMsgs
);
} # while
} # ProcessMsgs
@@
-235,7
+249,7
@@
$log = Logger->new(
my $msgfile;
my $msgfile;
-if ($ARGV[0] and $ARGV[0] ne
""
) {
+if ($ARGV[0] and $ARGV[0] ne
''
) {
open $msgfile, '<', $ARGV[0];
unless ($msgfile) {
open $msgfile, '<', $ARGV[0];
unless ($msgfile) {