Skip to content

Commit bdde2c7

Browse files
authored
fix(client)!: fix name of client address field (#754)
1 parent a82e280 commit bdde2c7

File tree

9 files changed

+32
-32
lines changed

9 files changed

+32
-32
lines changed

crates/ironrdp-client/src/rdp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async fn connect(
132132
let mut framed = ironrdp_tokio::TokioFramed::new(stream);
133133

134134
let mut connector = connector::ClientConnector::new(config.connector.clone())
135-
.with_server_addr(server_addr)
135+
.with_client_addr(server_addr)
136136
.with_static_channel(
137137
ironrdp::dvc::DrdynvcClient::new().with_dynamic_channel(DisplayControlClient::new(|_| Ok(Vec::new()))),
138138
)
@@ -335,7 +335,7 @@ where
335335
.parse()
336336
.map_err(|e| connector::custom_err!("failed to parse server address sent by proxy", e))?;
337337

338-
connector.attach_server_addr(server_addr);
338+
connector.attach_client_addr(server_addr);
339339

340340
let connector::ClientConnectorState::ConnectionInitiationWaitConfirm { .. } = connector.state else {
341341
return Err(connector::general_err!("invalid connector state (wait confirm)"));

crates/ironrdp-connector/src/connection.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl State for ClientConnectorState {
123123
pub struct ClientConnector {
124124
pub config: Config,
125125
pub state: ClientConnectorState,
126-
pub server_addr: Option<SocketAddr>,
126+
pub client_addr: Option<SocketAddr>,
127127
pub static_channels: StaticChannelSet,
128128
}
129129

@@ -132,21 +132,21 @@ impl ClientConnector {
132132
Self {
133133
config,
134134
state: ClientConnectorState::ConnectionInitiationSendRequest,
135-
server_addr: None,
135+
client_addr: None,
136136
static_channels: StaticChannelSet::new(),
137137
}
138138
}
139139

140-
/// Must be set to the actual target server address (as opposed to the proxy)
140+
/// Sets the client address to be used in the Client Info PDU.
141141
#[must_use]
142-
pub fn with_server_addr(mut self, addr: SocketAddr) -> Self {
143-
self.server_addr = Some(addr);
142+
pub fn with_client_addr(mut self, addr: SocketAddr) -> Self {
143+
self.client_addr = Some(addr);
144144
self
145145
}
146146

147-
/// Must be set to the actual target server address (as opposed to the proxy)
148-
pub fn attach_server_addr(&mut self, addr: SocketAddr) {
149-
self.server_addr = Some(addr);
147+
/// Sets the client address to be used in the Client Info PDU.
148+
pub fn attach_client_addr(&mut self, addr: SocketAddr) {
149+
self.client_addr = Some(addr);
150150
}
151151

152152
#[must_use]
@@ -448,12 +448,12 @@ impl Sequence for ClientConnector {
448448
} => {
449449
debug!("Secure Settings Exchange");
450450

451-
let routing_addr = self
452-
.server_addr
451+
let client_addr = self
452+
.client_addr
453453
.as_ref()
454-
.ok_or_else(|| general_err!("server address is missing"))?;
454+
.ok_or_else(|| general_err!("client address is missing"))?;
455455

456-
let client_info = create_client_info_pdu(&self.config, routing_addr);
456+
let client_info = create_client_info_pdu(&self.config, client_addr);
457457

458458
debug!(message = ?client_info, "Send");
459459

@@ -710,7 +710,7 @@ fn create_gcc_blocks<'a>(
710710
}
711711
}
712712

713-
fn create_client_info_pdu(config: &Config, routing_addr: &SocketAddr) -> rdp::ClientInfoPdu {
713+
fn create_client_info_pdu(config: &Config, client_addr: &SocketAddr) -> rdp::ClientInfoPdu {
714714
use ironrdp_pdu::rdp::client_info::{
715715
AddressFamily, ClientInfo, ClientInfoFlags, CompressionType, Credentials, ExtendedClientInfo,
716716
ExtendedClientOptionalInfo,
@@ -757,11 +757,11 @@ fn create_client_info_pdu(config: &Config, routing_addr: &SocketAddr) -> rdp::Cl
757757
alternate_shell: String::new(),
758758
work_dir: String::new(),
759759
extra_info: ExtendedClientInfo {
760-
address_family: match routing_addr {
760+
address_family: match client_addr {
761761
SocketAddr::V4(_) => AddressFamily::INET,
762762
SocketAddr::V6(_) => AddressFamily::INET_6,
763763
},
764-
address: routing_addr.ip().to_string(),
764+
address: client_addr.ip().to_string(),
765765
dir: config.client_dir.clone(),
766766
optional_data: ExtendedClientOptionalInfo::builder()
767767
.timezone(TimezoneInfo {

crates/ironrdp-testsuite-extra/tests/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ where
198198
let addr = rx.await.unwrap().unwrap();
199199
let tcp_stream = TcpStream::connect(addr).await.expect("TCP connect");
200200
let mut framed = ironrdp_tokio::TokioFramed::new(tcp_stream);
201-
let mut connector = connector::ClientConnector::new(client_config).with_server_addr(addr);
201+
let mut connector = connector::ClientConnector::new(client_config).with_client_addr(addr);
202202
let should_upgrade = ironrdp_async::connect_begin(&mut framed, &mut connector)
203203
.await
204204
.expect("begin connection");

crates/ironrdp-web/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ where
10591059
.parse()
10601060
.context("failed to parse server address sent by proxy")?;
10611061

1062-
connector.attach_server_addr(server_addr);
1062+
connector.attach_client_addr(server_addr);
10631063

10641064
let connector::ClientConnectorState::ConnectionInitiationWaitConfirm { .. } = connector.state else {
10651065
return Err(anyhow::Error::msg("invalid connector state (wait confirm)").into());

crates/ironrdp/examples/screenshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn connect(
239239

240240
let mut framed = ironrdp_blocking::Framed::new(tcp_stream);
241241

242-
let mut connector = connector::ClientConnector::new(config).with_server_addr(server_addr);
242+
let mut connector = connector::ClientConnector::new(config).with_client_addr(server_addr);
243243

244244
let should_upgrade = ironrdp_blocking::connect_begin(&mut framed, &mut connector).context("begin connection")?;
245245

ffi/dotnet/Devolutions.IronRdp/Generated/ClientConnector.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ public static ClientConnector New(Config config)
5959
/// Must use
6060
/// </summary>
6161
/// <exception cref="IronRdpException"></exception>
62-
public void WithServerAddr(string serverAddr)
62+
public void WithClientAddr(string clientAddr)
6363
{
6464
unsafe
6565
{
6666
if (_inner == null)
6767
{
6868
throw new ObjectDisposedException("ClientConnector");
6969
}
70-
byte[] serverAddrBuf = DiplomatUtils.StringToUtf8(serverAddr);
71-
nuint serverAddrBufLength = (nuint)serverAddrBuf.Length;
72-
fixed (byte* serverAddrBufPtr = serverAddrBuf)
70+
byte[] clientAddrBuf = DiplomatUtils.StringToUtf8(clientAddr);
71+
nuint clientAddrBufLength = (nuint)clientAddrBuf.Length;
72+
fixed (byte* clientAddrBufPtr = clientAddrBuf)
7373
{
74-
Raw.ConnectorFfiResultVoidBoxIronRdpError result = Raw.ClientConnector.WithServerAddr(_inner, serverAddrBufPtr, serverAddrBufLength);
74+
Raw.ConnectorFfiResultVoidBoxIronRdpError result = Raw.ClientConnector.WithClientAddr(_inner, clientAddrBufPtr, clientAddrBufLength);
7575
if (!result.isOk)
7676
{
7777
throw new IronRdpException(new IronRdpError(result.Err));

ffi/dotnet/Devolutions.IronRdp/Generated/RawClientConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public partial struct ClientConnector
2222
/// <summary>
2323
/// Must use
2424
/// </summary>
25-
[DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "ClientConnector_with_server_addr", ExactSpelling = true)]
26-
public static unsafe extern ConnectorFfiResultVoidBoxIronRdpError WithServerAddr(ClientConnector* self, byte* serverAddr, nuint serverAddrSz);
25+
[DllImport(NativeLib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "ClientConnector_with_client_addr", ExactSpelling = true)]
26+
public static unsafe extern ConnectorFfiResultVoidBoxIronRdpError WithClientAddr(ClientConnector* self, byte* clientAddr, nuint clientAddrSz);
2727

2828
/// <summary>
2929
/// Must use

ffi/dotnet/Devolutions.IronRdp/src/Connection.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public static class Connection
2121
"Cannot resolve DNS to " + serverName);
2222
}
2323

24-
var serverAddr = ip[0] + ":" + port;
25-
connector.WithServerAddr(serverAddr);
24+
var clientAddr = ip[0] + ":" + port;
25+
connector.WithClientAddr(clientAddr);
2626
connector.WithDynamicChannelDisplayControl();
2727
if (factory != null)
2828
{

ffi/src/connector/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ pub mod ffi {
3232
}
3333

3434
/// Must use
35-
pub fn with_server_addr(&mut self, server_addr: &str) -> Result<(), Box<IronRdpError>> {
35+
pub fn with_client_addr(&mut self, client_addr: &str) -> Result<(), Box<IronRdpError>> {
3636
let Some(connector) = self.0.take() else {
3737
return Err(IronRdpErrorKind::Consumed.into());
3838
};
39-
let server_addr = server_addr.parse().map_err(|_| IronRdpErrorKind::Generic)?;
40-
self.0 = Some(connector.with_server_addr(server_addr));
39+
let client_addr = client_addr.parse().map_err(|_| IronRdpErrorKind::Generic)?;
40+
self.0 = Some(connector.with_client_addr(client_addr));
4141

4242
Ok(())
4343
}

0 commit comments

Comments
 (0)