1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-28 12:01:49 +02:00

build: Rename activate-setuid-programs.

* gnu/build/activation.scm (activate-setuid-programs): Rename this…
(activate-privileged-programs): …to this.
Operate on a list of <privileged-program> records.
* gnu/services.scm (setuid-program->activation-gexp): Adjust caller.
This commit is contained in:
Tobias Geerinckx-Rice
2022-10-23 02:00:00 +02:00
parent 9099f8bdcc
commit f3b84be52d
2 changed files with 13 additions and 13 deletions
+12 -12
View File
@@ -28,7 +28,7 @@
(define-module (gnu build activation) (define-module (gnu build activation)
#:use-module (gnu system accounts) #:use-module (gnu system accounts)
#:use-module (gnu system setuid) #:use-module (gnu system privilege)
#:use-module (gnu build accounts) #:use-module (gnu build accounts)
#:use-module (gnu build linux-boot) #:use-module (gnu build linux-boot)
#:use-module (guix build utils) #:use-module (guix build utils)
@@ -42,7 +42,7 @@
#:export (activate-users+groups #:export (activate-users+groups
activate-user-home activate-user-home
activate-etc activate-etc
activate-setuid-programs activate-privileged-programs
activate-special-files activate-special-files
activate-modprobe activate-modprobe
activate-firmware activate-firmware
@@ -288,8 +288,8 @@ they already exist."
;; Place where privileged copies of programs are stored. ;; Place where privileged copies of programs are stored.
"/run/privileged/bin") "/run/privileged/bin")
(define (activate-setuid-programs programs) (define (activate-privileged-programs programs)
"Turn PROGRAMS, a list of file setuid-programs records, into privileged "Turn PROGRAMS, a list of file privileged-programs records, into privileged
copies stored under %PRIVILEGED-PROGRAM-DIRECTORY." copies stored under %PRIVILEGED-PROGRAM-DIRECTORY."
(define (ensure-empty-directory directory) (define (ensure-empty-directory directory)
(if (file-exists? directory) (if (file-exists? directory)
@@ -326,11 +326,11 @@ copies stored under %PRIVILEGED-PROGRAM-DIRECTORY."
(for-each (lambda (program) (for-each (lambda (program)
(catch 'system-error (catch 'system-error
(lambda () (lambda ()
(let* ((program-name (setuid-program-program program)) (let* ((program-name (privileged-program-program program))
(setuid? (setuid-program-setuid? program)) (setuid? (privileged-program-setuid? program))
(setgid? (setuid-program-setgid? program)) (setgid? (privileged-program-setgid? program))
(user (setuid-program-user program)) (user (privileged-program-user program))
(group (setuid-program-group program)) (group (privileged-program-group program))
(uid (match user (uid (match user
((? string?) (passwd:uid (getpwnam user))) ((? string?) (passwd:uid (getpwnam user)))
((? integer?) user))) ((? integer?) user)))
@@ -340,13 +340,13 @@ copies stored under %PRIVILEGED-PROGRAM-DIRECTORY."
(make-privileged-program program-name setuid? setgid? uid gid) (make-privileged-program program-name setuid? setgid? uid gid)
(make-deprecated-wrapper program-name))) (make-deprecated-wrapper program-name)))
(lambda args (lambda args
;; If we fail to create a setuid program, better keep going ;; If we fail to create a privileged program, better keep going
;; so that we don't leave %PRIVILEGED-PROGRAM-DIRECTORY empty ;; so that we don't leave %PRIVILEGED-PROGRAM-DIRECTORY empty
;; or half-populated. This can happen if PROGRAMS contains ;; or half-populated. This can happen if PROGRAMS contains
;; incorrect file names: <https://bugs.gnu.org/38800>. ;; incorrect file names: <https://bugs.gnu.org/38800>.
(format (current-error-port) (format (current-error-port)
"warning: failed to make ~s setuid/setgid: ~a~%" "warning: failed to privilege ~s: ~a~%"
(setuid-program-program program) (privileged-program-program program)
(strerror (system-error-errno args)))))) (strerror (system-error-errno args))))))
programs)) programs))
+1 -1
View File
@@ -911,7 +911,7 @@ FILES must be a list of name/file-like object pairs."
#~(begin #~(begin
(use-modules (gnu system setuid)) (use-modules (gnu system setuid))
(activate-setuid-programs (list #$@programs)))))) (activate-privileged-programs (list #$@programs))))))
(define setuid-program-service-type (define setuid-program-service-type
(service-type (name 'setuid-program) (service-type (name 'setuid-program)