Crate redox_users

source ·
Expand description

redox-users is designed to be a small, low-ish level interface to system user and group information, as well as user password authentication. It is OS-specific and will break horribly on platforms that are not Redox-OS.

Permissions

Because this is a system level tool dealing with password authentication, programs are often required to run with escalated priveleges. The implementation of the crate is privelege unaware. The only privelege requirements are those laid down by the system administrator over these files:

  • /etc/group
    • Read: Required to access group information
    • Write: Required to change group information
  • /etc/passwd
    • Read: Required to access user information
    • Write: Required to change user information
  • /etc/shadow
    • Read: Required to authenticate users
    • Write: Required to set user passwords

Reimplementation

This crate is designed to be as small as possible without sacrificing critical functionality. The idea is that a small enough redox-users will allow easy re-implementation based on the same flexible API. This would allow more complicated authentication schemes for redox in future without breakage of existing software.

Modules

Structs

  • AllGroups provides (borrowed) access to all groups on the system. Note that this struct implements All for all of its access functions.
  • AllUsers provides (borrowed) access to all the users on the system. Note that this struct implements All for all of its access functions.
  • A generic configuration that allows fine control of an AllUsers or AllGroups.
  • A struct representing a Redox user group. Currently maps to an /etc/group file entry.
  • A builder pattern for adding Groups to AllGroups. Fields are verified when the Group is built, via AllGroups::add_group.
  • A struct representing a Redox user. Currently maps to an entry in the /etc/passwd file.
  • A builder pattern for adding Users to AllUsers. Fields are verified when the group is built via AllUsers::add_user. See the documentation of that function for default values.

Enums

  • Errors that might happen while using this crate

Traits

  • This trait is used to remove repetitive API items from AllGroups and AllUsers. It uses a hidden trait so that the implementations of functions can be implemented at the trait level. Do not try to implement this trait.

Functions

  • Gets the current process effective group ID.
  • Gets the current process effective user ID.
  • Gets the current process real group ID.
  • Gets the current process real user ID.
  • This function is used by UserBuilder and GroupBuilder to determine if a name for a user/group is valid. It is provided for convenience.

Type Aliases