This commit is contained in:
rustdesk
2022-07-27 00:31:20 +08:00
parent 6981ae1c20
commit 06ce3661f4
4 changed files with 34 additions and 10 deletions

View File

@@ -87,6 +87,7 @@ pub struct Handler {
inner: Arc<RwLock<HandlerInner>>,
cmd: String,
id: String,
password: String,
args: Vec<String>,
lc: Arc<RwLock<LoginConfigHandler>>,
}
@@ -247,10 +248,11 @@ struct QualityStatus {
}
impl Handler {
pub fn new(cmd: String, id: String, args: Vec<String>) -> Self {
pub fn new(cmd: String, id: String, password: String, args: Vec<String>) -> Self {
let me = Self {
cmd,
id: id.clone(),
password: password.clone(),
args,
..Default::default()
};
@@ -1137,7 +1139,7 @@ impl Handler {
fn transfer_file(&mut self) {
let id = self.get_id();
let args = vec!["--file-transfer", &id];
let args = vec!["--file-transfer", &id, &self.password];
if let Err(err) = crate::run_me(args) {
log::error!("Failed to spawn file transfer: {}", err);
}
@@ -1145,7 +1147,7 @@ impl Handler {
fn tunnel(&mut self) {
let id = self.get_id();
let args = vec!["--port-forward", &id];
let args = vec!["--port-forward", &id, &self.password];
if let Err(err) = crate::run_me(args) {
log::error!("Failed to spawn IP tunneling: {}", err);
}
@@ -1251,6 +1253,7 @@ async fn start_one_port_forward(
handler.lc.write().unwrap().port_forward = (remote_host, remote_port);
if let Err(err) = crate::port_forward::listen(
handler.id.clone(),
handler.password.clone(),
port,
handler.clone(),
receiver,
@@ -2077,7 +2080,9 @@ impl Remote {
self.video_sender.send(MediaData::VideoFrame(vf)).ok();
}
Some(message::Union::Hash(hash)) => {
self.handler.handle_hash(hash, peer).await;
self.handler
.handle_hash(&self.handler.password.clone(), hash, peer)
.await;
}
Some(message::Union::LoginResponse(lr)) => match lr.union {
Some(login_response::Union::Error(err)) => {
@@ -2637,8 +2642,8 @@ impl Interface for Handler {
self.start_keyboard_hook();
}
async fn handle_hash(&mut self, hash: Hash, peer: &mut Stream) {
handle_hash(self.lc.clone(), hash, self, peer).await;
async fn handle_hash(&mut self, pass: &str, hash: Hash, peer: &mut Stream) {
handle_hash(self.lc.clone(), pass, hash, self, peer).await;
}
async fn handle_login_from_ui(&mut self, password: String, remember: bool, peer: &mut Stream) {