guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/06: services: opensmtpd: Use 'match-record' instead of 'match'.


From: guix-commits
Subject: 04/06: services: opensmtpd: Use 'match-record' instead of 'match'.
Date: Tue, 20 Dec 2022 11:13:25 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 3011e8ae11f6fce87ee5c7f9c702f9d2e10a0e54
Author: Bruno Victal <mirai@makinata.eu>
AuthorDate: Tue Dec 6 16:52:09 2022 +0000

    services: opensmtpd: Use 'match-record' instead of 'match'.
    
    * gnu/services/mail.scm (opensmtpd-shepherd-service)
    (opensmtpd-activation)
    (opensmtpd-set-gids): Use 'match-record' instead of 'match'.
    
    Signed-off-by: Ludovic Court├Ęs <ludo@gnu.org>
---
 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 @@ action outbound relay
 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 @@ match from local for any action outbound
          (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]