Skip to content

Commit e77757a

Browse files
refactor(devolitions-gateway): better error handling;
1 parent 9880d54 commit e77757a

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
@@ -1140,7 +1140,7 @@ pub mod dto {
11401140

11411141
/// Kerberos server config
11421142
///
1143-
/// This config is used to configure the kerberos server during RDP proxying.
1143+
/// This config is used to configure the Kerberos server during RDP proxying.
11441144
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
11451145
pub struct KerberosServer {
11461146
/// 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::reqwest::ReqwestNetworkClient;
@@ -456,7 +456,14 @@ async fn resolve_server_generator(
456456
loop {
457457
match state {
458458
GeneratorState::Suspended(request) => {
459-
let response = network_client.send(&request).await.expect("todo");
459+
let response = network_client
460+
.send(&request)
461+
.await
462+
.inspect_err(|err| error!(?err, "Failed to send a Kerberos message"))
463+
.map_err(|err| ServerError {
464+
ts_request: None,
465+
error: sspi::Error::new(sspi::ErrorKind::InternalError, err),
466+
})?;
460467
state = generator.resume(Ok(response));
461468
}
462469
GeneratorState::Completed(client_state) => {
@@ -555,10 +562,9 @@ where
555562
password,
556563
} = credentials;
557564

558-
let username =
559-
ironrdp_connector::sspi::Username::new(username, domain.as_deref()).context("invalid username")?;
565+
let username = sspi::Username::new(username, domain.as_deref()).context("invalid username")?;
560566

561-
let identity = ironrdp_connector::sspi::AuthIdentity {
567+
let identity = sspi::AuthIdentity {
562568
username,
563569
password: password.expose_secret().to_owned().into(),
564570
};

0 commit comments

Comments
 (0)