Subject: [bug#56046] [PATCH] services: mail: add opensmtpd records to enhance opensmtpd-configuration. Version 2

From: Liliana Marie Prikler <[email-masked]>
Date: Thu, 07 Jul 2022 06:25:32 +0200

Am Mittwoch, dem 06.07.2022 um 21:51 +0000 schrieb [email-masked]:
> I do not believe that guile has a file-exists? thunk.  
> I could use (access? file F_OK) every time, but I think
> file-exists? is easier to use.  My two cents.
scheme@(guile-user)> file-exists?
$1 = #<procedure 7fa4d7da6828 at ice-9/boot-9.scm:1971:6 (str)>

> 
> > What is a "listen-on"?
> 
> "listen-on" refers to the "listen on" in smtpd.conf:
> https://man.openbsd.org/smtpd.conf
> 
> lan_addr = "192.168.0.1"
> listen on $lan_addr
> listen on $lan_addr tls auth
Okay, but what would you call that?  An address maybe?

> > > +(define-record-type* <opensmtpd-listen-on-socket-configuration-
> > > configuration>
> > 
> > Again, could this just be <opensmtpd-socket-configuration>?
> 
> I would prefer to have two data types for "listen on" and
> "listen on socket".  "listen on socket" only supports 3 options,
> where "listen on" supports 19.
I am not questioning whether it makes sense to add a configuration
record – it probably does – but whether you're using the best name for
that record.  We are not Java programmers here, a little abstraction
goes a long way.

> From the documentation:
> 
> listen on interface [family] [options]
>     Listen on the interface for incoming connections, using the same
> syntax as ifconfig(8). The interface parameter may also be an
> interface group, an IP address, or a domain name. Listening can
> optionally be restricted to a specific address family, which can be
> either inet4 or inet6. 
> 
> listen on socket [options]
>     Listen for incoming SMTP connections on the Unix domain socket
> /var/run/smtpd.sock. This is done by default, even if the directive
> is absent. 
So you can either have an opensmtp-interface (with family and a bunch
of options) or an opensmtp-socket (with a bunch of options).  Sounds
like a much nicer ontology, doesn't it?

> > > [...]
> > 
> > Too much to check, too little time. Maybe return later.
> 
> To summarize the tasks that you have given me are:
> 
> 1) Write a proper changelog.
> 2) define "string-in-list?" with member? 
>    Are there other procedures that could use this?
> 3) replace [] with ()
> 4) Shorten the sanitize procedure for opensmtpd-option-configuration
5) Review your class names.
I also don't think it makes too much sense to add -configuration for
anything but the top-level configuration record, it just requires you
to type much more configuration than you probably want.

Cheers