On Fri, Dec 12, 2008 at 12:59:41AM +0100, klondike wrote:

> According to section 4.2.4 on the RFC 282, the SMTP server should return
> 502 only when a command is recognised but not implemented, and 500 if it
> isn't recognised.

This is not a bug, but it is admittedly an unecessary deviation from
SHOULD normative language in the RFC when the client is in flagrant
violation by sending garbage.

> Whe I connect to my postfix server and enter some random commands (ie
> knodwfonfwdnoi) I get a 502 error message instead of a 500. So I suppose
> that in order to acomplish with RFC 2821 it should return a 500 error
> intead.

If you need RFC conformance for invalid client commands, here's a patch
that works for the latest 2.6 snapshot, and likely also for 2.5.5. The
part you want is the second "hunk", but may as well pick another nit
while we're at it:

Index: src/smtpd/smtpd.c
--- src/smtpd/smtpd.c   6 Dec 2008 08:12:25 -0000       1.1.1.16.2.2
+++ src/smtpd/smtpd.c   12 Dec 2008 03:40:42 -0000
@@ -3230,7 +3230,7 @@
     }
     if (argc != 2) {
        state->error_mask |= MAIL_ERROR_PROTOCOL;
-       smtpd_chat_reply(state, "500 Syntax: ETRN domain");
+       smtpd_chat_reply(state, "501 Syntax: ETRN domain");
        return (-1);
     }
     if (argv[1].strval[0] == '@' || argv[1].strval[0] == '#')
@@ -4394,7 +4394,7 @@
                    && (err = check_milter_reply(state, err)) != 0) {
                    smtpd_chat_reply(state, err);
                } else
-                   smtpd_chat_reply(state, "502 5.5.2 Error: command not 
recognized");
+                   smtpd_chat_reply(state, "500 5.5.2 Error: command not 
recognized");
                state->error_mask |= MAIL_ERROR_PROTOCOL;
                state->error_count++;
                continue;

-- 
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majord...@postfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.

Reply via email to