Author: jpeacock
Date: Tue Nov 8 10:18:02 2005
New Revision: 560
Modified:
branches/0.31/lib/Qpsmtpd/Address.pm
branches/0.31/t/qpsmtpd-address.t
Log:
* lib/Qpsmtpd/Address.pm
RFC-2821 Section 4.5.1 specifically requires <postmaster> (without
domain name) as a legal RCPT TO: address.
* t/qpsmtpd-address.t
Test the above.
Modified: branches/0.31/lib/Qpsmtpd/Address.pm
==============================================================================
--- branches/0.31/lib/Qpsmtpd/Address.pm (original)
+++ branches/0.31/lib/Qpsmtpd/Address.pm Tue Nov 8 10:18:02 2005
@@ -198,7 +198,9 @@ sub canonify {
# empty path is ok
return "" if $path eq "";
- #
+ # bare postmaster is permissible, perl RFC-2821 (4.5.1)
+ return ("postmaster", undef) if $path eq "postmaster";
+
my ($localpart, $domainpart) = ($path =~ /^(.*)\@($domain)$/);
return (undef) unless defined $localpart;
Modified: branches/0.31/t/qpsmtpd-address.t
==============================================================================
--- branches/0.31/t/qpsmtpd-address.t (original)
+++ branches/0.31/t/qpsmtpd-address.t Tue Nov 8 10:18:02 2005
@@ -2,7 +2,7 @@
use strict;
$^W = 1;
-use Test::More tests => 27;
+use Test::More tests => 29;
BEGIN {
use_ok('Qpsmtpd::Address');
@@ -15,6 +15,11 @@ $as = '<>';
$ao = Qpsmtpd::Address->parse($as);
ok ($ao, "parse $as");
is ($ao->format, $as, "format $as");
+
+$as = '<postmaster>';
+$ao = Qpsmtpd::Address->parse($as);
+ok ($ao, "parse $as");
+is ($ao->format, $as, "format $as");
$as = '<[EMAIL PROTECTED]>';
$ao = Qpsmtpd::Address->parse($as);