GetRootlessEUID returns the UID of the current user (in the parent userNS, if any) Podman and similar software, in “rootless” configuration, when run as a non-root user, very early switches to a user namespace, where Geteuid() == 0 (but does not switch to a limited mount namespace); so, code relyin
()
| 16 | // If Podman is setting up such a user namespace, it records the original UID in an |
| 17 | // environment variable, allowing us to make choices based on the actual user’s identity. |
| 18 | func GetRootlessEUID() int { |
| 19 | euidEnv := os.Getenv("_CONTAINERS_ROOTLESS_UID") |
| 20 | if euidEnv != "" { |
| 21 | euid, _ := strconv.Atoi(euidEnv) |
| 22 | return euid |
| 23 | } |
| 24 | return os.Geteuid() |
| 25 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…