2022-12-25 23:50:37 -05:00
|
|
|
use super::Cmd;
|
2022-12-25 22:27:17 -05:00
|
|
|
use clap::Command;
|
|
|
|
use std::process;
|
|
|
|
|
2022-12-25 23:50:37 -05:00
|
|
|
#[derive(Debug)]
|
2022-12-25 22:27:17 -05:00
|
|
|
pub struct Nologin {
|
|
|
|
name: &'static str,
|
|
|
|
path: Option<crate::Path>,
|
|
|
|
}
|
|
|
|
|
2023-01-06 23:41:02 -05:00
|
|
|
impl Default for Nologin {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
name: "nologin",
|
|
|
|
path: Some(crate::Path::Sbin),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-25 22:27:17 -05:00
|
|
|
|
|
|
|
impl Cmd for Nologin {
|
|
|
|
fn name(&self) -> &str {
|
|
|
|
self.name
|
|
|
|
}
|
|
|
|
|
|
|
|
fn cli(&self) -> clap::Command {
|
|
|
|
Command::new(self.name)
|
|
|
|
.author("Nathan Fisher")
|
|
|
|
.about("Denies a user account login ability")
|
|
|
|
}
|
|
|
|
|
|
|
|
fn run(&self, _matches: Option<&clap::ArgMatches>) -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
eprintln!("I'm sorry, I can't let you do that, Dave");
|
|
|
|
process::exit(42);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn path(&self) -> Option<crate::Path> {
|
|
|
|
self.path
|
|
|
|
}
|
|
|
|
}
|