add default shadow entry to default users
This commit is contained in:
parent
32d02dcc81
commit
ed77466bd6
@ -41,6 +41,9 @@ impl User {
|
|||||||
}
|
}
|
||||||
pub fn username(&mut self, name: String) -> &mut Self {
|
pub fn username(&mut self, name: String) -> &mut Self {
|
||||||
self.username = crate::Username { username: name };
|
self.username = crate::Username { username: name };
|
||||||
|
if let crate::Password::Shadow(ref mut s) = self.password {
|
||||||
|
s.set_username(self.username.clone());
|
||||||
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
pub fn disable_password(&mut self) -> &mut Self {
|
pub fn disable_password(&mut self) -> &mut Self {
|
||||||
@ -178,13 +181,18 @@ impl Ord for User {
|
|||||||
|
|
||||||
impl Default for User {
|
impl Default for User {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
let username = passwd_fields::Username {
|
||||||
|
username: "defaultusername".to_owned(),
|
||||||
|
};
|
||||||
|
let line = "defaultusername:!!:0:0:99999:7:::";
|
||||||
|
let password = passwd_fields::Password::Shadow(
|
||||||
|
shadow_fields::Shadow::new_from_string(line.to_owned(), u32::MAX).unwrap(),
|
||||||
|
);
|
||||||
Self {
|
Self {
|
||||||
source: "".to_owned(),
|
source: "".to_owned(),
|
||||||
pos: u32::MAX,
|
pos: u32::MAX,
|
||||||
username: crate::Username {
|
username,
|
||||||
username: "defaultusername".to_owned(),
|
password,
|
||||||
},
|
|
||||||
password: crate::Password::Disabled,
|
|
||||||
uid: crate::Uid { uid: 1001 },
|
uid: crate::Uid { uid: 1001 },
|
||||||
gid: crate::Gid { gid: 1001 },
|
gid: crate::Gid { gid: 1001 },
|
||||||
gecos: crate::Gecos::Simple {
|
gecos: crate::Gecos::Simple {
|
||||||
|
Loading…
Reference in New Issue
Block a user