client, server: don't require root for completions command
parent
5570580b78
commit
042881cc7d
|
@ -992,16 +992,16 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(opt: Opts) -> Result<(), Error> {
|
fn run(opt: Opts) -> Result<(), Error> {
|
||||||
if unsafe { libc::getuid() } != 0 {
|
|
||||||
return Err("innernet must run as root.".into());
|
|
||||||
}
|
|
||||||
|
|
||||||
let command = opt.command.unwrap_or(Command::Show {
|
let command = opt.command.unwrap_or(Command::Show {
|
||||||
short: false,
|
short: false,
|
||||||
tree: false,
|
tree: false,
|
||||||
interface: None,
|
interface: None,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if unsafe { libc::getuid() } != 0 && !matches!(command, Command::Completions { .. }) {
|
||||||
|
return Err("innernet must run as root.".into());
|
||||||
|
}
|
||||||
|
|
||||||
match command {
|
match command {
|
||||||
Command::Install {
|
Command::Install {
|
||||||
invite,
|
invite,
|
||||||
|
|
|
@ -227,7 +227,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
let opt = Opt::from_args();
|
let opt = Opt::from_args();
|
||||||
|
|
||||||
if unsafe { libc::getuid() } != 0 {
|
if unsafe { libc::getuid() } != 0 && !matches!(opt.command, Command::Completions { .. }) {
|
||||||
return Err("innernet-server must run as root.".into());
|
return Err("innernet-server must run as root.".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue