[pmg-devel] [PATCH] Close #2438: api: add lmtp support

Stoiko Ivanov s.ivanov at proxmox.com
Tue Dec 10 11:29:59 CET 2019


a tiny nit (nothing material) regarding the commit message:
* you could put the 'api' in the subject-prefix - then it's put in the
  subject line as '[PATCH pmg-api]', but not in the commit message of the
  pmg-api repo (where it's clear that it's for the api)
* a short further line explaining that postfix supports that, and that it
  helps to simplify setups with e.g. dovecot as LMTP capable downstream server
  would help developers not so familiar with the aim of the patch


one small bug commented inline:
On Mon,  9 Dec 2019 21:42:31 +0100
Julian Zehnter <pmg-devel at j-z.it> wrote:

> Signed-off-by: Julian Zehnter <pmg-devel at j-z.it>
> ---
>  src/PMG/API2/Transport.pm     | 21 ++++++++++++++++++---
>  src/PMG/Config.pm             |  9 ++++++++-
>  src/templates/main.cf.in      |  4 ++--
>  src/templates/main.cf.in.demo |  4 ++--
>  4 files changed, 30 insertions(+), 8 deletions(-)
> 
> diff --git a/src/PMG/API2/Transport.pm b/src/PMG/API2/Transport.pm
> index 98ab414..36b2720 100644
> --- a/src/PMG/API2/Transport.pm
> +++ b/src/PMG/API2/Transport.pm
> @@ -33,6 +33,7 @@ __PACKAGE__->register_method ({
>  	    properties => {
>  		domain => { type => 'string' },
>  		host => { type => 'string' },
> +		protocol => { type => 'string' },
>  		port => { type => 'integer' },
>  		use_mx => { type => 'boolean' },
>  		comment => { type => 'string'},
> @@ -73,8 +74,14 @@ __PACKAGE__->register_method ({
>  		description => "Target host (name or IP address).",
>  		type => 'string', format => 'address',
>  	    },
> +	    protocol => {
> +		description => "Transport protocol.",
> +		type => 'string',
> +		default => 'smtp',
> +		optional => 1,
> +	    },
>  	    port => {
> -		description => "SMTP port.",
> +		description => "Transport port.",
>  		type => 'integer',
>  		minimum => 1,
>  		maximum => 65535,
> @@ -108,6 +115,7 @@ __PACKAGE__->register_method ({
>  	    $tmap->{$param->{domain}} = {
>  		domain => $param->{domain},
>  		host => $param->{host},
> +		protocol => $param->{protocol} // smtp,
smtp is not quoted - it should read 'smtp'

>  		port => $param->{port} // 25,
>  		use_mx => $param->{use_mx} // 1,
>  		comment => $param->{comment} // '',
> @@ -144,6 +152,7 @@ __PACKAGE__->register_method ({
>  	properties => {
>  	    domain => { type => 'string'},
>  	    host => { type => 'string'},
> +	    protocol => { type => 'string'},
>  	    port => { type => 'integer'},
>  	    use_mx => { type => 'boolean'},
>  	    comment => { type => 'string'},
> @@ -181,8 +190,14 @@ __PACKAGE__->register_method ({
>  		type => 'string', format => 'address',
>  		optional => 1,
>  	    },
> +	    protocol => {
> +		description => "Transport protocol.",
> +		type => 'string',
> +		default => 'smtp',
> +		optional => 1,
> +	    },
>  	    port => {
> -		description => "SMTP port.",
> +		description => "Transport port.",
>  		type => 'integer',
>  		minimum => 1,
>  		maximum => 65535,
> @@ -216,7 +231,7 @@ __PACKAGE__->register_method ({
>  
>  	    die "no options specified\n" if !scalar(keys %$param);
>  
> -	    for my $prop (qw(host port use_mx comment)) {
> +	    for my $prop (qw(host protocol port use_mx comment)) {
>  		$data->{$prop} = $param->{$prop} if defined($param->{$prop});
>  	    }
>  
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index 6e0a37c..7f3c2bd 100755
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -480,8 +480,14 @@ sub properties {
>  	    description => "The default mail delivery transport (incoming mails).",
>  	    type => 'string', format => 'address',
>  	},
> +	replayprotocol => {
> +	    description => "Transport protocol for relay host.",
> +	    type => 'string',
> +	    enum => [qw(smtp lmtp)],
> +	    default => 'smtp',
> +	},
>  	relayport => {
> -	    description => "SMTP port number for relay host.",
> +	    description => "Transport port number for relay host.",
>  	    type => 'integer',
>  	    minimum => 1,
>  	    maximum => 65535,
> @@ -647,6 +653,7 @@ sub options {
>  	smarthost => { optional => 1 },
>  	smarthostport => { optional => 1 },
>  	relay => { optional => 1 },
> +	replayprotocol => { optional => 1 },
>  	relayport => { optional => 1 },
>  	relaynomx => { optional => 1 },
>  	dwarning => { optional => 1 },
> diff --git a/src/templates/main.cf.in b/src/templates/main.cf.in
> index 7bf9afa..2bad66a 100644
> --- a/src/templates/main.cf.in
> +++ b/src/templates/main.cf.in
> @@ -35,9 +35,9 @@ transport_maps = hash:/etc/pmg/transport
>  
>  [% IF pmg.mail.relay %]
>  [% IF pmg.mail.relaynomx %]
> -relay_transport = smtp:[[% pmg.mail.relay %]]:[% pmg.mail.relayport %]
> +relay_transport = [% pmg.mail.protocol %]:[[% pmg.mail.relay %]]:[% pmg.mail.relayport %]
>  [% ELSE %]
> -relay_transport = smtp:[% pmg.mail.relay %]:[% pmg.mail.relayport %]
> +relay_transport = [% pmg.mail.protocol %]:[% pmg.mail.relay %]:[% pmg.mail.relayport %]
>  [% END %]
>  [% END %]
>  
> diff --git a/src/templates/main.cf.in.demo b/src/templates/main.cf.in.demo
> index 2c346ec..2c47785 100644
> --- a/src/templates/main.cf.in.demo
> +++ b/src/templates/main.cf.in.demo
> @@ -35,9 +35,9 @@ transport_maps = hash:/etc/pmg/transport
>  
>  [% IF pmg.mail.relay %]
>  [% IF pmg.mail.relaynomx %]
> -relay_transport = smtp:[[% pmg.mail.relay %]]:[% pmg.mail.relayport %]
> +relay_transport = [% pmg.mail.protocol %]:[[% pmg.mail.relay %]]:[% pmg.mail.relayport %]
>  [% ELSE %]
> -relay_transport = smtp:[% pmg.mail.relay %]:[% pmg.mail.relayport %]
> +relay_transport = [% pmg.mail.protocol %]:[% pmg.mail.relay %]:[% pmg.mail.relayport %]
>  [% END %]
>  [% END %]
>  




More information about the pmg-devel mailing list