Skip to content

Commit 406f0f8

Browse files
refactor(devolitions-gateway): better error handling;
1 parent c82ea3d commit 406f0f8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

devolutions-gateway/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ pub mod dto {
11061106

11071107
/// Kerberos server config
11081108
///
1109-
/// This config is used to configure the kerberos server during RDP proxying.
1109+
/// This config is used to configure the Kerberos server during RDP proxying.
11101110
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
11111111
pub struct KerberosServer {
11121112
/// The maximum allowed time difference between client and proxy clocks

devolutions-gateway/src/rdp_proxy.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use ironrdp_connector::sspi::credssp::{ClientState, ServerError, ServerState};
1616
use ironrdp_connector::sspi::generator::GeneratorState;
1717
use ironrdp_connector::sspi::kerberos::ServerProperties;
1818
use ironrdp_connector::sspi::{
19-
AuthIdentityBuffers, CredentialsBuffers, KerberosConfig as SspiKerberosConfig, KerberosServerConfig,
19+
self, AuthIdentityBuffers, CredentialsBuffers, KerberosConfig as SspiKerberosConfig, KerberosServerConfig,
2020
};
2121
use ironrdp_pdu::{mcs, nego, x224};
2222
use ironrdp_tokio::AsyncSendableNetworkClient;
@@ -453,7 +453,14 @@ async fn resolve_server_generator(
453453
loop {
454454
match state {
455455
GeneratorState::Suspended(request) => {
456-
let response = network_client.send(&request).await.expect("todo");
456+
let response = network_client
457+
.send(&request)
458+
.await
459+
.inspect_err(|err| error!(?err, "Failed to send a Kerberos message"))
460+
.map_err(|err| ServerError {
461+
ts_request: None,
462+
error: sspi::Error::new(sspi::ErrorKind::InternalError, err),
463+
})?;
457464
state = generator.resume(Ok(response));
458465
}
459466
GeneratorState::Completed(client_state) => {
@@ -552,10 +559,9 @@ where
552559
password,
553560
} = credentials;
554561

555-
let username =
556-
ironrdp_connector::sspi::Username::new(username, domain.as_deref()).context("invalid username")?;
562+
let username = sspi::Username::new(username, domain.as_deref()).context("invalid username")?;
557563

558-
let identity = ironrdp_connector::sspi::AuthIdentity {
564+
let identity = sspi::AuthIdentity {
559565
username,
560566
password: password.expose_secret().to_owned().into(),
561567
};

0 commit comments

Comments
 (0)