blob: 68ccc32ec3ac8be0eec61d50730d5fe65a975752 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#[cfg(unix)]
mod unix;
#[cfg(unix)]
pub use unix::*;
#[cfg(not(unix))]
mod windows;
#[cfg(not(unix))]
pub use windows::*;
pub const ROOT_USER: &str = "root";
pub const TEDGE_USER: &str = "tedge";
pub const BROKER_USER: &str = "mosquitto";
#[allow(dead_code)] // These errors are only raised from unix
#[derive(thiserror::Error, Debug)]
pub enum UserSwitchError {
#[error("Tried to become user, but it did not exist: {name}")]
UnknownUser { name: String },
#[error("Tried to become group, but it did not exist: {name}")]
UnknownGroup { name: String },
#[error(transparent)]
NotAuthorized(#[from] std::io::Error),
}
|