# HG changeset patch # User markus schnalke # Date 1291238866 10800 # Node ID 05fa719b7002ca814cac71bbc310fe2dc581a0ed # Parent 8cca5305e4f0c89c9102bb3caa72cf0f67af2806 fixed -oem by removing it ;-) The implemenation of -oem had been very weird. docs/oem-option explains the situation and the fix. diff -r 8cca5305e4f0 -r 05fa719b7002 ChangeLog --- a/ChangeLog Wed Dec 01 17:29:52 2010 -0300 +++ b/ChangeLog Wed Dec 01 18:27:46 2010 -0300 @@ -7,7 +7,7 @@ technical speach and with focus on compatibility. -0.3.1 Thu, 04 Nov 2010 13:46:58 -0300 +0.3.1 Wed, 01 Dec 2010 18:11:29 -0300 * smtp_out.c: changed the SMTP greeting behavior to match RFC 2821 (always try EHLO first). Thanks to inne for pointing me on that. See also Debian bug #349211 @@ -16,6 +16,7 @@ * refactored the cmdline argument processing (-m is recognized, unknown -oXXX options are ignored now and some corner-cases covered) + * fixed -oem by removing it ;-) (see NEWS and docs/oem-option) * created new functions manipulate_queue() and run_queue() and moved code from main() * replaced the loop-based alias_expand() with a new one that diff -r 8cca5305e4f0 -r 05fa719b7002 NEWS --- a/NEWS Wed Dec 01 17:29:52 2010 -0300 +++ b/NEWS Wed Dec 01 18:27:46 2010 -0300 @@ -24,6 +24,12 @@ calls the MTA with -m. This is mainly a relict of old sendmail times but needed for compatibility. +- The implementation of the command line option -oem had been +weird. Now specifying -oem or -oee results in a (some kind of dumb but) +logical behavior. Common users will probably not notice any difference. +The changes affect only the exit code of the corner-case: Calling masqmail +with -oem but without -oi/-i while submitting messages on stdin. + - Renamed the config file option `alias_local_caseless' to `caseless_matching' because the option affects any address matching. diff -r 8cca5305e4f0 -r 05fa719b7002 docs/oem-option --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/oem-option Wed Dec 01 18:27:46 2010 -0300 @@ -0,0 +1,76 @@ +-oem +==== + +This document explains what I found out about the -oem/-oee options. It +is intended as a knowledge base for further development on this topic. +In version 0.3.0 (2010-11), masqmail's implementation of -oem is +considered broken and -oee is not implemented. + +Following is the behavior masqmail actually had: + + If -oi/-i is given, -oem is ignored. + If no -oi/-i is given, always return with a non-zero return code. + +This current behavior is not like it should be. + + +The desired behavior +-------------------- + +It had been difficult to identify good explanations. The problem, as +often, is that sendmail's source would be the definitive definition. +But in which version and what if common behavior differs from sendmail's +(maybe as a result of misunderstanding)? Exim's documentation has proven +to be a valuable resource. + +In exim the behavior is such: + + If an error is detected while a non-SMTP message is being received + (for example, a malformed address), the error is reported to + the sender in a mail message. Exim exits with a non-zero return + code then, no matter if the error message was successful or not. + (In exim, -oee is similar but exim returns successful if the error + message had been sent successful.) + +The mutt wiki writes about ``sendmail -oi -oem'': + + The mail server (in this case sendmail) will receive the message + in input, and will parse it. In case of a malformed message, + it will send an error message to the user to whom belongs the + MUA trasmitting the message (e.g. user@localhost.localdomain), + and it will exit with a non zero exit code: the -oem flag forces + the returning of a non zero exit code even in the case the error + message has been successfully sent to the local server. + + +What does it mean for masqmail? +------------------------------- + +Masqmail does not send error messages on malformed addresses. It does +not much check for syntax. It detects general errors (unexpected EOF, +no recipients, max message size exceeded) (see masqmail.c:mode_accept()) +but simply prints a message to stderr and exits non-zero. I think that +currently it is not of need to add some elaborate error handling in +this area. Hence, for the implementing of -oem and -oee would do assume +that sending the error message does always fail (because we never send +any such message) and hence we exit non-zero on error. This is the +similar behavior of both options. + +From 0.3.1 on masqmail will not recognize -oem anymore and thus ignore +it like any unknown -oXXX option. It's behavior is then as if error +message sending fails. + +Remind that all this affects only the case of accepting non-SMTP messages +on stdin. + + +On the relationship of -oi and -oem +----------------------------------- + +It seems as if the two options should not affect each other; in contrast +to the behavior in masqmail before 0.3.1. Their relationship is just +that -oem does only affect non-SMTP messages on stdin, which is the +typical use case of -oi. + + +meillo diff -r 8cca5305e4f0 -r 05fa719b7002 man/masqmail.8 --- a/man/masqmail.8 Wed Dec 01 17:29:52 2010 -0300 +++ b/man/masqmail.8 Wed Dec 01 18:27:46 2010 -0300 @@ -128,54 +128,14 @@ .TP \fB\-m\fR -Same as \fB\-om\fR, see below. +``Me too'' +This switch is ignored as, +masqmail never excludes the sender from any alias expansions. + +\fB\-m\fP is an ancient alias for \fB\-om\fP. Kept for compatibility. .TP -\fB\-oem\fR - -Currently this option makes masqmail behave such: - -If the \fB\-oi\fR ist not also given, always return with a non zero return code. - -It seems as if this current behavior is not like it should be. - -In exim this option makes it behave such: - -.in +4 -.ll -4 -If an error is detected while a non-SMTP message is being received -(for example, a malformed address), -the error is reported to the sender in a mail message. -Exim exits with a non-zero return code then, -no matter if the error message was successful or not. -(In exim, -oee is similar but exim returns successful -if the error message had been sent successful.) -.ll -.in - -The mutt wiki writes about ``sendmail -oi -oem'': - -.in +4 -.ll -4 -The mail server (in this case sendmail) will receive the message in input, -and will parse it. In case of a malformed message, it will send an error -message to the user to whom belongs the MUA trasmitting the message -(e.g. user@localhost.localdomain), and it will exit with a non zero exit code: -the -oem flag forces the returning of a non zero exit code even in -the case the error message has been successfully sent to the local server. -.ll -.in - -Masqmail's behavior is different in that: -First, it does not send such error messages. -Second, return non-zero whenever -oem is set (but -oi not). -Third, -oi overrules -oem, though as it seems the two options -should not affect each other. -(Their relationship is just that -oem does only affect non-SMTP -messages on stdin, which is the typical use of -oi.) - -.TP \fB\-odb\fR ``Deliver in Background'' @@ -195,18 +155,13 @@ A dot as a single character in a line does not terminate the message. -.TP -\fB\-om\fR - -``Me too'' -Masqmail never excludes the sender from any alias expansions, -like if this switch is always set. -Specifying this switch changes nothing. +The same as \fB\-i\fP. .TP \fB\-oXXX\fR -Any other switch starting with `-o' is ignored. +Any other switch starting with `\-o' is ignored. +This especially affects \-om, \-oem, \-oee. .TP \fB\-q [\fIinterval\fB]\fR diff -r 8cca5305e4f0 -r 05fa719b7002 src/masqmail.c --- a/src/masqmail.c Wed Dec 01 17:29:52 2010 -0300 +++ b/src/masqmail.c Wed Dec 01 18:27:46 2010 -0300 @@ -391,7 +391,6 @@ gchar *M_cmd = NULL; gboolean opt_t = FALSE; gboolean opt_i = FALSE; - gboolean exit_failure = FALSE; gint exit_code = EXIT_SUCCESS; gchar *conf_file = CONF_FILE; gchar *route_name = NULL; @@ -488,7 +487,6 @@ } else if (strcmp(opt, "i") == 0) { opt_i = TRUE; - exit_failure = FALSE; /* may override -oem */ } else if (strcmp(opt, "m") == 0) { /* ignore -m (me too) switch (see man page) */ @@ -500,15 +498,8 @@ } else if (strcmp(opt, "odq") == 0) { do_queue = TRUE; - } else if (strcmp(opt, "oem") == 0) { - if (!opt_i) { - /* TODO: Why is this related to -i in any way? */ - exit_failure = TRUE; - } - } else if (strcmp(opt, "oi") == 0) { opt_i = TRUE; - exit_failure = FALSE; /* may override -oem */ } else if (strncmp(opt, "o", 1) == 0) { /* ignore all other -oXXX options */ @@ -693,7 +684,7 @@ guint accept_flags = (opt_t ? ACC_DEL_RCPTS | ACC_RCPT_FROM_HEAD : 0) | (opt_i ? ACC_DOT_IGNORE : ACC_NODOT_RELAX); mode_accept(return_path, full_sender_name, accept_flags, &(argv[arg]), argc - arg); - exit(exit_failure ? EXIT_FAILURE : EXIT_SUCCESS); + exit(0); } break; case MODE_NONE: