summaryrefslogtreecommitdiffhomepage
path: root/oxish/src/authentication.rs
diff options
context:
space:
mode:
Diffstat (limited to 'oxish/src/authentication.rs')
-rw-r--r--oxish/src/authentication.rs30
1 files changed, 11 insertions, 19 deletions
diff --git a/oxish/src/authentication.rs b/oxish/src/authentication.rs
index 452b2b2..e534429 100644
--- a/oxish/src/authentication.rs
+++ b/oxish/src/authentication.rs
@@ -327,13 +327,19 @@ struct CachedUser {
}
/// User data as retrieved from the system database
+#[non_exhaustive]
#[derive(Clone, Debug)]
pub struct User {
- pub(crate) name: Username,
- pub(crate) id: u32,
- pub(crate) gid: u32,
- pub(crate) home_dir: PathBuf,
- pub(crate) shell: PathBuf,
+ /// The user's name
+ pub name: Username,
+ /// The user's UID
+ pub id: u32,
+ /// The user's GID
+ pub gid: u32,
+ /// The user's home directory
+ pub home_dir: PathBuf,
+ /// The user's shell
+ pub shell: PathBuf,
}
impl User {
@@ -435,20 +441,6 @@ impl User {
})
}
- /// Create a new user with the given name and home directory
- ///
- /// This is primarily intended for testing.
- #[cfg(test)]
- pub(crate) fn new(name: String, id: u32, gid: u32, home_dir: PathBuf) -> Result<Self, Error> {
- Ok(Self {
- name: Username::try_from(name)?,
- id,
- gid,
- home_dir,
- shell: PathBuf::from("/bin/sh"),
- })
- }
-
const FAKE_HOME: *const c_char = c"/var/empty".as_ptr().cast::<c_char>();
const DEFAULT_SHELL: *const c_char = c"/bin/sh".as_ptr().cast::<c_char>();
}