Repository navigation
Conversation
The running system's users and groups were looked up seven ways: oxyos-auth through NSS (getpwnam_r, getpwuid_r, getgrouplist), and by hand from /etc/passwd and /etc/group in the accounts' service (its lookups, GECOS and administrators), accountd (the login program's user), the install service (a peer's user), oxyos-apps (session_user), oxyos-networks (the session's user) and Activity Monitor (process owners). Users from another NSS source (systemd's, a directory's) were seen by some and not others. oxyos-users (T1, libc only) is the one owner: user_named, user_by_uid, group_members and group_list, each asked when needed, a larger buffer tried when an entry does not fit. Every lookup of the running system the audit listed goes through it. The backup service's (user_of, administrator, the manifest's accounts, migrate's login_user) still read /etc/passwd and /etc/group through its options and are left for their own change. Another root's files stay files, named as such: SystemUsers::with_prefix (the tests' roots, a backup restored with --prefix) and passwd_entry/passwd_gecos/group_members in oxyos_account::users; installd's --passwd FILE (the scenarios' own passwd), now an option whose absence means the system's; Activity Monitor's test machines (Procfs's passwd, now None for the system's). Activity Monitor asks NSS per user, once, and again for a user it has none for at most once a sample, so every user of a first sample is named (its file was read whole). Tests: every entry of /etc/passwd and /etc/group found through NSS as the file says (first line for a name or uid listed twice, GECOS commas and all), root, this process's user, unknown names and uids; Activity Monitor names root and this user in one sample. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It adapts the C library's account database (NSS) and depends on libc only; its users are system, service and program crates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One owner for user-database lookups (code audit item 3, "one owner per concept"):
oxyos-users, NSS only.Why
The running system's users were looked up in seven places. Only
oxyos-authused NSS. The others read/etc/passwdand/etc/groupby hand:oxyos-authUser::named,user_name(uid),group_listoxyos-usersoxyos-accountSystemUsers(lookup, GECOS, administrators)--prefixrootoxyos-accountdenrollers(the login program's user)/etc/passwdoxyos-installaccounts::Passwd(a peer's user)/etc/passwd--passwd FILEstill reads that fileoxyos-appssession_user/etc/passwdoxyos-networksnm::user_name/etc/passwd(after$USER)$USER)oxyos-activityUsers(process owners)/etc/passwdA user from another NSS source (systemd's
DynamicUsers,homed, a directory) was visible to auth/PAM/logind but not to the others, so programs could disagree about who a uid was.What
crates/oxyos-users(T1, depends onlibconly).user_named,user_by_uid(User: name, uid, gid, gecos, home, shell),group_members(getgrnam_r'sgr_mem) andgroup_list(getgrouplist, moved from auth). Every call reads the database when it is made. If an entry does not fit the buffer (ERANGE), the call retries with a larger one, from 16 KiB up to 1 MiB. Before, auth failed on any entry over 16 KiB.SystemUsers::with_prefix, pluspasswd_entry/passwd_gecos/group_membersinoxyos_account::users. These cover the tests' roots and a backup restored onto a target withuseradd --prefix.--passwd FILE, the scenario gate's own passwd (regress.py).Passwdis nowSystem | File(path), and the option is unset by default.Procfs::passwdisOption<PathBuf>,Nonemeaning the system's.oxyos-backup's service (user_of,administrator, the manifest's accounts) andmigrate::login_userstill read/etc/passwdand/etc/groupthrough their options. Other forks are changing that crate right now, so that is left for a follow-up.Behaviour
On a machine whose NSS reads
filesfirst, which includes the image (passwd: files systemd), CI and developers' machines, every answer is the same. The new tests prove it:/etc/passwdis found by name and by uid exactly as the file has it. A name or uid listed twice returns its first line, as the oldfinddid. GECOS fields come back whole, commas included./etc/groupcomes back with the members the file lists.Differences:
Checks
On seldon:
cargo fmt --check,cargo clippy --workspace --all-targets --locked -D warnings,check-native-boundary.py,cargo test --workspace --locked.Layering:
oxyos-usersis T1 (an OS adapter). Ifci/crate-layeringlands first, it needs classifying there.🤖 Generated with Claude Code