authentricity/internal/hostagent/priv.go
2022-07-11 21:49:26 +00:00

16 lines
293 B
Go

package hostagent
import (
"github.com/varlink/go/varlink"
"go.e43.eu/authentricity/internal/peercred"
)
func AllowPrivileged(conn varlink.ReadWriterContext, uid uint32) bool {
creds := peercred.Get(conn)
if creds == nil {
return false
}
return creds.Uid == 0 || creds.Uid == uid
}