From: mirai@makinata.eu
To: 59860@debbugs.gnu.org
Cc: Bruno Victal <mirai@makinata.eu>
Subject: [bug#59860] [PATCH 1/2] services: opensmtpd: Use 'match-record' instead of 'match'.
Date: Tue, 6 Dec 2022 16:52:09 +0000 [thread overview]
Message-ID: <7d02df3781fe7d6259797598ffe9e36020ad4200.1670345034.git.mirai@makinata.eu> (raw)
In-Reply-To: <cover.1670345034.git.mirai@makinata.eu>
From: Bruno Victal <mirai@makinata.eu>
* gnu/services/mail.scm (opensmtpd-shepherd-service)
(opensmtpd-activation)
(opensmtpd-set-gids): Use 'match-record' instead of 'match'.
---
gnu/services/mail.scm | 117 ++++++++++++++++++++----------------------
1 file changed, 57 insertions(+), 60 deletions(-)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 2dc235a585..dc4a7986b6 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1666,18 +1666,17 @@ (define %default-opensmtpd-config-file
match from local for any action outbound
"))
-(define opensmtpd-shepherd-service
- (match-lambda
- (($ <opensmtpd-configuration> package config-file)
- (list (shepherd-service
- (provision '(smtpd))
- (requirement '(loopback))
- (documentation "Run the OpenSMTPD daemon.")
- (start (let ((smtpd (file-append package "/sbin/smtpd")))
- #~(make-forkexec-constructor
- (list #$smtpd "-f" #$config-file)
- #:pid-file "/var/run/smtpd.pid")))
- (stop #~(make-kill-destructor)))))))
+(define (opensmtpd-shepherd-service config)
+ (match-record config <opensmtpd-configuration> (package config-file)
+ (list (shepherd-service
+ (provision '(smtpd))
+ (requirement '(loopback))
+ (documentation "Run the OpenSMTPD daemon.")
+ (start (let ((smtpd (file-append package "/sbin/smtpd")))
+ #~(make-forkexec-constructor
+ (list #$smtpd "-f" #$config-file)
+ #:pid-file "/var/run/smtpd.pid")))
+ (stop #~(make-kill-destructor))))))
(define %opensmtpd-accounts
(list (user-group
@@ -1698,58 +1697,56 @@ (define %opensmtpd-accounts
(home-directory "/var/empty")
(shell (file-append shadow "/sbin/nologin")))))
-(define opensmtpd-activation
- (match-lambda
- (($ <opensmtpd-configuration> package config-file)
- (let ((smtpd (file-append package "/sbin/smtpd")))
- #~(begin
- (use-modules (guix build utils))
- ;; Create mbox and spool directories.
- (mkdir-p "/var/mail")
- (mkdir-p "/var/spool/smtpd")
- (chmod "/var/spool/smtpd" #o711)
- (mkdir-p "/var/spool/mail")
- (chmod "/var/spool/mail" #o711))))))
+(define (opensmtpd-activation config)
+ (match-record config <opensmtpd-configuration> (package config-file)
+ (let ((smtpd (file-append package "/sbin/smtpd")))
+ #~(begin
+ (use-modules (guix build utils))
+ ;; Create mbox and spool directories.
+ (mkdir-p "/var/mail")
+ (mkdir-p "/var/spool/smtpd")
+ (chmod "/var/spool/smtpd" #o711)
+ (mkdir-p "/var/spool/mail")
+ (chmod "/var/spool/mail" #o711)))))
(define %opensmtpd-pam-services
(list (unix-pam-service "smtpd")))
-(define opensmtpd-set-gids
- (match-lambda
- (($ <opensmtpd-configuration> package config-file set-gids?)
- (if set-gids?
- (list
- (setuid-program
- (program (file-append package "/sbin/smtpctl"))
- (setuid? #false)
- (setgid? #true)
- (group "smtpq"))
- (setuid-program
- (program (file-append package "/sbin/sendmail"))
- (setuid? #false)
- (setgid? #true)
- (group "smtpq"))
- (setuid-program
- (program (file-append package "/sbin/send-mail"))
- (setuid? #false)
- (setgid? #true)
- (group "smtpq"))
- (setuid-program
- (program (file-append package "/sbin/makemap"))
- (setuid? #false)
- (setgid? #true)
- (group "smtpq"))
- (setuid-program
- (program (file-append package "/sbin/mailq"))
- (setuid? #false)
- (setgid? #true)
- (group "smtpq"))
- (setuid-program
- (program (file-append package "/sbin/newaliases"))
- (setuid? #false)
- (setgid? #true)
- (group "smtpq")))
- '()))))
+(define (opensmtpd-set-gids config)
+ (match-record config <opensmtpd-configuration> (package config-file setgid-commands?)
+ (if setgid-commands?
+ (list
+ (setuid-program
+ (program (file-append package "/sbin/smtpctl"))
+ (setuid? #false)
+ (setgid? #true)
+ (group "smtpq"))
+ (setuid-program
+ (program (file-append package "/sbin/sendmail"))
+ (setuid? #false)
+ (setgid? #true)
+ (group "smtpq"))
+ (setuid-program
+ (program (file-append package "/sbin/send-mail"))
+ (setuid? #false)
+ (setgid? #true)
+ (group "smtpq"))
+ (setuid-program
+ (program (file-append package "/sbin/makemap"))
+ (setuid? #false)
+ (setgid? #true)
+ (group "smtpq"))
+ (setuid-program
+ (program (file-append package "/sbin/mailq"))
+ (setuid? #false)
+ (setgid? #true)
+ (group "smtpq"))
+ (setuid-program
+ (program (file-append package "/sbin/newaliases"))
+ (setuid? #false)
+ (setgid? #true)
+ (group "smtpq")))
+ '())))
(define opensmtpd-service-type
(service-type
--
2.38.1
next prev parent reply other threads:[~2022-12-06 16:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 16:50 [bug#59860] [PATCH 0/2] Add shepherd-requirement field to OpenSMTPD mirai
2022-12-06 16:52 ` mirai [this message]
2022-12-06 16:52 ` [bug#59860] [PATCH 2/2] services: opensmtpd: Add shepherd-requirement field mirai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7d02df3781fe7d6259797598ffe9e36020ad4200.1670345034.git.mirai@makinata.eu \
--to=mirai@makinata.eu \
--cc=59860@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).