Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use UID/GID range that doesn't overlap with the range used by Debian #548

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions internal/users/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,12 @@ func getUIDsOfRunningProcesses(procDir string) (uids map[uint32]struct{}, err er
}

// GenerateID deterministically generates an ID between from the given string, ignoring case. The ID is in the range
// 60000 (the default value of UID_MAX, i.e. the maximum UID for regular users) and MaxInt32 (the maximum for UIDs and
// GIDs on recent Linux versions is MaxUint32, but some software might cast it to int32, so to avoid overflow issues we
// use MaxInt32).
// 65536 (everything below that is either reserved or used for users/groups created via adduser(8), see [1]) to MaxInt32
// (the maximum for UIDs and GIDs on recent Linux versions is MaxUint32, but some software might cast it to int32, so to
// avoid overflow issues we use MaxInt32).
// [1]: https://www.debian.org/doc/debian-policy/ch-opersys.html#uid-and-gid-classes
func GenerateID(str string) int {
const minID = 60000
const minID = 65536
const maxID = math.MaxInt32

str = strings.ToLower(str)
Expand Down
Loading