mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-24 22:58:07 +00:00
fix: subscribe clipboard services from permission switches only after authorization (#17065)
* Subscribe clipboard services from permission switches only after authorization Permission toggles in the accept window reach the connection before the peer is authorized. The keyboard, clipboard and file switches subscribed the clipboard services at once, so anything the host copied while the window was open was sent to a peer that had not been accepted. Subscribe only once authorized, as the audio switch does; on authorization try_sub_monitor_services subscribes from the recorded values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq * Say "until authorized" in the permission switch comment The switch arrives after the login request, so "before login" was inaccurate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fc9713c1b8
commit
febee50a6e
1 file changed
+4
-3
@@ -805,7 +805,8 @@ impl Connection {
|
||||
if &name == "keyboard" {
|
||||
conn.keyboard = enabled;
|
||||
conn.send_permission(Permission::Keyboard, enabled).await;
|
||||
if let Some(s) = conn.server.upgrade() {
|
||||
// Until authorized, only record the value; try_sub_monitor_services subscribes from it.
|
||||
if let Some(s) = conn.server.upgrade().filter(|_| conn.authorized) {
|
||||
s.write().unwrap().subscribe(
|
||||
super::clipboard_service::NAME,
|
||||
conn.inner.clone(), conn.can_sub_clipboard_service());
|
||||
@@ -822,7 +823,7 @@ impl Connection {
|
||||
} else if &name == "clipboard" {
|
||||
conn.clipboard = enabled;
|
||||
conn.send_permission(Permission::Clipboard, enabled).await;
|
||||
if let Some(s) = conn.server.upgrade() {
|
||||
if let Some(s) = conn.server.upgrade().filter(|_| conn.authorized) {
|
||||
s.write().unwrap().subscribe(
|
||||
super::clipboard_service::NAME,
|
||||
conn.inner.clone(), conn.can_sub_clipboard_service());
|
||||
@@ -853,7 +854,7 @@ impl Connection {
|
||||
conn.try_empty_file_clipboard();
|
||||
}
|
||||
#[cfg(feature = "unix-file-copy-paste")]
|
||||
if let Some(s) = conn.server.upgrade() {
|
||||
if let Some(s) = conn.server.upgrade().filter(|_| conn.authorized) {
|
||||
s.write().unwrap().subscribe(
|
||||
super::clipboard_service::FILE_NAME,
|
||||
conn.inner.clone(),
|
||||
|
||||
Reference in new issue
Block a user