gnu: emacs-helm: Update to 3.8.7.
[jackhill/guix/guix.git] / gnu / system / setuid.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu system setuid)
20 #:use-module (guix records)
21 #:export (setuid-program
22 setuid-program?
23 setuid-program-program
24 setuid-program-setuid?
25 setuid-program-setgid?
26 setuid-program-user
27 setuid-program-group
28
29 file-like->setuid-program))
30
31 ;;; Commentary:
32 ;;;
33 ;;; Data structures representing setuid/setgid programs. This is meant to be
34 ;;; used both on the host side and at run time--e.g., in activation snippets.
35 ;;;
36 ;;; Code:
37
38 (define-record-type* <setuid-program>
39 setuid-program make-setuid-program
40 setuid-program?
41 ;; Path to program to link with setuid permissions
42 (program setuid-program-program) ;file-like
43 ;; Whether to set user setuid bit
44 (setuid? setuid-program-setuid? ;boolean
45 (default #t))
46 ;; Whether to set group setgid bit
47 (setgid? setuid-program-setgid? ;boolean
48 (default #f))
49 ;; The user this should be set to (defaults to root)
50 (user setuid-program-user ;integer or string
51 (default 0))
52 ;; Group we want to set this to (defaults to root)
53 (group setuid-program-group ;integer or string
54 (default 0)))
55
56 (define (file-like->setuid-program program)
57 (setuid-program (program program)))