Lines Matching refs:info

2     check::info::{GAddInfo, GDelInfo, GModInfo, PasswdInfo, UAddInfo, UDelInfo, UModInfo},
69 pub fn execute(info: UAddInfo) { in execute()
71 let home = info.home_dir.clone(); in execute()
80 Self::write_passwd_file(&info); in execute()
81 Self::write_shadow_file(&info); in execute()
82 Self::write_group_file(&info); in execute()
83 Self::write_gshadow_file(&info); in execute()
87 fn write_passwd_file(info: &UAddInfo) { in write_passwd_file()
88 let userinfo: String = info.clone().into(); in write_passwd_file()
98 fn write_group_file(info: &UAddInfo) { in write_group_file()
99 if info.group == info.username { in write_group_file()
113 if field[0].eq(info.group.as_str()) && !users.contains(&info.username.as_str()) { in write_group_file()
114 users.push(info.username.as_str()); in write_group_file()
129 fn write_shadow_file(info: &UAddInfo) { in write_shadow_file()
130 let data = format!("{}::::::::\n", info.username,); in write_shadow_file()
140 fn write_gshadow_file(info: &UAddInfo) { in write_gshadow_file()
141 if info.group == info.username { in write_gshadow_file()
155 if field[0].eq(info.group.as_str()) && !users.contains(&info.username.as_str()) { in write_gshadow_file()
156 users.push(info.username.as_str()); in write_gshadow_file()
184 pub fn execute(info: UDelInfo) { in execute()
186 if let Some(home) = info.home.clone() { in execute()
190 Self::update_passwd_file(&info); in execute()
191 Self::update_shadow_file(&info); in execute()
192 Self::update_group_file(&info); in execute()
193 Self::update_gshadow_file(&info); in execute()
197 fn update_passwd_file(info: &UDelInfo) { in update_passwd_file()
205 field[0] != info.username.as_str() in update_passwd_file()
217 fn update_group_file(info: &UDelInfo) { in update_group_file()
224 if users.contains(&info.username.as_str()) { in update_group_file()
229 .position(|&x| x == info.username.as_str()) in update_group_file()
247 fn update_shadow_file(info: &UDelInfo) { in update_shadow_file()
253 .filter(|&line| !line.contains(&info.username)) in update_shadow_file()
264 fn update_gshadow_file(info: &UDelInfo) { in update_gshadow_file()
271 if users.contains(&info.username.as_str()) { in update_gshadow_file()
276 .position(|&x| x == info.username.as_str()) in update_gshadow_file()
308 pub fn execute(mut info: UModInfo) { in execute()
310 if let Some(new_home) = &info.new_home { in execute()
320 Self::update_passwd_file(&info); in execute()
321 Self::update_shadow_file(&info); in execute()
322 Self::update_group_file(&mut info); in execute()
323 Self::update_gshadow_file(&info); in execute()
327 fn update_passwd_file(info: &UModInfo) { in update_passwd_file()
333 if fields[0] == info.username { in update_passwd_file()
334 if let Some(new_username) = &info.new_name { in update_passwd_file()
337 if let Some(new_uid) = &info.new_uid { in update_passwd_file()
340 if let Some(new_gid) = &info.new_gid { in update_passwd_file()
343 if let Some(new_comment) = &info.new_comment { in update_passwd_file()
346 if let Some(new_home) = &info.new_home { in update_passwd_file()
349 if let Some(new_shell) = &info.new_shell { in update_passwd_file()
365 fn update_group_file(info: &mut UModInfo) { in update_group_file()
366 let mut name = info.username.clone(); in update_group_file()
367 if let Some(new_name) = &info.new_name { in update_group_file()
380 if let Some(idx) = users.iter().position(|&r| r == info.username) { in update_group_file()
381 if let Some(gid) = &info.new_gid { in update_group_file()
386 info.new_group = Some(fields[0].to_string()) in update_group_file()
394 if let Some(groups) = &info.groups { in update_group_file()
412 fn update_shadow_file(info: &UModInfo) { in update_shadow_file()
413 if let Some(new_name) = &info.new_name { in update_shadow_file()
419 if fields[0] == info.username { in update_shadow_file()
435 fn update_gshadow_file(info: &UModInfo) { in update_gshadow_file()
436 let mut name = info.username.clone(); in update_gshadow_file()
437 if let Some(new_name) = &info.new_name { in update_gshadow_file()
450 if let Some(idx) = users.iter().position(|&r| r == info.username) { in update_gshadow_file()
451 if let Some(group) = &info.new_group { in update_gshadow_file()
463 if let Some(groups) = &info.groups { in update_gshadow_file()
499 pub fn execute(info: PasswdInfo) { in execute()
500 Self::update_passwd_file(&info); in execute()
501 Self::update_shadow_file(&info); in execute()
505 fn update_passwd_file(info: &PasswdInfo) { in update_passwd_file()
511 if field[0] == info.username { in update_passwd_file()
512 if info.new_password.is_empty() { in update_passwd_file()
528 fn update_shadow_file(info: &PasswdInfo) { in update_shadow_file()
534 if field[0] == info.username { in update_shadow_file()
535 field[1] = info.new_password.as_str(); in update_shadow_file()
555 pub fn execute(info: GAddInfo) { in execute()
556 Self::write_group_file(&info); in execute()
557 Self::write_gshadow_file(&info); in execute()
561 fn write_group_file(info: &GAddInfo) { in write_group_file()
566 .write_all(info.to_string_group().as_bytes()) in write_group_file()
571 fn write_gshadow_file(info: &GAddInfo) { in write_gshadow_file()
576 .write_all(info.to_string_gshadow().as_bytes()) in write_gshadow_file()
589 pub fn execute(info: GDelInfo) { in execute()
590 Self::update_group_file(&info); in execute()
591 Self::update_gshadow_file(&info); in execute()
595 pub fn update_group_file(info: &GDelInfo) { in update_group_file()
601 if field[0] != info.groupname { in update_group_file()
613 pub fn update_gshadow_file(info: &GDelInfo) { in update_gshadow_file()
619 if field[0] != info.groupname { in update_gshadow_file()
645 pub fn execute(info: GModInfo) { in execute()
646 Self::update_passwd_file(&info); in execute()
647 Self::update_group_file(&info); in execute()
648 Self::update_gshadow_file(&info); in execute()
652 fn update_group_file(info: &GModInfo) { in update_group_file()
658 if field[0] == info.groupname { in update_group_file()
659 if let Some(new_groupname) = &info.new_groupname { in update_group_file()
662 if let Some(new_gid) = &info.new_gid { in update_group_file()
676 fn update_gshadow_file(info: &GModInfo) { in update_gshadow_file()
682 if field[0] == info.groupname { in update_gshadow_file()
683 if let Some(new_groupname) = &info.new_groupname { in update_gshadow_file()
703 fn update_passwd_file(info: &GModInfo) { in update_passwd_file()
709 if field[3] == info.gid { in update_passwd_file()
710 if let Some(new_gid) = &info.new_gid { in update_passwd_file()