virtual display, linux, debug

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-03-29 20:25:41 +08:00
parent bcf08ba26d
commit c944d6093d
3 changed files with 72 additions and 19 deletions

View File

@ -294,10 +294,10 @@ class FfiModel with ChangeNotifier {
} else if (type == 'input-password') { } else if (type == 'input-password') {
enterPasswordDialog(id, dialogManager); enterPasswordDialog(id, dialogManager);
} else if (type == 'xsession-login' || type == 'xsession-re-login') { } else if (type == 'xsession-login' || type == 'xsession-re-login') {
// to-do enterUserLoginDialog(id, dialogManager);
} else if (type == 'xsession-login-password' || } else if (type == 'xsession-login-password' ||
type == 'xsession-login-password') { type == 'xsession-login-password') {
// to-do enterUserLoginAndPasswordDialog(id, dialogManager);
} else if (type == 'restarting') { } else if (type == 'restarting') {
showMsgBox(id, type, title, text, link, false, dialogManager, showMsgBox(id, type, title, text, link, false, dialogManager,
hasCancel: false); hasCancel: false);

View File

@ -57,6 +57,6 @@ where
{ {
unsafe { unsafe {
GLOBAL_CALLBACK = Some(Box::new(callback)); GLOBAL_CALLBACK = Some(Box::new(callback));
// libc::signal(libc::SIGSEGV, breakdown_signal_handler as _); libc::signal(libc::SIGSEGV, breakdown_signal_handler as _);
} }
} }

View File

@ -1285,16 +1285,11 @@ impl Connection {
} else if password::approve_mode() == ApproveMode::Click } else if password::approve_mode() == ApproveMode::Click
|| password::approve_mode() == ApproveMode::Both && !password::has_valid_password() || password::approve_mode() == ApproveMode::Both && !password::has_valid_password()
{ {
if desktop_err.is_empty() { self.try_start_cm(lr.my_id, lr.my_name, false);
self.try_start_cm(lr.my_id, lr.my_name, false); if hbb_common::get_version_number(&lr.version)
if hbb_common::get_version_number(&lr.version) >= hbb_common::get_version_number("1.2.0")
>= hbb_common::get_version_number("1.2.0") {
{ self.send_login_error("No Password Access").await;
self.send_login_error("No Password Access").await;
}
} else {
self.send_login_error(LOGIN_MSG_XSESSION_NOT_READY_PASSWORD_EMPTY)
.await;
} }
return true; return true;
} else if password::approve_mode() == ApproveMode::Password } else if password::approve_mode() == ApproveMode::Password
@ -1312,15 +1307,73 @@ impl Connection {
} else { } else {
self.send_login_error(desktop_err).await; self.send_login_error(desktop_err).await;
} }
} else { } else if lr.password.is_empty() {
if desktop_err.is_empty() { if desktop_err.is_empty() {
self.send_logon_response().await; self.try_start_cm(lr.my_id, lr.my_name, false);
self.try_start_cm(lr.my_id, lr.my_name, true); } else {
if self.port_forward_socket.is_some() { self.send_login_error(LOGIN_MSG_XSESSION_NOT_READY_PASSWORD_EMPTY)
return false; .await;
}
} else {
let mut failure = LOGIN_FAILURES
.lock()
.unwrap()
.get(&self.ip)
.map(|x| x.clone())
.unwrap_or((0, 0, 0));
let time = (get_time() / 60_000) as i32;
if failure.2 > 30 {
self.send_login_error("Too many wrong password attempts")
.await;
Self::post_alarm_audit(
AlarmAuditType::ManyWrongPassword,
true,
json!({
"ip":self.ip,
}),
);
} else if time == failure.0 && failure.1 > 6 {
self.send_login_error("Please try 1 minute later").await;
Self::post_alarm_audit(
AlarmAuditType::FrequentAttempt,
true,
json!({
"ip":self.ip,
}),
);
} else if !self.validate_password() {
if failure.0 == time {
failure.1 += 1;
failure.2 += 1;
} else {
failure.0 = time;
failure.1 = 1;
failure.2 += 1;
}
LOGIN_FAILURES
.lock()
.unwrap()
.insert(self.ip.clone(), failure);
if desktop_err.is_empty() {
self.send_login_error(LOGIN_MSG_PASSWORD_WRONG).await;
self.try_start_cm(lr.my_id, lr.my_name, false);
} else {
self.send_login_error(LOGIN_MSG_XSESSION_NOT_READY_PASSWORD_WRONG)
.await;
} }
} else { } else {
self.send_login_error(desktop_err).await; if failure.0 != 0 {
LOGIN_FAILURES.lock().unwrap().remove(&self.ip);
}
if desktop_err.is_empty() {
self.send_logon_response().await;
self.try_start_cm(lr.my_id, lr.my_name, true);
if self.port_forward_socket.is_some() {
return false;
}
} else {
self.send_login_error(desktop_err).await;
}
} }
} }
} else if let Some(message::Union::TestDelay(t)) = msg.union { } else if let Some(message::Union::TestDelay(t)) = msg.union {