fetchmail-friends
[Top] [All Lists]

Re: [fetchmail] exit with non zero code, 2nd

2002-09-15 05:47:49
Sunil Shetye <shetye(_at_)bombay(_dot_)retortsoft(_dot_)com> writes:

The fact is that the current MDA option is an MTA option in multidrop
mode. And, so the fact remains that the current MTA (which is
specified through the MDA option) should send the bouncemail. This is
because:

No. The problem is, fetchmail is a MTA by nature. It *transports*
mail. It has the additional feature of talking multiple protocols, like
POP3, IMAP4rev1, ESMTP and /usr/sbin/sendmail if you want to consider
that as a protocol.

1) multiple recipients are specified on the command line (through %T).
only the MTA can know which addresses have failed and which have not
and send the bouncemail accordingly. The exit status is not sufficient
for fetchmail to get this information to send the bouncemail.

There are more MTA/MDA differences worth to know: The MDA is called
AFTER the final delivery has been worked out by the MTA, and each and
every MDA that I know can only treat one recipient at a time.

Passing more than one recipient in %T is clearly a bug and will break at
least procmail and maildrop -- quoting fetchmail(1) from the --mda
section:

    Some possible MDAs are "/usr/sbin/sendmail -i -oem -f %F %T",
    "/usr/bin/deliver" and "/usr/bin/procmail -d %T"

I'm not sure about deliver, I presume it's Cyrus-Imapd's program which I
don't know.

So, we MUST call the MDA with only ONE recipient at a time anyhow if we
want MDA to work with multidrop.

You may now think that we should have an MTA and an MDA option, and
you're probably right:

* The MTA taking an arbitrary configurable amount of recipients up to
  100, that takes care of the bounces itself,

* The MDA option taking exactly one recipient, with fetchmail generating
  the bounce.

2) the full addresses have been passed in the recipient list. Again,
only an MTA will know the translation between the full address and the
local username.

OTOH, you can configure the remote -> local mappings in fetchmail as
well, think

user 'mylogin' there
  password 'this_is_really_s3cr31'
is sunil.shetye=sunil matthias.andree=ma eric.s.raymond=eric * here

which defines three aliases and leaves the rest unchanged -- and any of
these are subject to MTA expansions again.

[SMTP suggestions]
The following points will have to be kept in mind while implementing
this:

1) the MDA will have to be invoked for each recipient in multidrop
mode. I propose that an option %U (for local username) be used for
this.

Thus, if %U exists in the MDA line, invoke the MDA for each recipient,
record the exit status. if the exit status is valid and indicates an
error, send the bounce.

However, if %T exists in the MDA line (the current scenario), then the
MDA is actually an MTA. invoke the MTA for all recipients. if the exit
status is valid, ignore the exit status, and do not send any bounce.

Sounds like a good plan, but I have a minor adjustment to suggest:

In my opinion, we should use the %T for this recipient iterator, to keep
existing mda "procmail -d %T" in business, and use a new expansion
parameter for "list of recipients", maybe %R.

Remember, "procmail -d %T" has never really worked unless some really
clueful user has parsed the additional arguments and fed the mail to
them. I did not check on fetchmail's past, but I fear fetchmail has gone
lengths to get mail actually delivered, when in fact it was lost in
procmail delivering to only the first argument that %T expanded to.

My suggestion to Eric is: Add the missing translations, add Sunil's
patches that were not yet applied, release it as 5.9.15, and declare
that 5.10.0 after some time, so that users have a stable version while
we work. We fork off 5.9.15 as 5.11.0 and implement all the changes, and
as these mature, 5.11.5 or something will be relabeled 6.0.0.

(neither %T nor %U specified? a misconfiguration!)

I'm again suggesting a new MTA option, and the parameter that expands to
the list of recipients must always indeed be given -- and that way, we
can enforce the PROPER expansion parameter for the option it is given
in.

It is easier to reject the configuration if both mda and mta are given,
add "mta SMTP" as magic and as the default and forget about any further
magic. Letting %T/%U decide whether we have MTA or MDA is too subtle and
may confuse users, and makes the documentation more complex. I expect a
lot of configuration errors on this part if we let this option decide
who is to bounce.

(In single-drop mode, %T should be converted to %U for backward
compatibility)

That's not the simple approach. ;-)

Note that only a limited set of exit statuses can be accepted as
valid. From <sysexits.h>, if the exit status is not EX_OK and not
between EX__BASE and EX__MAX, then return a transient error instead.

Good point, that's fine with me.

2) fetchmail will have to do the translation of the full recipient
address to the local username (for MDA with %U only). This is because
most MDAs (like procmail) will not understand the full email address.

That's correct, but I think that fetchmail already does this, with the
"is remote1=local1 remote2=local2 here" mapping syntax in multidrop
mode.

-- 
Matthias Andree