develooper Front page | perl.qpsmtpd | Postings from June 2006

Plugin return codes and SMTP status codes (was: [PATCH] implement preforwarding)

Thread Previous | Thread Next
From:
Peter J. Holzer
Date:
June 19, 2006 04:31
Subject:
Plugin return codes and SMTP status codes (was: [PATCH] implement preforwarding)
Message ID:
20060619113132.GB21607@teal.hjp.at
On 2006-06-18 22:08:05 +0200, Robert Millan wrote:
> diff -Nur qpsmtpd-0.32.old/lib/Qpsmtpd/Constants.pm qpsmtpd-0.32/lib/Qpsmtpd/Constants.pm
> --- qpsmtpd-0.32.old/lib/Qpsmtpd/Constants.pm	2006-02-26 13:22:16.000000000 +0100
> +++ qpsmtpd-0.32/lib/Qpsmtpd/Constants.pm	2006-06-18 22:00:12.034032576 +0200
> @@ -23,6 +23,7 @@
>  	DENYHARD => 903,   # 550 + disconnect  (deprecated in 0.29)
>  	DENY_DISCONNECT     => 903, # 550 + disconnect
>  	DENYSOFT_DISCONNECT => 904, # 450 + disconnect
> +	PREFORWARD => 905, # 551
>  	DECLINED => 909,
>  	DONE     => 910,
>  );

Which reminds me: I think we should move to a more flexible system of
return codes. RFC 2821 lists 22 different return codes and Qpsmtpd has
only 7 including the _DISCONNECT variants. To add a new code requires a
patch to the core. I think it would be more elegant if the plugin could
just return (DENY, 551, "User not local; please try <forward-path>") or
something like that to indicate that it wants to send a status code of
551 instead of the default 550. 

The return value should allow specifying:

1) The action to be taken by qpsmtpd. We already have this (OK, DENY,
   DENYSOFT, ...)

2) The SMTP status code. This should be optional. If the plugin doesn't
   return an SMTP status code, qpsmtpd must choose a default value based
   on the action code.

3) The enhanced SMTP status code (see RFC 2034). Like the SMTP status
   code, this should be optional. (But either all or no replies sent to
   the client should have an enhanced SMTP status code, so qpsmtpd
   should fill it in if the plugin doesn't provide one)

4) A multiline reply. We already have this.

The SMTP status codes are easy to recognize: The normal status code
matches /^[2-5]\d\d$/ and the enhanced status code matches
/^[245]\.\d{1,3}\.\d{1,3}$/. So they can be simply prepended to the @msg
array:

    (DENY, 551, "5.1.6",
     "Account has been closed",
     "new address is <foo\@example.net>",
     "please see http://www.example.com/bla/ for more information")

would then result in a reply of

551-5.1.6 Account has been closed
551-new address is <foo@example.net>
551 please see http://www.example.com/bla/ for more information

	hp


-- 
   _  | Peter J. Holzer    | Ich sehe nun ein, dass Computer wenig
|_|_) | Sysadmin WSR       | geeignet sind, um sich was zu merken.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Holger Lembke in dan-am

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About