mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-03 19:39:20 +08:00
more for custom client of linux
This commit is contained in:
parent
f6223a6f71
commit
ac04a032ad
@ -246,7 +246,7 @@ impl DesktopManager {
|
||||
fn try_start_x_session(&mut self, username: &str, password: &str) -> ResultType<()> {
|
||||
match get_user_by_name(username) {
|
||||
Some(userinfo) => {
|
||||
let mut client = pam::Client::with_password(pam_get_service_name())?;
|
||||
let mut client = pam::Client::with_password(&pam_get_service_name())?;
|
||||
client
|
||||
.conversation_mut()
|
||||
.set_credentials(username, password);
|
||||
@ -379,7 +379,7 @@ impl DesktopManager {
|
||||
password: String,
|
||||
envs: HashMap<&str, String>,
|
||||
) -> ResultType<()> {
|
||||
let mut client = pam::Client::with_password(pam_get_service_name())?;
|
||||
let mut client = pam::Client::with_password(&pam_get_service_name())?;
|
||||
client
|
||||
.conversation_mut()
|
||||
.set_credentials(&username, &password);
|
||||
@ -668,6 +668,8 @@ impl DesktopManager {
|
||||
) -> ResultType<Child> {
|
||||
let xorg = Self::get_xorg();
|
||||
log::info!("Use xorg: {}", &xorg);
|
||||
let app_name = crate::get_app_name().to_lowercase();
|
||||
let conf = format!("/etc/{app_name}/xorg.conf");
|
||||
match Command::new(xorg)
|
||||
.envs(envs)
|
||||
.uid(uid)
|
||||
@ -680,10 +682,8 @@ impl DesktopManager {
|
||||
"RANDR",
|
||||
"+extension",
|
||||
"RENDER",
|
||||
//"-logfile",
|
||||
//"/tmp/RustDesk_xorg.log",
|
||||
"-config",
|
||||
"/etc/rustdesk/xorg.conf",
|
||||
conf.as_ref(),
|
||||
"-auth",
|
||||
xauth,
|
||||
display,
|
||||
@ -702,7 +702,8 @@ impl DesktopManager {
|
||||
gid: u32,
|
||||
envs: &HashMap<&str, String>,
|
||||
) -> ResultType<Child> {
|
||||
match Command::new("/etc/rustdesk/startwm.sh")
|
||||
let app_name = crate::get_app_name().to_lowercase();
|
||||
match Command::new(&format!("/etc/{app_name}/startwm.sh"))
|
||||
.envs(envs)
|
||||
.uid(uid)
|
||||
.gid(gid)
|
||||
@ -729,10 +730,11 @@ impl DesktopManager {
|
||||
}
|
||||
}
|
||||
|
||||
fn pam_get_service_name() -> &'static str {
|
||||
if Path::new("/etc/pam.d/rustdesk").is_file() {
|
||||
"rustdesk"
|
||||
fn pam_get_service_name() -> String {
|
||||
let app_name = crate::get_app_name().to_lowercase();
|
||||
if Path::new(&format!("/etc/pam.d/{app_name}")).is_file() {
|
||||
app_name
|
||||
} else {
|
||||
"gdm"
|
||||
"gdm".to_owned()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user