On Apr 23, 22:31, Dave Wolfe wrote:
>[ John Relph writes: ]
>>
>> This patch tries to do better checking to see if two email addresses
>> match because they are on different machines in the same domain. For
>> example, as in the example in majordomo.pl, <foo@baz.bax.edu> is
>> considered to match <foo@bax.edu>.
>>
>> This patch increases the debugging output as well as doing a slightly
>> better job of checking.
>>
>> Any comments?
>
>Yes, can you please use unified diff format so the old and new lines are
>together? For Gnu diff that's the -u option.
Here's such a diff:
--- /usr/local/majordomo-1.94.5/majordomo.pl.orig Sun Feb 27 16:21:38 2000
+++ majordomo.pl Sun Feb 27 19:10:40 2000
@@ -173,11 +173,16 @@
return(undef);
}
- if ($partial == 2 && ($a1[0] ne $a2[0])) { # see if addresses are
+ if ($a1[0] eq $a2[0]) {
+ return(1);
+ }
+
+ local(@addr1,@addr2);
+ @addr1 = split(/\@/, $a1[0]);
+ @addr2 = split(/\@/, $a2[0]);
+
+ if ($partial == 2) { # see if addresses are
# foo@baz.bax.edu, foo@bax.edu
- local(@addr1,@addr2);
- @addr1 = split(/\@/, $a1[0]);
- @addr2 = split(/\@/, $a2[0]);
if ( $#addr1 == $#addr2 && $#addr1 == 1 &&
$addr1[0] eq $addr2[0] && (index($addr1[1], $addr2[1]) >= $[))
{
@@ -185,7 +190,23 @@
}
}
- return($a1[0] eq $a2[0]);
+ if ($#addr1 == 1) {
+ print STDERR "addr_match: comparing $addr1[1] against $main'whereami\n" if $DEBUG;
+ }
+ if ($#addr2 == 1) {
+ print STDERR "addr_match: comparing $addr2[1] against $main'whereami\n" if $DEBUG;
+ }
+
+ if ($addr1[0] eq $addr2[0]) {
+ if ($#addr1 == 0 && $#addr2 == 1 && $addr2[1] eq $main'whereami) { #'
+ return(1);
+ }
+ if ($#addr2 == 0 && $#addr1 == 1 && $addr1[1] eq $main'whereami) { #'
+ return(1);
+ }
+ }
+
+ return(0);
}
# These are package globals referenced by &setabortaddr and &abort
>I can't tell if your changes even do the same thing, but it appears that
>they attempt to deal w/ unqualified addresses (no domain). Don't know
>about stock 1.94.5, but other patches disallow unqualified addresses.
>Your best bet is to fix your MTA so that you never get unqualified
>addresses. It prevents a lot of other problems that way.
Actually, I am comparing the addresses to "majordomo@where.am.i". To
make sure that neither of the addresses is the address of majordomo.
I think. You know, it's been so long since I hacked this that I don't
even remember what it was I was trying to do. But I do know that this
change fixed some problems I was having. (I hope it wasn't the unQ'ed
address problem.) I guess I'll have to look at it once more. (I wish
I had emacs on my majordomo machine.) You may be right about the
unQ'ed address hack, though.
>> ! local(@addr1,@addr2);
>> ! @addr1 = split(/\@/, $a1[0]);
>> ! @addr2 = split(/\@/, $a2[0]);
>> !
>> ! if ($partial == 2) { # see if addresses are
>
>I can't tell what the alternative to the 'if' is now, but it seems odd
>to move the splits out of the 'if' given that the only place they were
>used was inside it.
Here's the full (new) code:
if ($a1[0] eq $a2[0]) {
return(1);
}
local(@addr1,@addr2);
@addr1 = split(/\@/, $a1[0]);
@addr2 = split(/\@/, $a2[0]);
if ($partial == 2) { # see if addresses are
# foo@baz.bax.edu, foo@bax.edu
if ( $#addr1 == $#addr2 && $#addr1 == 1 &&
$addr1[0] eq $addr2[0] && (index($addr1[1], $addr2[1]) >= $[))
{
return(1);
}
}
if ($#addr1 == 1) {
print STDERR "addr_match: comparing $addr1[1] against $main'whereami\n" if $DEBUG;
}
if ($#addr2 == 1) {
print STDERR "addr_match: comparing $addr2[1] against $main'whereami\n" if $DEBUG;
}
if ($addr1[0] eq $addr2[0]) {
if ($#addr1 == 0 && $#addr2 == 1 && $addr2[1] eq $main'whereami) { #'
return(1);
}
if ($#addr2 == 0 && $#addr1 == 1 && $addr1[1] eq $main'whereami) { #'
return(1);
}
}
return(0);
>> ! if ($#addr1 == 1) {
>> ! print STDERR "addr_match: comparing $addr1[1] against $main'whereami\n" if $DEBUG;
>> ! }
>> ! if ($#addr2 == 1) {
>> ! print STDERR "addr_match: comparing $addr2[1] against $main'whereami\n" if $DEBUG;
>> ! }
>
>ICK! Please combine the conditions:
>
> print STDERR "addr_match: comparing $addr1[1] against $main'whereami\n"
> if $DEBUG && $#addr1 == 1;
>
> print STDERR "addr_match: comparing $addr2[1] against $main'whereami\n"
> if $DEBUG && $#addr2 == 1;
>
>--
> Dave Wolfe
-- John
Follow-Ups:
References:
|
|