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>
This commit is contained in:
		
							parent
							
								
									2880dc3046
								
							
						
					
					
						commit
						3011e8ae11
					
				
					 1 changed files with 57 additions and 60 deletions
				
			
		| 
						 | 
					@ -1666,18 +1666,17 @@ action outbound relay
 | 
				
			||||||
match from local for any action outbound
 | 
					match from local for any action outbound
 | 
				
			||||||
"))
 | 
					"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define opensmtpd-shepherd-service
 | 
					(define (opensmtpd-shepherd-service config)
 | 
				
			||||||
  (match-lambda
 | 
					  (match-record config <opensmtpd-configuration> (package config-file)
 | 
				
			||||||
    (($ <opensmtpd-configuration> package config-file)
 | 
					    (list (shepherd-service
 | 
				
			||||||
     (list (shepherd-service
 | 
					           (provision '(smtpd))
 | 
				
			||||||
            (provision '(smtpd))
 | 
					           (requirement '(loopback))
 | 
				
			||||||
            (requirement '(loopback))
 | 
					           (documentation "Run the OpenSMTPD daemon.")
 | 
				
			||||||
            (documentation "Run the OpenSMTPD daemon.")
 | 
					           (start (let ((smtpd (file-append package "/sbin/smtpd")))
 | 
				
			||||||
            (start (let ((smtpd (file-append package "/sbin/smtpd")))
 | 
					                    #~(make-forkexec-constructor
 | 
				
			||||||
                     #~(make-forkexec-constructor
 | 
					                       (list #$smtpd "-f" #$config-file)
 | 
				
			||||||
                        (list #$smtpd "-f" #$config-file)
 | 
					                       #:pid-file "/var/run/smtpd.pid")))
 | 
				
			||||||
                        #:pid-file "/var/run/smtpd.pid")))
 | 
					           (stop #~(make-kill-destructor))))))
 | 
				
			||||||
            (stop #~(make-kill-destructor)))))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %opensmtpd-accounts
 | 
					(define %opensmtpd-accounts
 | 
				
			||||||
  (list (user-group
 | 
					  (list (user-group
 | 
				
			||||||
| 
						 | 
					@ -1698,58 +1697,56 @@ match from local for any action outbound
 | 
				
			||||||
         (home-directory "/var/empty")
 | 
					         (home-directory "/var/empty")
 | 
				
			||||||
         (shell (file-append shadow "/sbin/nologin")))))
 | 
					         (shell (file-append shadow "/sbin/nologin")))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define opensmtpd-activation
 | 
					(define (opensmtpd-activation config)
 | 
				
			||||||
  (match-lambda
 | 
					  (match-record config <opensmtpd-configuration> (package config-file)
 | 
				
			||||||
    (($ <opensmtpd-configuration> package config-file)
 | 
					    (let ((smtpd (file-append package "/sbin/smtpd")))
 | 
				
			||||||
     (let ((smtpd (file-append package "/sbin/smtpd")))
 | 
					      #~(begin
 | 
				
			||||||
       #~(begin
 | 
					          (use-modules (guix build utils))
 | 
				
			||||||
           (use-modules (guix build utils))
 | 
					          ;; Create mbox and spool directories.
 | 
				
			||||||
           ;; Create mbox and spool directories.
 | 
					          (mkdir-p "/var/mail")
 | 
				
			||||||
           (mkdir-p "/var/mail")
 | 
					          (mkdir-p "/var/spool/smtpd")
 | 
				
			||||||
           (mkdir-p "/var/spool/smtpd")
 | 
					          (chmod "/var/spool/smtpd" #o711)
 | 
				
			||||||
           (chmod "/var/spool/smtpd" #o711)
 | 
					          (mkdir-p "/var/spool/mail")
 | 
				
			||||||
           (mkdir-p "/var/spool/mail")
 | 
					          (chmod "/var/spool/mail" #o711)))))
 | 
				
			||||||
           (chmod "/var/spool/mail" #o711))))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define %opensmtpd-pam-services
 | 
					(define %opensmtpd-pam-services
 | 
				
			||||||
  (list (unix-pam-service "smtpd")))
 | 
					  (list (unix-pam-service "smtpd")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define opensmtpd-set-gids
 | 
					(define (opensmtpd-set-gids config)
 | 
				
			||||||
  (match-lambda
 | 
					  (match-record config <opensmtpd-configuration> (package config-file setgid-commands?)
 | 
				
			||||||
    (($ <opensmtpd-configuration> package config-file set-gids?)
 | 
					    (if setgid-commands?
 | 
				
			||||||
     (if set-gids?
 | 
					        (list
 | 
				
			||||||
         (list
 | 
					         (setuid-program
 | 
				
			||||||
          (setuid-program
 | 
					          (program (file-append package "/sbin/smtpctl"))
 | 
				
			||||||
           (program (file-append package "/sbin/smtpctl"))
 | 
					          (setuid? #false)
 | 
				
			||||||
           (setuid? #false)
 | 
					          (setgid? #true)
 | 
				
			||||||
           (setgid? #true)
 | 
					          (group "smtpq"))
 | 
				
			||||||
           (group "smtpq"))
 | 
					         (setuid-program
 | 
				
			||||||
          (setuid-program
 | 
					          (program (file-append package "/sbin/sendmail"))
 | 
				
			||||||
           (program (file-append package "/sbin/sendmail"))
 | 
					          (setuid? #false)
 | 
				
			||||||
           (setuid? #false)
 | 
					          (setgid? #true)
 | 
				
			||||||
           (setgid? #true)
 | 
					          (group "smtpq"))
 | 
				
			||||||
           (group "smtpq"))
 | 
					         (setuid-program
 | 
				
			||||||
          (setuid-program
 | 
					          (program (file-append package "/sbin/send-mail"))
 | 
				
			||||||
           (program (file-append package "/sbin/send-mail"))
 | 
					          (setuid? #false)
 | 
				
			||||||
           (setuid? #false)
 | 
					          (setgid? #true)
 | 
				
			||||||
           (setgid? #true)
 | 
					          (group "smtpq"))
 | 
				
			||||||
           (group "smtpq"))
 | 
					         (setuid-program
 | 
				
			||||||
          (setuid-program
 | 
					          (program (file-append package "/sbin/makemap"))
 | 
				
			||||||
           (program (file-append package "/sbin/makemap"))
 | 
					          (setuid? #false)
 | 
				
			||||||
           (setuid? #false)
 | 
					          (setgid? #true)
 | 
				
			||||||
           (setgid? #true)
 | 
					          (group "smtpq"))
 | 
				
			||||||
           (group "smtpq"))
 | 
					         (setuid-program
 | 
				
			||||||
          (setuid-program
 | 
					          (program (file-append package "/sbin/mailq"))
 | 
				
			||||||
           (program (file-append package "/sbin/mailq"))
 | 
					          (setuid? #false)
 | 
				
			||||||
           (setuid? #false)
 | 
					          (setgid? #true)
 | 
				
			||||||
           (setgid? #true)
 | 
					          (group "smtpq"))
 | 
				
			||||||
           (group "smtpq"))
 | 
					         (setuid-program
 | 
				
			||||||
          (setuid-program
 | 
					          (program (file-append package "/sbin/newaliases"))
 | 
				
			||||||
           (program (file-append package "/sbin/newaliases"))
 | 
					          (setuid? #false)
 | 
				
			||||||
           (setuid? #false)
 | 
					          (setgid? #true)
 | 
				
			||||||
           (setgid? #true)
 | 
					          (group "smtpq")))
 | 
				
			||||||
           (group "smtpq")))
 | 
					        '())))
 | 
				
			||||||
         '()))))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define opensmtpd-service-type
 | 
					(define opensmtpd-service-type
 | 
				
			||||||
  (service-type
 | 
					  (service-type
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue