From 7e7a4d3e7ae5d0a1a0cdaf265f72050c7b8eceda Mon Sep 17 00:00:00 2001 From: Przemko Robakowski Date: Wed, 11 Dec 2024 21:18:18 +0100 Subject: [PATCH] [v16] Update IronRDP (#49483) (#50017) * Update IronRDP (#49483) * Fix most compilation errors * Fix all compilation errors * Fix all compilation errors in webassmbly * lint * dependency review * update picky deps * update deps * dependency review * lint * bump rust * Revert base ref in dependency review --- .github/workflows/dependency-review.yaml | 35 +- Cargo.lock | 540 ++++++++++++------ Cargo.toml | 28 +- lib/srv/desktop/rdp/rdpclient/Cargo.toml | 30 +- lib/srv/desktop/rdp/rdpclient/src/client.rs | 61 +- lib/srv/desktop/rdp/rdpclient/src/cliprdr.rs | 2 +- lib/srv/desktop/rdp/rdpclient/src/lib.rs | 14 +- lib/srv/desktop/rdp/rdpclient/src/piv.rs | 36 +- lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs | 26 +- .../rdp/rdpclient/src/rdpdr/filesystem.rs | 311 ++++++---- .../desktop/rdp/rdpclient/src/rdpdr/path.rs | 10 +- .../desktop/rdp/rdpclient/src/rdpdr/scard.rs | 64 ++- .../desktop/rdp/rdpclient/src/rdpdr/tdp.rs | 28 +- lib/srv/desktop/rdp/rdpclient/src/util.rs | 7 +- web/packages/teleport/src/ironrdp/Cargo.toml | 1 + web/packages/teleport/src/ironrdp/src/lib.rs | 6 +- 16 files changed, 774 insertions(+), 425 deletions(-) diff --git a/.github/workflows/dependency-review.yaml b/.github/workflows/dependency-review.yaml index 92e0d6720a909..cd9607886c514 100644 --- a/.github/workflows/dependency-review.yaml +++ b/.github/workflows/dependency-review.yaml @@ -16,13 +16,40 @@ jobs: # but because of the replace, the dependency cannot find the correct # Teleport version. allow-ghsas: 'GHSA-6xf3-5hp7-xqqg' + # IronRDP uses MIT/Apache-2.0 but slashes are not recognized by dependency review action allow-dependencies-licenses: >- + pkg:cargo/ironrdp-core, + pkg:cargo/ironrdp-async, + pkg:cargo/ironrdp-connector, + pkg:cargo/ironrdp-pdu, + pkg:cargo/ironrdp-session, + pkg:cargo/ironrdp-svc, + pkg:cargo/ironrdp-tokio, + pkg:cargo/asn1-rs, + pkg:cargo/asn1-rs-derive, + pkg:cargo/asn1-rs-impl, pkg:cargo/curve25519-dalek-derive, + pkg:cargo/der-parser, + pkg:cargo/icu_collections, + pkg:cargo/icu_locid, + pkg:cargo/icu_locid_transform, + pkg:cargo/icu_locid_transform_data, + pkg:cargo/icu_normalizer, + pkg:cargo/icu_normalizer_data, + pkg:cargo/icu_properties, + pkg:cargo/icu_properties_data, + pkg:cargo/icu_provider, + pkg:cargo/icu_provider_macros, + pkg:cargo/litemap, pkg:cargo/ring, pkg:cargo/sspi, pkg:cargo/tokio-boring, pkg:cargo/tokio-rustls, - pkg:cargo/asn1-rs, - pkg:cargo/asn1-rs-derive, - pkg:cargo/asn1-rs-impl, - pkg:cargo/der-parser + pkg:cargo/writeable, + pkg:cargo/yoke, + pkg:cargo/yoke-derive, + pkg:cargo/zerofrom, + pkg:cargo/zerofrom-derive, + pkg:cargo/zerovec, + pkg:cargo/zerovec-derive, + pkg:npm/prettier diff --git a/Cargo.lock b/Cargo.lock index 8aa4042cfe853..d489f1b017960 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,9 +204,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "aws-lc-rs" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae74d9bd0a7530e8afd1770739ad34b36838829d6ad61818f9230f683f5ad77" +checksum = "2f95446d919226d587817a7d21379e6eb099b97b45110a7f272a444ca5c54070" dependencies = [ "aws-lc-sys", "mirai-annotations", @@ -216,9 +216,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.20.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0e249228c6ad2d240c2dc94b714d711629d52bad946075d8e9b2f5391f0703" +checksum = "b3ddc4a5b231dd6958b140ff3151b6412b3f4321fab354f399eec8f14b06df62" dependencies = [ "bindgen 0.69.4", "cc", @@ -250,12 +250,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -396,9 +390,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cbc" @@ -838,19 +832,19 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ff" @@ -1259,14 +1253,143 @@ dependencies = [ "tracing", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] @@ -1310,6 +1433,7 @@ version = "0.1.0" dependencies = [ "console_error_panic_hook", "getrandom", + "ironrdp-core", "ironrdp-graphics", "ironrdp-pdu", "ironrdp-session", @@ -1325,11 +1449,12 @@ dependencies = [ [[package]] name = "ironrdp-async" -version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +version = "0.2.0" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bytes", "ironrdp-connector", + "ironrdp-core", "ironrdp-pdu", "tracing", ] @@ -1337,9 +1462,10 @@ dependencies = [ [[package]] name = "ironrdp-cliprdr" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bitflags 2.6.0", + "ironrdp-core", "ironrdp-pdu", "ironrdp-svc", "thiserror", @@ -1348,27 +1474,36 @@ dependencies = [ [[package]] name = "ironrdp-connector" -version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +version = "0.2.1" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ + "ironrdp-core", "ironrdp-error", "ironrdp-pdu", "ironrdp-svc", "picky", - "picky-asn1-der 0.5.0", - "picky-asn1-x509 0.13.0", + "picky-asn1-der", + "picky-asn1-x509", "rand_core", "sspi", "tracing", "url", - "winapi", +] + +[[package]] +name = "ironrdp-core" +version = "0.1.1" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" +dependencies = [ + "ironrdp-error", ] [[package]] name = "ironrdp-displaycontrol" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ + "ironrdp-core", "ironrdp-dvc", "ironrdp-pdu", "ironrdp-svc", @@ -1378,8 +1513,9 @@ dependencies = [ [[package]] name = "ironrdp-dvc" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ + "ironrdp-core", "ironrdp-pdu", "ironrdp-svc", "slab", @@ -1389,18 +1525,18 @@ dependencies = [ [[package]] name = "ironrdp-error" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" [[package]] name = "ironrdp-graphics" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bit_field", "bitflags 2.6.0", "bitvec", "byteorder", - "ironrdp-error", + "ironrdp-core", "ironrdp-pdu", "lazy_static", "num-derive", @@ -1410,13 +1546,14 @@ dependencies = [ [[package]] name = "ironrdp-pdu" -version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +version = "0.1.1" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bit_field", "bitflags 2.6.0", "byteorder", "der-parser", + "ironrdp-core", "ironrdp-error", "md-5", "num-bigint", @@ -1433,9 +1570,10 @@ dependencies = [ [[package]] name = "ironrdp-rdpdr" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bitflags 2.6.0", + "ironrdp-core", "ironrdp-error", "ironrdp-pdu", "ironrdp-svc", @@ -1445,9 +1583,10 @@ dependencies = [ [[package]] name = "ironrdp-rdpsnd" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bitflags 2.6.0", + "ironrdp-core", "ironrdp-pdu", "ironrdp-svc", "tracing", @@ -1455,10 +1594,11 @@ dependencies = [ [[package]] name = "ironrdp-session" -version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +version = "0.2.0" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "ironrdp-connector", + "ironrdp-core", "ironrdp-displaycontrol", "ironrdp-dvc", "ironrdp-error", @@ -1470,17 +1610,18 @@ dependencies = [ [[package]] name = "ironrdp-svc" -version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +version = "0.1.1" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bitflags 2.6.0", + "ironrdp-core", "ironrdp-pdu", ] [[package]] name = "ironrdp-tls" version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "tokio", "tokio-rustls", @@ -1489,8 +1630,8 @@ dependencies = [ [[package]] name = "ironrdp-tokio" -version = "0.1.0" -source = "git+https://github.com/Devolutions/IronRDP?rev=92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3#92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" +version = "0.2.0" +source = "git+https://github.com/Devolutions/IronRDP?rev=2f57fd2de320f58fe240d88a83519255ba94cb73#2f57fd2de320f58fe240d88a83519255ba94cb73" dependencies = [ "bytes", "ironrdp-async", @@ -1505,9 +1646,9 @@ checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "iso7816" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3af73ac9c821e7aea3280532118e15cdf9e7bb45c923cbf0e319ae25b27d20c" +checksum = "c75f5d3f2d959c5d37b382ed9b5a32d0a0e6112ab6ac9eb8fce82359db6f2367" dependencies = [ "delog", "heapless", @@ -1548,9 +1689,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1581,9 +1722,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libloading" @@ -1607,6 +1748,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + [[package]] name = "lock_api" version = "0.4.12" @@ -1950,14 +2097,14 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "picky" -version = "7.0.0-rc.9" +version = "7.0.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9b488630f493840c2e6ef270c3619a3dc2ad0953eb978d6e4273a8337fee5e" +checksum = "f62f11977ee3ab76e48f7465f035a607e61b7421b154384b71607cb85a26d5dd" dependencies = [ "aes", "aes-gcm", "aes-kw", - "base64 0.22.1", + "base64", "cbc", "des", "digest", @@ -1971,9 +2118,9 @@ dependencies = [ "p384", "p521", "pbkdf2", - "picky-asn1 0.9.0", - "picky-asn1-der 0.5.0", - "picky-asn1-x509 0.13.0", + "picky-asn1", + "picky-asn1-der", + "picky-asn1-x509", "rand", "rand_core", "rc2", @@ -1990,20 +2137,9 @@ dependencies = [ [[package]] name = "picky-asn1" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "295eea0f33c16be21e2a98b908fdd4d73c04dd48c8480991b76dbcf0cb58b212" -dependencies = [ - "oid", - "serde", - "serde_bytes", -] - -[[package]] -name = "picky-asn1" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360019b238b11b8c0e88cd9db3a6677f1af122e3422d0a26a2b576f084d9be36" +checksum = "d061c9f67e256511d8d69b86730a506bed100db520c8812e789cf91d9c6a16cc" dependencies = [ "oid", "serde", @@ -2014,50 +2150,26 @@ dependencies = [ [[package]] name = "picky-asn1-der" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5df7873a9e36d42dadb393bea5e211fe83d793c172afad5fb4ec846ec582793f" -dependencies = [ - "picky-asn1 0.8.0", - "serde", - "serde_bytes", -] - -[[package]] -name = "picky-asn1-der" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04784987e157b5a8f832ce68b3364915dc6ef4bed94a6e10e241fa1bae3db2e3" +checksum = "e15b90fb132c46ded79c39277afa93151691d9df6e7ff369c071890b36478392" dependencies = [ - "picky-asn1 0.9.0", + "picky-asn1", "serde", "serde_bytes", ] [[package]] name = "picky-asn1-x509" -version = "0.12.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c5f20f71a68499ff32310f418a6fad8816eac1a2859ed3f0c5c741389dd6208" +checksum = "f702973074c654cef724d7430e2852acdb8b0e897ed9c4120727446a1bda1464" dependencies = [ - "base64 0.21.7", - "oid", - "picky-asn1 0.8.0", - "picky-asn1-der 0.4.1", - "serde", -] - -[[package]] -name = "picky-asn1-x509" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3384ff768b1c4a04532916be77935f634a4738d3b2138da98798e90352fadf4" -dependencies = [ - "base64 0.22.1", + "base64", "num-bigint-dig", "oid", - "picky-asn1 0.9.0", - "picky-asn1-der 0.5.0", + "picky-asn1", + "picky-asn1-der", "serde", "widestring", "zeroize", @@ -2065,9 +2177,9 @@ dependencies = [ [[package]] name = "picky-krb" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2213fd3942a9d3366b3e108b6d02db2227c80937a55f79a71e1719ab075bb77" +checksum = "f5f3c62393fbe5538020af4f8b07d1647f99748becd207476417f8d2aa8900cd" dependencies = [ "aes", "byteorder", @@ -2078,9 +2190,9 @@ dependencies = [ "num-bigint-dig", "oid", "pbkdf2", - "picky-asn1 0.9.0", - "picky-asn1-der 0.5.0", - "picky-asn1-x509 0.13.0", + "picky-asn1", + "picky-asn1-der", + "picky-asn1-x509", "rand", "serde", "sha1", @@ -2274,6 +2386,7 @@ dependencies = [ "env_logger", "ironrdp-cliprdr", "ironrdp-connector", + "ironrdp-core", "ironrdp-displaycontrol", "ironrdp-dvc", "ironrdp-pdu", @@ -2288,8 +2401,9 @@ dependencies = [ "log", "parking_lot 0.12.3", "picky", - "picky-asn1-der 0.4.1", - "picky-asn1-x509 0.12.0", + "picky-asn1-der", + "picky-asn1-x509", + "picky-krb", "rand", "rand_chacha", "reqwest", @@ -2354,11 +2468,11 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-core", @@ -2420,9 +2534,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" dependencies = [ "const-oid", "digest", @@ -2471,27 +2585,26 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" dependencies = [ "aws-lc-rs", "log", "once_cell", - "ring", "rustls-pki-types", "rustls-webpki", "subtle", @@ -2500,9 +2613,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04182dffc9091a404e0fc069ea5cd60e5b866c3adf881eff99a32d048242dffa" +checksum = "fcaf18a4f2be7326cd874a5fa579fae794320a0f388d365dca7e480e55f83f8a" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -2517,21 +2630,21 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64 0.22.1", + "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "aws-lc-rs", "ring", @@ -2776,9 +2889,9 @@ dependencies = [ [[package]] name = "sspi" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1734839082c6d33f8368b40a40d0d5cc1ed10fbde00dc8a404f64e70272ed3f6" +checksum = "b94e3c7aa94f5b440eedeab677686629bddcb43edf52ef3703038cce98e2bf70" dependencies = [ "async-dnssd", "async-recursion", @@ -2796,9 +2909,9 @@ dependencies = [ "num-traits", "oid", "picky", - "picky-asn1 0.9.0", - "picky-asn1-der 0.5.0", - "picky-asn1-x509 0.13.0", + "picky-asn1", + "picky-asn1-der", + "picky-asn1-x509", "picky-krb", "portpicker", "rand", @@ -2816,7 +2929,7 @@ dependencies = [ "url", "uuid", "windows", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "winreg", "zeroize", ] @@ -2917,9 +3030,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", "fastrand", @@ -2991,20 +3104,15 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "1.6.1" +name = "tinystr" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ - "tinyvec_macros", + "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tls_codec" version = "0.4.1" @@ -3028,9 +3136,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.39.3" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -3222,27 +3330,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "universal-hash" version = "0.5.1" @@ -3261,15 +3354,21 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf16string" version = "0.2.0" @@ -3279,6 +3378,12 @@ dependencies = [ "byteorder", ] +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -3287,9 +3392,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", "serde", @@ -3324,9 +3429,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -3335,9 +3440,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -3362,9 +3467,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3372,9 +3477,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -3385,15 +3490,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -3681,6 +3786,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -3714,6 +3831,51 @@ dependencies = [ "tls_codec", ] +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -3733,3 +3895,25 @@ dependencies = [ "quote", "syn 2.0.68", ] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] diff --git a/Cargo.toml b/Cargo.toml index 8ceb61bf46283..cf40926486bbf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,19 +16,23 @@ lto = "off" [profile.release] debug = 1 codegen-units = 1 +lto = "thin" [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 = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-displaycontrol = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-dvc = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } -ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3", features = ["rustls" ] } -ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "92efe2adf7402c15fe6cf2da0d3f8ff8ebd767c3" } +ironrdp-cliprdr = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-connector = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-core = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-displaycontrol = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-dvc = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-graphics = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-pdu = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-rdpdr = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-rdpsnd = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-session = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-svc = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } +ironrdp-tls = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73", features = [ + "rustls", +] } +ironrdp-tokio = { git = "https://github.com/Devolutions/IronRDP", rev = "2f57fd2de320f58fe240d88a83519255ba94cb73" } diff --git a/lib/srv/desktop/rdp/rdpclient/Cargo.toml b/lib/srv/desktop/rdp/rdpclient/Cargo.toml index 70b5705014139..4e9abdb6f8ebd 100644 --- a/lib/srv/desktop/rdp/rdpclient/Cargo.toml +++ b/lib/srv/desktop/rdp/rdpclient/Cargo.toml @@ -10,12 +10,13 @@ crate-type = ["staticlib"] [dependencies] bitflags = "2.5.0" -boring = { git = "https://github.com/gravitational/boring", rev="99897308abb5976ea05625b8314c24b16eebb01b", optional = true } +boring = { git = "https://github.com/gravitational/boring", rev = "99897308abb5976ea05625b8314c24b16eebb01b", optional = true } byteorder = "1.5.0" -bytes = "1.7.1" +bytes = "1.9.0" env_logger = "0.11.5" ironrdp-cliprdr.workspace = true ironrdp-connector.workspace = true +ironrdp-core.workspace = true ironrdp-pdu.workspace = true ironrdp-rdpdr.workspace = true ironrdp-rdpsnd.workspace = true @@ -25,29 +26,30 @@ ironrdp-dvc.workspace = true ironrdp-displaycontrol.workspace = true ironrdp-tls.workspace = true ironrdp-tokio.workspace = true -iso7816 = "0.1.2" +iso7816 = "0.1.3" iso7816-tlv = "0.4.4" log = "0.4.22" parking_lot = "0.12.3" rand = { version = "0.8.5", features = ["getrandom"] } rand_chacha = "0.3.1" -rsa = "0.9.6" -sspi = { version = "0.13.0", features = ["network_client"] } +rsa = "0.9.7" +sspi = { version = "0.15.0", features = ["network_client"] } static_init = "1.0.3" -tokio = { version = "1.39", features = ["full"] } -tokio-boring = { git = "https://github.com/gravitational/boring", rev="99897308abb5976ea05625b8314c24b16eebb01b", optional = true } +tokio = { version = "1.42", features = ["full"] } +tokio-boring = { git = "https://github.com/gravitational/boring", rev = "99897308abb5976ea05625b8314c24b16eebb01b", optional = true } utf16string = "0.2.0" -uuid = { version = "1.10.0", features = ["v4"] } -url = "2.5.0" -picky = { version = "7.0.0-rc.9", default-features = false } -picky-asn1-der = "0.4.1" -picky-asn1-x509 = "0.12.0" +uuid = { version = "1.11.0", features = ["v4"] } +url = "2.5.4" +picky = { version = "7.0.0-rc.11", default-features = false } +picky-asn1-der = "0.5.1" +picky-asn1-x509 = "0.14.1" +picky-krb = "0.9.2" reqwest = { version = "0.12", default-features = false } -rustls = { version = "0.23.11", default-features = false, features = ["ring"] } +rustls = { version = "0.23.19", default-features = false, features = ["aws-lc-rs"] } [build-dependencies] cbindgen = "0.27.0" -tempfile = "3.12.0" +tempfile = "3.14.0" [features] fips = ["tokio-boring/fips", "boring/fips"] diff --git a/lib/srv/desktop/rdp/rdpclient/src/client.rs b/lib/srv/desktop/rdp/rdpclient/src/client.rs index d98c800a356e1..d4e010c8e1fa9 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/client.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/client.rs @@ -31,6 +31,8 @@ use ironrdp_connector::credssp::KerberosConfig; use ironrdp_connector::{ Config, ConnectorError, ConnectorErrorKind, Credentials, DesktopSize, SmartCardIdentity, }; +use ironrdp_core::{encode_vec, EncodeError}; +use ironrdp_core::{function, WriteBuf}; use ironrdp_displaycontrol::client::DisplayControlClient; use ironrdp_displaycontrol::pdu::{ DisplayControlMonitorLayout, DisplayControlPdu, MonitorLayoutEntry, @@ -42,29 +44,28 @@ use ironrdp_pdu::input::fast_path::{ }; use ironrdp_pdu::input::mouse::PointerFlags; use ironrdp_pdu::input::{InputEventError, MousePdu}; -use ironrdp_pdu::mcs::DisconnectReason; use ironrdp_pdu::rdp::capability_sets::MajorPlatformType; use ironrdp_pdu::rdp::client_info::PerformanceFlags; use ironrdp_pdu::rdp::RdpError; -use ironrdp_pdu::write_buf::WriteBuf; +use ironrdp_pdu::PduError; use ironrdp_pdu::PduResult; -use ironrdp_pdu::{custom_err, function, PduError}; +use ironrdp_pdu::{encode_err, pdu_other_err}; use ironrdp_rdpdr::pdu::efs::ClientDeviceListAnnounce; use ironrdp_rdpdr::pdu::RdpdrPdu; use ironrdp_rdpdr::Rdpdr; use ironrdp_rdpsnd::client::{NoopRdpsndBackend, Rdpsnd}; -use ironrdp_session::x224::{self, ProcessorOutput}; +use ironrdp_session::x224::{self, DisconnectDescription, ProcessorOutput}; use ironrdp_session::SessionErrorKind::Reason; use ironrdp_session::{reason_err, SessionError, SessionResult}; use ironrdp_svc::{SvcMessage, SvcProcessor, SvcProcessorMessages}; -use ironrdp_tokio::{single_sequence_step_read, Framed, TokioStream}; +use ironrdp_tokio::{single_sequence_step_read, Framed, FramedWrite, TokioStream}; use log::debug; use rand::{Rng, SeedableRng}; use std::error::Error; use std::fmt::{Debug, Display, Formatter}; use std::io::{Error as IoError, ErrorKind as IoErrorKind}; use std::net::ToSocketAddrs; -use std::sync::{Arc, Mutex, MutexGuard, Once}; +use std::sync::{Arc, Mutex, MutexGuard}; use std::time::Duration; use tokio::io::{split, ReadHalf, WriteHalf}; use tokio::net::TcpStream as TokioTcpStream; @@ -81,8 +82,6 @@ use url::Url; const RDP_CONNECT_TIMEOUT: Duration = Duration::from_secs(5); -static START: Once = Once::new(); - /// The "Microsoft::Windows::RDS::DisplayControl" DVC is opened /// by the server. Until it does so, we withhold the latest screen /// resize, and only send it once we're notified that the DVC is open. @@ -115,7 +114,7 @@ impl Client { pub fn run( cgo_handle: CgoHandle, params: ConnectParams, - ) -> ClientResult> { + ) -> ClientResult> { global::TOKIO_RT.block_on(async { Self::connect(cgo_handle, params) .await? @@ -127,12 +126,6 @@ impl Client { /// Initializes the RDP connection with the given [`ConnectParams`]. async fn connect(cgo_handle: CgoHandle, params: ConnectParams) -> ClientResult { - START.call_once(|| { - // we register provider explicitly to avoid panics when both ring and aws_lc - // features of rustls are enabled, which happens often in dependencies like tokio-tls - // and reqwest - let _ = rustls::crypto::ring::default_provider().install_default(); - }); let server_addr = params.addr.clone(); let server_socket_addr = server_addr .to_socket_addrs()? @@ -288,7 +281,7 @@ impl Client { /// which it then executes. /// /// When either loop returns, the other is aborted and the result is returned. - async fn run_loops(mut self) -> ClientResult> { + async fn run_loops(mut self) -> ClientResult> { let read_stream = self .read_stream .take() @@ -343,7 +336,7 @@ impl Client { mut read_stream: RdpReadStream, x224_processor: Arc>, write_requester: ClientHandle, - ) -> tokio::task::JoinHandle>> { + ) -> tokio::task::JoinHandle>> { global::TOKIO_RT.spawn(async move { loop { let (action, mut frame) = read_stream.read_pdu().await?; @@ -383,6 +376,7 @@ impl Client { &mut read_stream, sequence.as_mut(), &mut buf, + None, ) .await?; @@ -526,7 +520,7 @@ impl Client { debug!("DisplayControlClient channel opened"); // We've been notified that the DisplayControl dvc channel has been opened: let mut pending_resize = - Self::resize_manager_lock(pending_resize).map_err(|err| custom_err!(err))?; + Self::resize_manager_lock(pending_resize).map_err(ClientError::from)?; let pending_resize = pending_resize.pending_resize.take(); if let Some((width, height)) = pending_resize { // If there was a resize pending, perform it now. @@ -539,7 +533,8 @@ impl Client { height, None, Some((width, height)), - )? + ) + .map_err(|e| encode_err!(e))? .into(); return Ok(vec![Box::new(pdu)]); } @@ -691,7 +686,7 @@ impl Client { event: FastPathInputEvent, ) -> ClientResult<()> { write_stream - .write_all(&ironrdp_pdu::encode_vec(&FastPathInput(vec![event]))?) + .write_all(&encode_vec(&FastPathInput(vec![event]))?) .await?; Ok(()) } @@ -1414,15 +1409,12 @@ fn create_config(params: &ConnectParams, pin: String) -> Config { enable_tls: true, enable_credssp: params.ad && params.nla, credentials: Credentials::SmartCard { - config: params.ad.then(|| { - SmartCardIdentity { - csp_name: "Microsoft Base Smart Card Crypto Provider".to_string(), - reader_name: "Teleport".to_string(), - container_name: "".to_string(), - certificate: params.cert_der.clone(), - private_key: params.key_der.clone(), - } - .into() + config: params.ad.then(|| SmartCardIdentity { + csp_name: "Microsoft Base Smart Card Crypto Provider".to_string(), + reader_name: "Teleport".to_string(), + container_name: "".to_string(), + certificate: params.cert_der.clone(), + private_key: params.key_der.clone(), }), pin, }, @@ -1450,6 +1442,7 @@ fn create_config(params: &ConnectParams, pin: String) -> Config { platform: MajorPlatformType::UNSPECIFIED, no_server_pointer: false, autologon: true, + request_data: None, pointer_software_rendering: false, performance_flags: PerformanceFlags::default() | PerformanceFlags::DISABLE_CURSOR_SHADOW // this is required for pointer to work correctly in Windows 2019 @@ -1482,6 +1475,7 @@ pub struct ConnectParams { pub enum ClientError { Tcp(IoError), Rdp(RdpError), + EncodeError(EncodeError), PduError(PduError), SessionError(SessionError), ConnectorError(ConnectorError), @@ -1531,6 +1525,7 @@ impl Display for ClientError { ClientError::SendError(msg) => Display::fmt(&msg.to_string(), f), ClientError::InternalError(msg) => Display::fmt(&msg.to_string(), f), ClientError::UnknownAddress => Display::fmt("Unknown address", f), + ClientError::EncodeError(e) => Display::fmt(e, f), ClientError::PduError(e) => Display::fmt(e, f), ClientError::UrlError(e) => Display::fmt(e, f), #[cfg(feature = "fips")] @@ -1583,6 +1578,12 @@ impl From for ClientError { } } +impl From for ClientError { + fn from(e: EncodeError) -> Self { + ClientError::EncodeError(e) + } +} + impl From for ClientError { fn from(e: PduError) -> Self { ClientError::PduError(e) @@ -1591,7 +1592,7 @@ impl From for ClientError { impl From for PduError { fn from(e: ClientError) -> Self { - custom_err!(e) + pdu_other_err!("", source:e) } } diff --git a/lib/srv/desktop/rdp/rdpclient/src/cliprdr.rs b/lib/srv/desktop/rdp/rdpclient/src/cliprdr.rs index 26d750d00f81e..c7d4c473953e9 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/cliprdr.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/cliprdr.rs @@ -22,8 +22,8 @@ use ironrdp_cliprdr::pdu::{ FileContentsResponse, FormatDataRequest, FormatDataResponse, LockDataId, }; use ironrdp_cliprdr::{Client, CliprdrClient as Cliprdr, CliprdrSvcMessages}; +use ironrdp_core::impl_as_any; use ironrdp_pdu::PduResult; -use ironrdp_svc::impl_as_any; use log::{debug, error, info, trace, warn}; use static_init::dynamic; use std::fmt::{Debug, Formatter}; diff --git a/lib/srv/desktop/rdp/rdpclient/src/lib.rs b/lib/srv/desktop/rdp/rdpclient/src/lib.rs index 05b16ca8fe6ac..2a7bb6b8cd60d 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/lib.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/lib.rs @@ -28,6 +28,7 @@ use crate::client::global::get_client_handle; use crate::client::Client; use crate::rdpdr::tdp::SharedDirectoryAnnounce; use client::{ClientHandle, ClientResult, ConnectParams}; +use ironrdp_session::x224::DisconnectDescription; use log::{error, trace, warn}; use rdpdr::path::UnixPath; use rdpdr::tdp::{ @@ -121,9 +122,16 @@ pub unsafe extern "C" fn client_run(cgo_handle: CgoHandle, params: CGOConnectPar Ok(res) => CGOResult { err_code: CGOErrCode::ErrCodeSuccess, message: match res { - Some(reason) => CString::new(reason.description().to_string()) - .map(|c| c.into_raw()) - .unwrap_or(ptr::null_mut()), + Some(DisconnectDescription::McsDisconnect(reason)) => { + CString::new(reason.description().to_string()) + .map(|c| c.into_raw()) + .unwrap_or(ptr::null_mut()) + } + Some(DisconnectDescription::ErrorInfo(info)) => { + CString::new(info.description().to_string()) + .map(|c| c.into_raw()) + .unwrap_or(ptr::null_mut()) + } None => ptr::null_mut(), }, }, diff --git a/lib/srv/desktop/rdp/rdpclient/src/piv.rs b/lib/srv/desktop/rdp/rdpclient/src/piv.rs index 8c7b2e4a10ac5..29a2c02a5daab 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/piv.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/piv.rs @@ -15,7 +15,7 @@ // along with this program. If not, see . use crate::rdpdr::TeleportRdpdrBackendError; -use ironrdp_pdu::{custom_err, other_err, PduResult}; +use ironrdp_pdu::{pdu_other_err, PduResult}; use iso7816::aid::Aid; use iso7816::command::instruction::Instruction; use iso7816::command::Command; @@ -58,7 +58,7 @@ pub struct Card { impl Card { pub fn new(uuid: Uuid, cert_der: &[u8], key_der: &[u8], pin: String) -> PduResult { let piv_auth_key = RsaPrivateKey::from_pkcs1_der(key_der) - .map_err(|_e| other_err!("failed to parse private key from DER"))?; + .map_err(|_e| pdu_other_err!("failed to parse private key from DER"))?; Ok(Self { chuid: Self::build_chuid(uuid), @@ -79,7 +79,7 @@ impl Card { None => cmd, Some(pending) => { pending.extend_from_command(&cmd).map_err(|e| { - custom_err!(TeleportRdpdrBackendError(format!( + pdu_other_err!("", source: TeleportRdpdrBackendError(format!( "could not build chained command: {e:?}" ))) })?; @@ -158,8 +158,9 @@ impl Card { if cmd.p1 != 0x3F && cmd.p2 != 0xFF { return Ok(Response::new(Status::NotFound)); } - let request_tlv = Tlv::from_bytes(cmd.data()) - .map_err(|e| custom_err!(TeleportRdpdrBackendError(format!("TLV invalid: {e:?}"))))?; + let request_tlv = Tlv::from_bytes(cmd.data()).map_err( + |e| pdu_other_err!("", source:TeleportRdpdrBackendError(format!("TLV invalid: {e:?}"))), + )?; if *request_tlv.tag() != tlv_tag(0x5C)? { return Ok(Response::new(Status::NotFound)); } @@ -189,7 +190,9 @@ impl Card { None => Ok(Response::new(Status::NotFound)), Some(cursor) => { let mut chunk = [0; CHUNK_SIZE]; - let n = cursor.read(&mut chunk).map_err(|e| custom_err!(e))?; + let n = cursor + .read(&mut chunk) + .map_err(|e| pdu_other_err!("", source:e))?; let mut chunk = chunk.to_vec(); chunk.truncate(n); let remaining = cursor.get_ref().len() as u64 - cursor.position(); @@ -237,23 +240,24 @@ impl Card { // https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-78-4.pdf // TODO(zmb3): support non-RSA keys, if needed. if cmd.p1 != 0x07 { - return Err(custom_err!(TeleportRdpdrBackendError(format!( + return Err(pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "unsupported algorithm identifier P1:{:#X} in general authenticate command", cmd.p1 )))); } // P2='9A' means PIV Authentication Key (matches our cert '5FC105' in handle_get_data). if cmd.p2 != 0x9A { - return Err(custom_err!(TeleportRdpdrBackendError(format!( + return Err(pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "unsupported key reference P2:{:#X} in general authenticate command", cmd.p2 )))); } - let request_tlv = Tlv::from_bytes(cmd.data()) - .map_err(|e| custom_err!(TeleportRdpdrBackendError(format!("TLV invalid: {e:?}"))))?; + let request_tlv = Tlv::from_bytes(cmd.data()).map_err( + |e| pdu_other_err!("", source:TeleportRdpdrBackendError(format!("TLV invalid: {e:?}"))), + )?; if *request_tlv.tag() != tlv_tag(TLV_TAG_DYNAMIC_AUTHENTICATION_TEMPLATE)? { - return Err(custom_err!(TeleportRdpdrBackendError(format!( + return Err(pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "general authenticate command TLV invalid: {request_tlv:?}" )))); } @@ -261,7 +265,7 @@ impl Card { // Extract the challenge field. let request_tlvs = match request_tlv.value() { Value::Primitive(_) => { - return Err(custom_err!(TeleportRdpdrBackendError(format!( + return Err(pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "general authenticate command TLV invalid: {request_tlv:?}" )))); } @@ -275,14 +279,14 @@ impl Card { challenge = match data.value() { Value::Primitive(chal) => Some(chal), Value::Constructed(_) => { - return Err(custom_err!(TeleportRdpdrBackendError(format!( + return Err(pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "general authenticate command TLV invalid: {request_tlv:?}" )))); } }; } let challenge = challenge.ok_or_else(|| { - custom_err!(TeleportRdpdrBackendError(format!( + pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "general authenticate command TLV invalid: {request_tlv:?}, missing challenge data" ))) })?; @@ -407,7 +411,7 @@ const TLV_TAG_RESPONSE: u8 = 0x82; fn tlv(tag: u8, value: Value) -> PduResult { Tlv::new(tlv_tag(tag)?, value).map_err(|e| { - custom_err!(TeleportRdpdrBackendError(format!( + pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "TLV with tag {tag:#X} invalid: {e:?}" ))) }) @@ -415,7 +419,7 @@ fn tlv(tag: u8, value: Value) -> PduResult { fn tlv_tag(val: u8) -> PduResult { Tag::try_from(val).map_err(|e| { - custom_err!(TeleportRdpdrBackendError(format!( + pdu_other_err!("", source:TeleportRdpdrBackendError(format!( "TLV tag {val:#X} invalid: {e:?}" ))) }) diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs index 61b12da5547fd..bf6c2e7ff6d51 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr.rs @@ -28,13 +28,14 @@ use self::tdp::{ }; use crate::client::ClientHandle; use crate::CgoHandle; -use ironrdp_pdu::{custom_err, PduResult}; +use ironrdp_core::impl_as_any; +use ironrdp_pdu::{pdu_other_err, PduResult}; use ironrdp_rdpdr::pdu::efs::{ DeviceControlRequest, NtStatus, ServerDeviceAnnounceResponse, ServerDriveIoRequest, }; use ironrdp_rdpdr::pdu::esc::{ScardCall, ScardIoCtlCode}; use ironrdp_rdpdr::RdpdrBackend; -use ironrdp_svc::{impl_as_any, SvcMessage}; +use ironrdp_svc::SvcMessage; #[derive(Debug)] pub struct TeleportRdpdrBackend { @@ -56,10 +57,13 @@ impl RdpdrBackend for TeleportRdpdrBackend { // If the device announce for the smart card failed, return an error that will end the session. // Authentication is impossible without a smart card. if pdu.device_id == SCARD_DEVICE_ID && pdu.result_code != NtStatus::SUCCESS { - return Err(custom_err!(TeleportRdpdrBackendError(format!( - "ServerDeviceAnnounceResponse for smartcard failed with NtStatus: {:?}", - pdu.result_code - )))); + return Err(pdu_other_err!( + "", + source:TeleportRdpdrBackendError(format!( + "ServerDeviceAnnounceResponse for smartcard failed with NtStatus: {:?}", + pdu.result_code + )) + )); } // If the device announce is not for a smart card, assume it's for a directory @@ -87,9 +91,13 @@ impl RdpdrBackend for TeleportRdpdrBackend { self.fs.handle_rdp_drive_io_request(req)?; Ok(vec![]) } else { - Err(custom_err!(TeleportRdpdrBackendError( - "Received a directory sharing PDU but directory sharing is not enabled".to_string() - ))) + Err(pdu_other_err!( + "", + source:TeleportRdpdrBackendError( + "Received a directory sharing PDU but directory sharing is not enabled" + .to_string() + ) + )) } } } diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/filesystem.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/filesystem.rs index a954af5d0571e..422947f215190 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/filesystem.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/filesystem.rs @@ -18,13 +18,16 @@ use super::{ path::UnixPath, tdp::{self, TdpErrCode}, }; +use crate::client::{ClientError, ClientResult}; use crate::{ cgo_tdp_sd_acknowledge, cgo_tdp_sd_create_request, cgo_tdp_sd_delete_request, cgo_tdp_sd_info_request, cgo_tdp_sd_list_request, cgo_tdp_sd_move_request, cgo_tdp_sd_read_request, cgo_tdp_sd_truncate_request, cgo_tdp_sd_write_request, client::ClientHandle, CGOErrCode, CgoHandle, }; -use ironrdp_pdu::{cast_length, custom_err, other_err, PduResult}; +use ironrdp_core::{cast_length, EncodeError}; +use ironrdp_pdu::PduResult; +use ironrdp_pdu::{pdu_other_err, PduError, PduErrorExt}; use ironrdp_rdpdr::pdu::{ self, efs::{self, NtStatus}, @@ -33,6 +36,17 @@ use ironrdp_rdpdr::pdu::{ use log::{debug, warn}; use std::collections::HashMap; use std::convert::TryInto; +use std::fmt::Debug; + +pub(crate) fn cast_length>( + ctx: &str, + field: &str, + s: S, +) -> ClientResult { + s.try_into().map_err(|e| { + ClientError::InternalError(format!("{}: can't convert {}: {:?}", ctx, field, e)) + }) +} /// `FilesystemBackend` implements the filesystem redirection backend as described in [\[MS-RDPEFS\]: Remote Desktop Protocol: File System Virtual Channel Extension]. /// It does so in concert with the TDP directory sharing extension described in [RFD 0067]. @@ -164,10 +178,13 @@ impl FilesystemBackend { ) -> PduResult<()> { match res.err_code { TdpErrCode::Failed | TdpErrCode::AlreadyExists => { - return Err(custom_err!(FilesystemBackendError(format!( - "received unexpected TDP error code in SharedDirectoryInfoResponse: {:?}", - res.err_code, - )))); + return Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received unexpected TDP error code in SharedDirectoryInfoResponse: {:?}", + res.err_code, + )) + )); } TdpErrCode::Nil => { // The file exists @@ -314,14 +331,17 @@ impl FilesystemBackend { } } _ => { - return Err(custom_err!(FilesystemBackendError(format!( - "received unknown CreateDisposition value for RDP {req:?}", - req = req - )))); + return Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received unknown CreateDisposition value for RDP {req:?}", + req = req + )) + )); } } - Err(other_err!( + Err(pdu_other_err!( "Programmer error, this line should never be reached" )) } @@ -364,9 +384,7 @@ impl FilesystemBackend { ), Some(dir) => { if dir.fso.file_type != tdp::FileType::Directory { - return Err(other_err!( - "received ServerDriveQueryDirectoryRequest request for a file rather than a directory", - )); + return Err(pdu_other_err!("received ServerDriveQueryDirectoryRequest request for a file rather than a directory")); } if rdp_req.initial_query == 0 { @@ -417,10 +435,13 @@ impl FilesystemBackend { // For now any error will kill the session. // In the future, we might want to make this send back // an NTSTATUS::STATUS_UNSUCCESSFUL instead. - return Err(custom_err!(FilesystemBackendError(format!( - "SharedDirectoryListRequest failed with err_code = {:?}", - tdp_resp.err_code - )))); + return Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "SharedDirectoryListRequest failed with err_code = {:?}", + tdp_resp.err_code + )) + )); } // If SharedDirectoryListRequest succeeded, move the @@ -455,10 +476,13 @@ impl FilesystemBackend { ) -> PduResult<()> { match self.file_cache.get(rdp_req.device_io_request.file_id) { // File not found in cache - None => Err(custom_err!(FilesystemBackendError(format!( - "failed to retrieve an item from the file cache with FileId = {}", - rdp_req.device_io_request.file_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "failed to retrieve an item from the file cache with FileId = {}", + rdp_req.device_io_request.file_id + )) + )), Some(dir) => { let buffer: Option = match rdp_req .fs_info_class_lvl @@ -470,7 +494,8 @@ impl FilesystemBackend { "FilesystemBackend::handle_query_volume_req", "dir.fso.last_modified", dir.fso.last_modified - )?, + ) + .map_err(|e: EncodeError| ClientError::from(e))?, // Equivalent to `u32::MAX & 0xffff` which is what FreeRDP does between // https://github.com/FreeRDP/FreeRDP/blob/511444a65e7aa2f537c5e531fa68157a50c1bd4d/winpr/libwinpr/file/file.c#L1018-L1021 // https://github.com/FreeRDP/FreeRDP/blob/511444a65e7aa2f537c5e531fa68157a50c1bd4d/channels/drive/client/drive_main.c#L492 @@ -618,10 +643,13 @@ impl FilesystemBackend { // https://github.com/FreeRDP/FreeRDP/blob/dfa231c0a55b005af775b833f92f6bcd30363d77/channels/drive/client/drive_file.c#L579 self.send_rdp_set_info_response(&rdp_req, io_status) } - _ => Err(custom_err!(FilesystemBackendError(format!( - "received unsupported FileInformationClass value for RDP {:?}", - rdp_req - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received unsupported FileInformationClass value for RDP {:?}", + rdp_req + )) + )), } } @@ -873,7 +901,7 @@ impl FilesystemBackend { completion_id: rdp_req.device_io_request.completion_id, directory_id: rdp_req.device_io_request.device_id, path: file.path.clone(), - end_of_file: cast_length!("end_of_file", end_of_file)?, + end_of_file: cast_length("tdp_sd_truncate", "end_of_file", end_of_file)?, })?; self.pending_sd_truncate_resp_handlers.insert( @@ -891,7 +919,8 @@ impl FilesystemBackend { this.file_cache.get_mut(rdp_req.device_io_request.file_id) { // Truncate succeeded, update our internal books to reflect the new size. - file.fso.size = cast_length!("end_of_file", end_of_file)?; + file.fso.size = + cast_length("tdp_sd_truncate", "end_of_file", end_of_file)?; io_status } else { // This shouldn't happen. @@ -960,10 +989,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_acknowledge(self.cgo_handle, &mut tdp_req) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_acknowledge failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_acknowledge failed: {:?}", + err + )) + )), } } @@ -974,10 +1006,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_info_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_info_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_info_request failed: {:?}", + err + )) + )), } } @@ -991,10 +1026,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_truncate_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_truncate_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_truncate_request failed: {:?}", + err + )) + )), } } @@ -1008,10 +1046,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_create_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_create_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_create_request failed: {:?}", + err + )) + )), } } @@ -1025,10 +1066,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_delete_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_delete_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_delete_request failed: {:?}", + err + )) + )), } } @@ -1039,10 +1083,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_list_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_list_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_list_request failed: {:?}", + err + )) + )), } } @@ -1053,10 +1100,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_read_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_read_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_read_request failed: {:?}", + err + )) + )), } } @@ -1070,10 +1120,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_write_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_write_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_write_request failed: {:?}", + err + )) + )), } } @@ -1084,10 +1137,13 @@ impl FilesystemBackend { let err = unsafe { cgo_tdp_sd_move_request(self.cgo_handle, req.cgo()) }; match err { CGOErrCode::ErrCodeSuccess => Ok(()), - _ => Err(custom_err!(FilesystemBackendError(format!( - "call to tdp_sd_move_request failed: {:?}", - err - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "call to tdp_sd_move_request failed: {:?}", + err + )) + )), } } @@ -1104,10 +1160,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1124,10 +1183,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1144,10 +1206,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1164,10 +1229,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1184,10 +1252,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1204,10 +1275,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1220,10 +1294,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1236,10 +1313,13 @@ impl FilesystemBackend { .remove(&tdp_resp.completion_id) { Some(handler) => handler.call(self, tdp_resp), - None => Err(custom_err!(FilesystemBackendError(format!( - "received invalid completion id: {}", - tdp_resp.completion_id - )))), + None => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received invalid completion id: {}", + tdp_resp.completion_id + )) + )), } } @@ -1266,7 +1346,7 @@ impl FilesystemBackend { { Ok(efs::Information::FILE_OVERWRITTEN) } else { - Err(other_err!( + Err(pdu_other_err!( "program error, CreateDispositionFlags check should be exhaustive" )) }?; @@ -1325,10 +1405,13 @@ impl FilesystemBackend { efs::FileInformationClassLevel::FILE_ATTRIBUTE_TAG_INFORMATION => { self.send_rdp_file_attr_tag_info(device_io_response, file) } - _ => Err(custom_err!(FilesystemBackendError(format!( - "received unsupported FileInformationClass: {:?}", - rdp_req.file_info_class_lvl - )))), + _ => Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received unsupported FileInformationClass: {:?}", + rdp_req.file_info_class_lvl + )) + )), } } @@ -1364,10 +1447,10 @@ impl FilesystemBackend { device_io_response: efs::DeviceIoResponse, file: &FileCacheObject, ) -> PduResult<()> { - let file_fso_size: i64 = cast_length!( + let file_fso_size: i64 = cast_length( "FilesystemBackend::send_file_standard_info", "file.fso.size", - file.fso.size + file.fso.size, )?; self.client_handle.write_rdpdr( @@ -1465,10 +1548,13 @@ impl FilesystemBackend { Some(efs::FileInformationClass::Directory(fso.into_directory()?)) } _ => { - return Err(custom_err!(FilesystemBackendError(format!( - "received unsupported file information class level: {:?}", - req.file_info_class_lvl, - )))); + return Err(pdu_other_err!( + "", + source:FilesystemBackendError(format!( + "received unsupported file information class level: {:?}", + req.file_info_class_lvl, + )) + )); } }; @@ -1586,8 +1672,11 @@ impl FilesystemBackend { req: &efs::ServerDriveSetInformationRequest, io_status: NtStatus, ) -> PduResult<()> { - self.client_handle - .write_rdpdr(efs::ClientDriveSetInformationResponse::new(req, io_status)?.into())?; + self.client_handle.write_rdpdr( + efs::ClientDriveSetInformationResponse::new(req, io_status) + .map_err(|e| PduError::encode("send_rdp_set_info_response", e))? + .into(), + )?; Ok(()) } } @@ -1615,9 +1704,7 @@ impl FileCache { if self.cache.insert(self.next_file_id, file).is_none() { Ok(self.next_file_id) } else { - Err(other_err!( - "attempted to insert a FileCacheObject into the file cache with a file_id that already exists in the cache" - )) + Err(pdu_other_err!("attempted to insert a FileCacheObject into the file cache with a file_id that already exists in the cache")) } } diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/path.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/path.rs index b5d3d7db97b80..fdff99feb1ebd 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/path.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/path.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use ironrdp_pdu::{custom_err, PduResult}; +use ironrdp_pdu::{pdu_other_err, PduResult}; use std::ffi::CString; /// WindowsPath is a String that we assume to be in the form @@ -63,10 +63,10 @@ impl UnixPath { /// any characters that can't be handled by CString::new(). pub fn to_cstring(&self) -> PduResult { CString::new(self.path.clone()).map_err(|e| { - custom_err!(PathError(format!( - "Error converting UnixPath to CString: {}", - e - ))) + pdu_other_err!( + "", + source:PathError(format!("Error converting UnixPath to CString: {}", e)) + ) }) } diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs index cb54d492d8fa4..f5e4acd4962fa 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/scard.rs @@ -16,8 +16,9 @@ use crate::client::ClientHandle; use crate::{piv, util}; +use ironrdp_pdu::pdu_other_err; use ironrdp_pdu::utils::CharacterSet; -use ironrdp_pdu::{custom_err, other_err, PduResult}; +use ironrdp_pdu::PduResult; use ironrdp_rdpdr::pdu::efs::{DeviceControlRequest, DeviceControlResponse, NtStatus}; use ironrdp_rdpdr::pdu::esc::{ rpce, CardProtocol, CardState, CardStateFlags, ConnectCall, ConnectReturn, ContextCall, @@ -154,10 +155,13 @@ impl ScardBackend { ScardCall::GetReaderIconCall(_) => self.handle_get_reader_icon(req), _ => Self::unsupported_combo_error(req.io_control_code, call), }, - _ => Err(custom_err!(SmartcardBackendError(format!( - "received unhandled ScardIoCtlCode: {:?}", - req.io_control_code - )))), + _ => Err(pdu_other_err!( + "", + source:SmartcardBackendError(format!( + "received unhandled ScardIoCtlCode: {:?}", + req.io_control_code + )) + )), }?; Ok(()) @@ -336,10 +340,13 @@ impl ScardBackend { ) -> PduResult<()> { let cmd = CardCommand::::try_from(&call.send_buffer).map_err(|err| { - custom_err!(SmartcardBackendError(format!( - "failed to parse smartcard command {:?}: {:?}", - &call.send_buffer, err - ))) + pdu_other_err!( + "", + source:SmartcardBackendError(format!( + "failed to parse smartcard command {:?}: {:?}", + &call.send_buffer, err + )) + ) })?; let card = self.contexts.get_card(&call.handle)?; @@ -356,10 +363,13 @@ impl ScardBackend { ScardIoCtlCode::StatusW => CharacterSet::Unicode, ScardIoCtlCode::StatusA => CharacterSet::Ansi, _ => { - return Err(custom_err!(SmartcardBackendError(format!( - "got unexpected ScardIoCtlCode with a StatusCall: {:?}", - req.io_control_code - )))); + return Err(pdu_other_err!( + "", + source:SmartcardBackendError(format!( + "got unexpected ScardIoCtlCode with a StatusCall: {:?}", + req.io_control_code + )) + )); } }; @@ -457,10 +467,13 @@ impl ScardBackend { GetDeviceTypeIdReturn::new(ReturnCode::Success, SCARD_READER_TYPE_VENDOR), ) } else { - Err(custom_err!(SmartcardBackendError(format!( - "got GetDeviceTypeIdCall for unknown context [{}]", - call.context.value - )))) + Err(pdu_other_err!( + "", + source:SmartcardBackendError(format!( + "got GetDeviceTypeIdCall for unknown context [{}]", + call.context.value + )) + )) } } @@ -497,10 +510,13 @@ impl ScardBackend { /// This function returns the error for unsupported combinations of [`ScardIoCtlCode`] and [`ScardCall`]. fn unsupported_combo_error(ioctl: ScardIoCtlCode, call: ScardCall) -> PduResult<()> { - Err(custom_err!(SmartcardBackendError(format!( - "received unsupported combination of ScardIoCtlCode [{:?}] with ScardCall [{:?}]", - ioctl, call - )))) + Err(pdu_other_err!( + "", + source:SmartcardBackendError(format!( + "received unsupported combination of ScardIoCtlCode [{:?}] with ScardCall [{:?}]", + ioctl, call + )) + )) } fn send_device_control_response( @@ -570,7 +586,7 @@ impl Contexts { fn get_card(&mut self, handle: &ScardHandle) -> PduResult<&mut piv::Card> { self.get_internal_mut(handle.context.value)? .get(handle.value) - .ok_or_else(|| other_err!("unknown ScardHandle")) + .ok_or_else(|| pdu_other_err!("unknown ScardHandle")) } fn exists(&self, id: u32) -> bool { @@ -592,7 +608,7 @@ impl Contexts { fn get_internal_mut(&mut self, id: u32) -> PduResult<&mut ContextInternal> { self.contexts .get_mut(&id) - .ok_or_else(|| other_err!("unknown context id")) + .ok_or_else(|| pdu_other_err!("unknown context id")) } fn release(&mut self, id: u32) { @@ -627,7 +643,7 @@ impl ContextInternal { fn set_scard_cancel_response(&mut self, resp: DeviceControlResponse) -> PduResult<()> { if self.scard_cancel_response.is_some() { - return Err(other_err!("SCARD_IOCTL_CANCEL already received",)); + return Err(pdu_other_err!("SCARD_IOCTL_CANCEL already received",)); } self.scard_cancel_response = Some(resp); Ok(()) diff --git a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/tdp.rs b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/tdp.rs index 0c87aaca06162..34cbccfd5aed8 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/rdpdr/tdp.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/rdpdr/tdp.rs @@ -15,6 +15,7 @@ // along with this program. If not, see . use super::{filesystem::FileCacheObject, path::UnixPath}; +use crate::rdpdr::filesystem::cast_length; use crate::{ util::{self, from_c_string, from_go_array}, CGOSharedDirectoryAnnounce, CGOSharedDirectoryCreateRequest, CGOSharedDirectoryCreateResponse, @@ -23,11 +24,13 @@ use crate::{ CGOSharedDirectoryReadRequest, CGOSharedDirectoryReadResponse, CGOSharedDirectoryTruncateRequest, CGOSharedDirectoryWriteRequest, }; -use ironrdp_pdu::{cast_length, custom_err, PduResult}; + +use ironrdp_pdu::pdu_other_err; +use ironrdp_pdu::PduResult; use ironrdp_rdpdr::pdu::efs::{ self, DeviceCloseRequest, DeviceCreateRequest, DeviceReadRequest, DeviceWriteRequest, }; -use std::convert::TryInto; + use std::ffi::CString; /// SharedDirectoryAnnounce is sent by the TDP client to the server @@ -137,10 +140,13 @@ impl FileSystemObject { if let Some(name) = self.path.last() { Ok(name.to_string()) } else { - Err(custom_err!(TdpHandlingError(format!( - "failed to extract name from path: {:?}", - self.path - )))) + Err(pdu_other_err!( + "", + source:TdpHandlingError(format!( + "failed to extract name from path: {:?}", + self.path + )) + )) } } @@ -158,10 +164,10 @@ impl FileSystemObject { last_modified, last_modified, last_modified, - cast_length!( + cast_length( "FileSystemObject::into_both_directory", "self.size", - self.size + self.size, )?, file_attributes, self.name()?, @@ -182,10 +188,10 @@ impl FileSystemObject { last_modified, last_modified, last_modified, - cast_length!( + cast_length( "FileSystemObject::into_both_directory", "self.size", - self.size + self.size, )?, file_attributes, self.name()?, @@ -210,7 +216,7 @@ impl FileSystemObject { last_modified, last_modified, last_modified, - cast_length!("FileSystemObject::into_directory", "self.size", self.size)?, + cast_length("FileSystemObject::into_directory", "self.size", self.size)?, file_attributes, self.name()?, )) diff --git a/lib/srv/desktop/rdp/rdpclient/src/util.rs b/lib/srv/desktop/rdp/rdpclient/src/util.rs index 95b6f6cf56357..bc1c61fb03ab7 100644 --- a/lib/srv/desktop/rdp/rdpclient/src/util.rs +++ b/lib/srv/desktop/rdp/rdpclient/src/util.rs @@ -14,7 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -use ironrdp_pdu::{other_err, PduResult}; +use ironrdp_pdu::pdu_other_err; +use ironrdp_pdu::PduResult; use std::ffi::CStr; use std::os::raw::c_char; use std::slice; @@ -40,7 +41,7 @@ pub fn to_unicode(s: &str, with_null_term: bool) -> Vec { #[allow(clippy::bind_instead_of_map)] pub fn from_unicode(s: Vec) -> PduResult { let mut with_null_terminator = WString::from_utf16le(s) - .or_else(|_| Err(other_err!("invalid Unicode")))? + .or_else(|_| Err(pdu_other_err!("invalid Unicode")))? .to_utf8(); with_null_terminator.pop(); let without_null_terminator = with_null_terminator; @@ -49,7 +50,7 @@ pub fn from_unicode(s: Vec) -> PduResult { pub fn from_utf8(s: Vec) -> PduResult { let mut with_null_terminator = - String::from_utf8(s).map_err(|_| other_err!("invalid Unicode"))?; + String::from_utf8(s).map_err(|_| pdu_other_err!("invalid Unicode"))?; with_null_terminator.pop(); let without_null_terminator = with_null_terminator; Ok(without_null_terminator) diff --git a/web/packages/teleport/src/ironrdp/Cargo.toml b/web/packages/teleport/src/ironrdp/Cargo.toml index e90c4eee57d7b..382394b7b2e6b 100644 --- a/web/packages/teleport/src/ironrdp/Cargo.toml +++ b/web/packages/teleport/src/ironrdp/Cargo.toml @@ -15,6 +15,7 @@ console_error_panic_hook = "0.1.7" getrandom = { version = "0.2", features = ["js"] } ironrdp-session.workspace = true ironrdp-pdu.workspace = true +ironrdp-core.workspace = true ironrdp-graphics.workspace = true js-sys = "0.3.69" log = "0.4.21" diff --git a/web/packages/teleport/src/ironrdp/src/lib.rs b/web/packages/teleport/src/ironrdp/src/lib.rs index fef5c168eac02..9eb001862d7b0 100644 --- a/web/packages/teleport/src/ironrdp/src/lib.rs +++ b/web/packages/teleport/src/ironrdp/src/lib.rs @@ -17,13 +17,13 @@ // default trait not supported in wasm #![allow(clippy::new_without_default)] +use ironrdp_core::decode_cursor; +use ironrdp_core::ReadCursor; +use ironrdp_core::WriteBuf; use ironrdp_graphics::image_processing::PixelFormat; -use ironrdp_pdu::cursor::ReadCursor; -use ironrdp_pdu::decode_cursor; use ironrdp_pdu::fast_path::UpdateCode::{Bitmap, SurfaceCommands}; use ironrdp_pdu::fast_path::{FastPathHeader, FastPathUpdatePdu}; use ironrdp_pdu::geometry::{InclusiveRectangle, Rectangle}; -use ironrdp_pdu::write_buf::WriteBuf; use ironrdp_session::fast_path::UpdateKind; use ironrdp_session::image::DecodedImage; use ironrdp_session::ActiveStageOutput;