MCPcopy
hub / github.com/apptainer/apptainer / IsUIDMapped

Function IsUIDMapped

internal/pkg/fakeroot/fakeroot.go:392–411  ·  view source on GitHub ↗

IsUIDMapped returns true if the given uid is mapped in SubUIDFile and otherwise it returns false

(uid uint32)

Source from the content-addressed store, hash-verified

390// IsUIDMapped returns true if the given uid is mapped in SubUIDFile
391// and otherwise it returns false
392func IsUIDMapped(uid uint32) bool {
393 config, err := GetConfig(SubUIDFile, false, getPwNam)
394 if err != nil {
395 return false
396 }
397 defer config.Close()
398
399 userinfo, err := getPwUID(uid)
400 if err != nil {
401 sylog.Fatalf("could not retrieve user with UID %d: %s", uid, err)
402 }
403 e, err := config.GetUserEntry(userinfo.Name)
404 if err != nil && !errors.Is(err, errRangeTooLow) {
405 return false
406 }
407 if e != nil && e.disabled {
408 return false
409 }
410 return true
411}

Callers 3

ExecMethod · 0.92
OverlayCreateFunction · 0.92
fakerootExecFunction · 0.92

Calls 4

FatalfFunction · 0.92
GetUserEntryMethod · 0.80
GetConfigFunction · 0.70
CloseMethod · 0.45

Tested by

no test coverage detected