def CapExec.flags.go

bend-osdev-caps@0.1.0.0 · exec.bend:105

import bend-osdev-caps@0.1.0.0/exec.bend as Exec
import Base
import bend-osdev-caps@0.1.0.0/caps.bend as C

105# "Capabilities and execution of programs by root": with r0 (real UID 0)
106# and e0 (effective UID 0, after the set-user-ID bit), unless SECBIT_NOROOT:
107#   (1) the file's inheritable and permitted sets are all ones (but a
108#       set-user-ID-root program with capabilities run by a non-root real
109#       UID keeps its own);
110#   (2) if e0, the file effective bit is one.
111def CapExec.flags.go(noroot: Bool, r0: Bool, e0: Bool, priv: Bool, fc: Maybe<&2, C.CapFileSets>) -> CapExecFlags:
112  match noroot:
113    case True{}:
114      CapExec.flags.file(priv, False{}, fc)
115    case False{}:
116      match r0:
117        case True{}:
118          CapExecFlags{priv, Bool.or(e0, CapExec.fc_effective(fc)), C.CapSet.full(), C.CapSet.full()}
119        case False{}:
120          match e0:
121            case True{}:
122              CapExec.flags.suid_root(priv, fc)
123            case False{}:
124              CapExec.flags.file(priv, False{}, fc)

Uses (9)

Used by (3)