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<()> {
|
fn try_start_x_session(&mut self, username: &str, password: &str) -> ResultType<()> {
|
||||||
match get_user_by_name(username) {
|
match get_user_by_name(username) {
|
||||||
Some(userinfo) => {
|
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
|
client
|
||||||
.conversation_mut()
|
.conversation_mut()
|
||||||
.set_credentials(username, password);
|
.set_credentials(username, password);
|
||||||
@ -379,7 +379,7 @@ impl DesktopManager {
|
|||||||
password: String,
|
password: String,
|
||||||
envs: HashMap<&str, String>,
|
envs: HashMap<&str, String>,
|
||||||
) -> ResultType<()> {
|
) -> ResultType<()> {
|
||||||
let mut client = pam::Client::with_password(pam_get_service_name())?;
|
let mut client = pam::Client::with_password(&pam_get_service_name())?;
|
||||||
client
|
client
|
||||||
.conversation_mut()
|
.conversation_mut()
|
||||||
.set_credentials(&username, &password);
|
.set_credentials(&username, &password);
|
||||||
@ -668,6 +668,8 @@ impl DesktopManager {
|
|||||||
) -> ResultType<Child> {
|
) -> ResultType<Child> {
|
||||||
let xorg = Self::get_xorg();
|
let xorg = Self::get_xorg();
|
||||||
log::info!("Use xorg: {}", &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)
|
match Command::new(xorg)
|
||||||
.envs(envs)
|
.envs(envs)
|
||||||
.uid(uid)
|
.uid(uid)
|
||||||
@ -680,10 +682,8 @@ impl DesktopManager {
|
|||||||
"RANDR",
|
"RANDR",
|
||||||
"+extension",
|
"+extension",
|
||||||
"RENDER",
|
"RENDER",
|
||||||
//"-logfile",
|
|
||||||
//"/tmp/RustDesk_xorg.log",
|
|
||||||
"-config",
|
"-config",
|
||||||
"/etc/rustdesk/xorg.conf",
|
conf.as_ref(),
|
||||||
"-auth",
|
"-auth",
|
||||||
xauth,
|
xauth,
|
||||||
display,
|
display,
|
||||||
@ -702,7 +702,8 @@ impl DesktopManager {
|
|||||||
gid: u32,
|
gid: u32,
|
||||||
envs: &HashMap<&str, String>,
|
envs: &HashMap<&str, String>,
|
||||||
) -> ResultType<Child> {
|
) -> 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)
|
.envs(envs)
|
||||||
.uid(uid)
|
.uid(uid)
|
||||||
.gid(gid)
|
.gid(gid)
|
||||||
@ -729,10 +730,11 @@ impl DesktopManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pam_get_service_name() -> &'static str {
|
fn pam_get_service_name() -> String {
|
||||||
if Path::new("/etc/pam.d/rustdesk").is_file() {
|
let app_name = crate::get_app_name().to_lowercase();
|
||||||
"rustdesk"
|
if Path::new(&format!("/etc/pam.d/{app_name}")).is_file() {
|
||||||
|
app_name
|
||||||
} else {
|
} else {
|
||||||
"gdm"
|
"gdm".to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user