* 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.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@560 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2005-11-08 18:18:02 +00:00
parent 37ec3b151e
commit 8a18bb00a1
2 changed files with 9 additions and 2 deletions

View File

@ -198,7 +198,9 @@ sub canonify {
# empty path is ok # empty path is ok
return "" if $path eq ""; 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)$/); my ($localpart, $domainpart) = ($path =~ /^(.*)\@($domain)$/);
return (undef) unless defined $localpart; return (undef) unless defined $localpart;

View File

@ -2,7 +2,7 @@
use strict; use strict;
$^W = 1; $^W = 1;
use Test::More tests => 27; use Test::More tests => 29;
BEGIN { BEGIN {
use_ok('Qpsmtpd::Address'); use_ok('Qpsmtpd::Address');
@ -16,6 +16,11 @@ $ao = Qpsmtpd::Address->parse($as);
ok ($ao, "parse $as"); ok ($ao, "parse $as");
is ($ao->format, $as, "format $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 = '<foo@example.com>'; $as = '<foo@example.com>';
$ao = Qpsmtpd::Address->parse($as); $ao = Qpsmtpd::Address->parse($as);
ok ($ao, "parse $as"); ok ($ao, "parse $as");