Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

restrict CLI options when settings disabled (#13400)

21pagesf7f947beb933
diff --git a/src/core_main.rs b/src/core_main.rs
index 0d8a91bef..7347c1895 100644
--- a/src/core_main.rs
+++ b/src/core_main.rs
@@ -373,6 +373,10 @@ pub fn core_main() -> Option<Vec<String>> {
}
return None;
} else if args[0] == "--password" {
+ if config::is_disable_settings() {
+ println!("Settings are disabled!");
+ return None;
+ }
if args.len() == 2 {
if crate::platform::is_installed() && is_root() {
if let Err(err) = crate::ipc::set_permanent_password(args[1].to_owned()) {
@@ -403,6 +407,10 @@ pub fn core_main() -> Option<Vec<String>> {
println!("{}", crate::ipc::get_id());
return None;
} else if args[0] == "--set-id" {
+ if config::is_disable_settings() {
+ println!("Settings are disabled!");
+ return None;
+ }
if args.len() == 2 {
if crate::platform::is_installed() && is_root() {
let old_id = crate::ipc::get_id();
@@ -442,6 +450,10 @@ pub fn core_main() -> Option<Vec<String>> {
}
return None;
} else if args[0] == "--option" {
+ if config::is_disable_settings() {
+ println!("Settings are disabled!");
+ return None;
+ }
if crate::platform::is_installed() && is_root() {
if args.len() == 2 {
let options = crate::ipc::get_options();
@@ -668,8 +680,8 @@ fn core_main_invoke_new_connection(mut args: std::env::Args) -> Option<Vec<Strin
let mut param_array = vec![];
while let Some(arg) = args.next() {
match arg.as_str() {
- "--connect" | "--play" | "--file-transfer" | "--view-camera" | "--port-forward" | "--terminal"
- | "--rdp" => {
+ "--connect" | "--play" | "--file-transfer" | "--view-camera" | "--port-forward"
+ | "--terminal" | "--rdp" => {
authority = Some((&arg.to_string()[2..]).to_owned());
id = args.next();
}