From 1c910ebd5d088b68fd1cec41285ad62641673845 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 20 Apr 2014 23:27:46 +0000 Subject: use ORIGINAL_RECIPIENT once again It should be common for a single users to be subscribed to multiple addresses/lists, so we must use the address before alias expansion. This partially reverts commit b949afc9edf89dd494cac6255c78b124d58e11a5 --- Documentation/public-inbox-mda.txt | 2 +- public-inbox-mda | 4 ++-- scripts/import_gmane_spool | 6 +++--- t/cgi.t | 4 ++-- t/mda.t | 8 ++++---- t/precheck.t | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Documentation/public-inbox-mda.txt b/Documentation/public-inbox-mda.txt index 29570939..8e33e02f 100644 --- a/Documentation/public-inbox-mda.txt +++ b/Documentation/public-inbox-mda.txt @@ -11,7 +11,7 @@ Each system user may have their own public-inbox instances # ENVIRONMENT -* RECIPIENT - the recipient email address, from Postfix +* ORIGINAL_RECIPIENT - the original recipient email address, from Postfix * PI_CONFIG - config file. default: ~/.public-inbox/config * PI_EMERGENCY - emergency destination. default: ~/.public-inbox/emergency/ diff --git a/public-inbox-mda b/public-inbox-mda index 504fefd7..6c446749 100755 --- a/public-inbox-mda +++ b/public-inbox-mda @@ -25,8 +25,8 @@ $emergency = expand_filename($emergency); my $filter = Email::Filter->new(emergency => $emergency); my $config = PublicInbox::Config->new; -my $recipient = $ENV{RECIPIENT}; -defined $recipient or die "RECIPIENT not defined in ENV\n"; +my $recipient = $ENV{ORIGINAL_RECIPIENT}; +defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n"; my $dst = $config->lookup($recipient); defined $dst or exit(1); my $main_repo = $dst->{mainrepo} or exit(1); diff --git a/scripts/import_gmane_spool b/scripts/import_gmane_spool index e072b810..3cda0bf6 100755 --- a/scripts/import_gmane_spool +++ b/scripts/import_gmane_spool @@ -6,10 +6,10 @@ =begin usage mkdir -p $HOME/.public-inbox MAINREPO=/path/to/your/repo.git - export RECIPIENT='list@example.com' + export ORIGINAL_RECIPIENT='list@example.com' git init --bare $MAINREPO export GIT_CONFIG=$HOME/.public-inbox/config - git config publicinbox.$LISTNAME.address $RECIPIENT + git config publicinbox.$LISTNAME.address $ORIGINAL_RECIPIENT git config publicinbox.$LISTNAME.mainrepo $MAINREPO unset GIT_CONFIG ./import_gmane_spool SLRNPULL_ROOT/news/foo/bar @@ -22,7 +22,7 @@ use PublicInbox::Config; use IPC::Run qw(run); sub usage { "Usage:\n".join("",grep(/\t/, `head -n 24 $0`)) } my $spool = shift @ARGV or die usage(); -defined $ENV{RECIPIENT} or die usage(); +defined $ENV{ORIGINAL_RECIPIENT} or die usage(); my @args = ('public-inbox-mda'); chdir $spool or die "chdir $spool failed: $!\n"; diff --git a/t/cgi.t b/t/cgi.t index b992af31..f7035228 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -43,7 +43,7 @@ my $failbox = "$home/fail.mbox"; local $ENV{PI_EMERGENCY} = $failbox; { local $ENV{HOME} = $home; - local $ENV{RECIPIENT} = $addr; + local $ENV{ORIGINAL_RECIPIENT} = $addr; # ensure successful message delivery { @@ -145,7 +145,7 @@ EOF { local $ENV{HOME} = $home; - local $ENV{RECIPIENT} = $addr; + local $ENV{ORIGINAL_RECIPIENT} = $addr; run_with_env({PATH => $main_path}, [$mda], \$in); } local $ENV{GIT_DIR} = $maindir; diff --git a/t/mda.t b/t/mda.t index d70288bc..3357718c 100644 --- a/t/mda.t +++ b/t/mda.t @@ -47,7 +47,7 @@ my $failbox = "$home/fail.mbox"; my $good_rev; local $ENV{PI_EMERGENCY} = $failbox; local $ENV{HOME} = $home; - local $ENV{RECIPIENT} = $addr; + local $ENV{ORIGINAL_RECIPIENT} = $addr; my $simple = Email::Simple->new(< To: You @@ -135,7 +135,7 @@ Date: deadbeef { local $ENV{PI_EMERGENCY} = $failbox; local $ENV{HOME} = $home; - local $ENV{RECIPIENT} = $addr; + local $ENV{ORIGINAL_RECIPIENT} = $addr; local $ENV{PATH} = $main_path; my $mid = 'spam-train@example.com'; my $simple = Email::Simple->new(<new(< diff --git a/t/precheck.t b/t/precheck.t index 42592bc2..974d6a38 100644 --- a/t/precheck.t +++ b/t/precheck.t @@ -13,19 +13,19 @@ sub do_checks { my $f = Email::Filter->new(data => $s->as_string); ok(PublicInbox::MDA->precheck($f, undef), - "RECIPIENT unset is OK"); + "ORIGINAL_RECIPIENT unset is OK"); my $recipient = 'foo@example.com'; ok(!PublicInbox::MDA->precheck($f, $recipient), - "wrong RECIPIENT rejected"); + "wrong ORIGINAL_RECIPIENT rejected"); $recipient = 'b@example.com'; ok(PublicInbox::MDA->precheck($f, $recipient), - "RECIPIENT in To: is OK"); + "ORIGINAL_RECIPIENT in To: is OK"); $recipient = 'c@example.com'; ok(PublicInbox::MDA->precheck($f, $recipient), - "RECIPIENT in Cc: is OK"); + "ORIGINAL_RECIPIENT in Cc: is OK"); } { -- cgit v1.2.3-24-ge0c7