Skip to content

Commit 44a2392

Browse files
samuelaEugeny
authored andcommitted
server/encrypted.rs: respect proceed_with_methods in "none" and "password" authentication methods
1 parent 2ce133d commit 44a2392

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

russh/src/server/encrypted.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,14 @@ impl Encrypted {
300300
self.state = EncryptedState::InitCompression;
301301
} else {
302302
auth_user.clear();
303-
auth_request.methods -= MethodSet::PASSWORD;
303+
if let Auth::Reject {
304+
proceed_with_methods: Some(proceed_with_methods),
305+
} = auth
306+
{
307+
auth_request.methods = proceed_with_methods;
308+
} else {
309+
auth_request.methods -= MethodSet::PASSWORD;
310+
}
304311
auth_request.partial_success = false;
305312
reject_auth_request(until, &mut self.write, auth_request).await;
306313
}
@@ -326,7 +333,14 @@ impl Encrypted {
326333
self.state = EncryptedState::InitCompression;
327334
} else {
328335
auth_user.clear();
329-
auth_request.methods -= MethodSet::NONE;
336+
if let Auth::Reject {
337+
proceed_with_methods: Some(proceed_with_methods),
338+
} = auth
339+
{
340+
auth_request.methods = proceed_with_methods;
341+
} else {
342+
auth_request.methods -= MethodSet::NONE;
343+
}
330344
auth_request.partial_success = false;
331345
reject_auth_request(until, &mut self.write, auth_request).await;
332346
}

0 commit comments

Comments
 (0)