From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Status: No, score=-2.6 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.1 Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D005E1F403 for ; Tue, 12 Jun 2018 15:36:57 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id k16-v6so24606920wro.0 for ; Tue, 12 Jun 2018 08:36:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9Bect5T53WNfr9EXZEtvrRi0PlEryLgq/mYCUvBywv8=; b=fTpiSXabsXvt8lwiGyKj1O6KUq2BAbG53QsQq7r4xryaeNL5PZ3JueDHfxeEjHilek Dxpnan5h2kC48qChzBrJbMVGurwcjZzzoY2F6PxzEbkFjYbYpkQ7UJLLOM+ih+O7wOY1 WUhfjbMlWzCG+P34L5+3eyKV3MflKK3RG+fDXhmBCIMXvAWiCPLnpTw4ehyaMQ5RZGC1 4lcS9ThO+UxSrShwSbpayjHjdcMYHAy2uj1LUziPtpA3RSB+fN8o3hRZ+VgSn/zo7kYg 9IAbpm48XTgXXbc2o8q1IMSXvMkr+vokP02YKpbthwNWZvqTILQZ8N7Dr7abbUXM9RCx +UDg== X-Gm-Message-State: APt69E3LgwVN4T3SrmeFzolDDl5tIGvReAjwO6AE0lIulvnYJnGqJQoZ jhJpzZlp2H5CtON7MfOTYvk= X-Google-Smtp-Source: ADUXVKKqUmChb8CHr89TalvIfKWsTz1Yr29fd3g6VRv/ow0i4P/vHFUL/MeBl853K0guKbWK1ywtZA== X-Received: by 2002:adf:8361:: with SMTP id 88-v6mr684426wrd.17.1528817816185; Tue, 12 Jun 2018 08:36:56 -0700 (PDT) Received: from juno.home.vuxu.org ([2001:4ca0:0:f224:a288:b4ff:fea1:ce50]) by smtp.gmail.com with ESMTPSA id f2-v6sm644323wre.16.2018.06.12.08.36.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 08:36:55 -0700 (PDT) Received: from localhost (juno.home.vuxu.org [local]) by juno.home.vuxu.org (OpenSMTPD) with ESMTPA id be3d7bca; Tue, 12 Jun 2018 15:36:54 +0000 (UTC) From: Leah Neukirchen To: meta@public-inbox.org Cc: Leah Neukirchen Subject: [PATCH] public-inbox-mda: use status codes where applicable Date: Tue, 12 Jun 2018 17:36:52 +0200 Message-Id: <20180612153652.29719-1-leah@vuxu.org> X-Mailer: git-send-email 2.17.1 List-Id: Many MTA understand these and map them to sensible SMTP error messages. Inability to find an inbox results in "5.1.1 user unknown". Misformatted messages are rejected with "5.6.0 data format error". Unsupported inbox versions are reported as "5.3.5 local configuration error". All of these are interpreted as permanent failures. --- script/public-inbox-mda | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/script/public-inbox-mda b/script/public-inbox-mda index 766d58a..1f1252a 100755 --- a/script/public-inbox-mda +++ b/script/public-inbox-mda @@ -38,8 +38,8 @@ my $config = PublicInbox::Config->new; my $recipient = $ENV{ORIGINAL_RECIPIENT}; defined $recipient or die "ORIGINAL_RECIPIENT not defined in ENV\n"; my $dst = $config->lookup($recipient); # first check -defined $dst or do_exit(1); -my $main_repo = $dst->{mainrepo} or do_exit(1); +defined $dst or do_exit(67); # EX_NOUSER 5.1.1 user unknown +my $main_repo = $dst->{mainrepo} or do_exit(67); # pre-check, MDA has stricter rules than an importer might; do_exit(0) unless PublicInbox::MDA->precheck($simple, $dst->{address}); @@ -73,7 +73,7 @@ if (ref($ret) && $ret->isa('Email::MIME')) { # filter altered message } elsif ($ret == PublicInbox::Filter::Base::IGNORE) { do_exit(0); # chuck it to emergency } elsif ($ret == PublicInbox::Filter::Base::REJECT) { - $! = $ret; + $! = 65; # EX_DATAERR 5.6.0 data format error die $filter->err, "\n"; } # else { accept @@ -88,6 +88,7 @@ if ($v == 2) { my $git = $dst->git; $im = PublicInbox::Import->new($git, $dst->{name}, $recipient, $dst); } else { + $! = 78; # EX_CONFIG 5.3.5 local configuration error die "Unsupported inbox version: $v\n"; } if (defined $im->add($mime)) { -- 2.17.1