mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
Fix for #4136 connection to linux refused by using wrong Xauthority file
Solution: 1. Get file from sddm-greeter and startplasma-x11 (aka KDE) processes as well 2. Get users home dir from system instead of hard coded pattern /home/<user> 3. Prefer XAUTHORITY environment variable over Xorg -auth if available
This commit is contained in:
@@ -322,7 +322,19 @@ fn patch(path: PathBuf) -> PathBuf {
|
||||
.trim()
|
||||
.to_owned();
|
||||
if user != "root" {
|
||||
return format!("/home/{user}").into();
|
||||
let cmd = format!("getent passwd '{}' | awk -F':' '{{print $6}}'", user);
|
||||
if let Ok(output) = std::process::Command::new(cmd).output() {
|
||||
let home_dir = String::from_utf8_lossy(&output.stdout)
|
||||
.to_string()
|
||||
.trim()
|
||||
.to_owned();
|
||||
if home_dir.is_empty() {
|
||||
return format!("/home/{user}").into();
|
||||
} else {
|
||||
log::info!("config::patch: got home dir from: {}", home_dir);
|
||||
return home_dir.into();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user