Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ codegen-units = 1
[workspace.dependencies]
# Note: To use a local IronRDP repository as a crate (for example, ironrdp-cliprdr), define the dependency as follows:
# ironrdp-cliprdr = { path = "/path/to/local/IronRDP/crates/ironrdp-cliprdr" }
ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef", features = ["rustls"]}
ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "d24000a2aeab74f2610a0b01c629f7a4ef3c77ef" }
ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08", features = ["rustls"]}
ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "c944674ecbb0952f9e7ecb964a6c79cdca669a08" }
2 changes: 1 addition & 1 deletion lib/srv/desktop/rdp/rdpclient/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ rand_chacha = "0.3.1"
rsa = "0.9.6"
sspi = { git = "https://github.com/Devolutions/sspi-rs", rev="d54bdfcafa0e10d9d78224ebacc4f2a0992a6b79", features = ["network_client"] }
static_init = "1.0.3"
tokio = { version = "1.35", features = ["full"] }
tokio = { version = "1.36", features = ["full"] }
tokio-boring = { git = "https://github.com/gravitational/boring", rev="605253d99d5e363e178bcf97e1d4622e33844cd5", optional = true }
utf16string = "0.2.0"
uuid = { version = "1.6.1", features = ["v4"] }
Expand Down
46 changes: 39 additions & 7 deletions lib/srv/desktop/rdp/rdpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import "C"

import (
"context"
"fmt"
"os"
"runtime/cgo"
"sync"
Expand Down Expand Up @@ -253,16 +254,24 @@ func (c *Client) readClientSize() error {
}

if c.requestedWidth > types.MaxRDPScreenWidth || c.requestedHeight > types.MaxRDPScreenHeight {
return trace.BadParameter(
err = trace.BadParameter(
"screen size of %d x %d is greater than the maximum allowed by RDP (%d x %d)",
s.Width, s.Height, types.MaxRDPScreenWidth, types.MaxRDPScreenHeight,
)
if err := c.sendTDPNotification(err.Error(), tdp.SeverityError); err != nil {
return trace.Wrap(err)
}
return trace.Wrap(err)
}

return nil
}
}

func (c *Client) sendTDPNotification(message string, severity tdp.Severity) error {
return c.cfg.Conn.WriteMessage(tdp.Notification{Message: message, Severity: severity})
}

func (c *Client) startRustRDP(ctx context.Context) error {
c.cfg.Log.Info("Rust RDP loop starting")
defer c.cfg.Log.Info("Rust RDP loop finished")
Expand Down Expand Up @@ -292,7 +301,7 @@ func (c *Client) startRustRDP(ctx context.Context) error {
return trace.BadParameter("user key was nil")
}

if res := C.client_run(
res := C.client_run(
C.uintptr_t(c.handle),
C.CGOConnectParams{
go_addr: addr,
Expand All @@ -308,14 +317,37 @@ func (c *Client) startRustRDP(ctx context.Context) error {
allow_directory_sharing: C.bool(c.cfg.AllowDirectorySharing),
show_desktop_wallpaper: C.bool(c.cfg.ShowDesktopWallpaper),
},
); res.err_code != C.ErrCodeSuccess {
if res.message == nil {
return trace.Errorf("unknown error: %v", res.err_code)
}
)

var message string
if res.message != nil {
message = C.GoString(res.message)
defer C.free_string(res.message)
return trace.Errorf("%s", C.GoString(res.message))
}

// If the client exited with an error, send a tdp error notification and return it.
if res.err_code != C.ErrCodeSuccess {
var err error

if message != "" {
err = trace.Errorf("RDP client exited with an error: %v", message)
} else {
err = trace.Errorf("RDP client exited with an unknown error")
}

c.sendTDPNotification(err.Error(), tdp.SeverityError)
return err
}

if message != "" {
message = fmt.Sprintf("RDP client exited gracefully with message: %v", message)
} else {
message = "RDP client exited gracefully"
}

c.cfg.Log.Info(message)
c.sendTDPNotification(message, tdp.SeverityInfo)

return nil
}

Expand Down
Loading