feat(rdpdr): *nix backend for file upload/download (#497)

This commit is contained in:
zmrush
2024-07-31 10:11:25 +00:00
committed by GitHub
parent ea60fcacbb
commit 20e60bc415
10 changed files with 861 additions and 11 deletions
Generated
+33 -4
View File
@@ -575,6 +575,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chrono"
version = "0.4.38"
@@ -2292,6 +2298,17 @@ dependencies = [
"tracing",
]
[[package]]
name = "ironrdp-rdpdr-native"
version = "0.1.0"
dependencies = [
"ironrdp-pdu",
"ironrdp-rdpdr",
"ironrdp-svc",
"nix 0.29.0",
"tracing",
]
[[package]]
name = "ironrdp-rdpsnd"
version = "0.1.0"
@@ -2524,9 +2541,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.154"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libloading"
@@ -2858,6 +2875,18 @@ dependencies = [
"memoffset 0.7.1",
]
[[package]]
name = "nix"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
"bitflags 2.4.2",
"cfg-if",
"cfg_aliases 0.2.1",
"libc",
]
[[package]]
name = "nom"
version = "7.1.3"
@@ -4308,7 +4337,7 @@ checksum = "f266ce2aa23eaaaa4e758ed44495d505d00fb79f359d46f6c1900cb053123b62"
dependencies = [
"as-raw-xcb-connection",
"bytemuck",
"cfg_aliases",
"cfg_aliases 0.1.1",
"cocoa",
"core-graphics 0.23.1",
"drm",
@@ -5654,7 +5683,7 @@ checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94"
dependencies = [
"android-activity",
"bitflags 1.3.2",
"cfg_aliases",
"cfg_aliases 0.1.1",
"core-foundation",
"core-graphics 0.22.3",
"dispatch",
+1
View File
@@ -42,6 +42,7 @@ ironrdp-pdu-generators = { path = "crates/ironrdp-pdu-generators" }
ironrdp-pdu = { version = "0.1", path = "crates/ironrdp-pdu" }
ironrdp-rdcleanpath = { version = "0.1", path = "crates/ironrdp-rdcleanpath" }
ironrdp-rdpdr = { version = "0.1", path = "crates/ironrdp-rdpdr" }
ironrdp-rdpdr-native = { version = "0.1", path = "crates/ironrdp-rdpdr-native" }
ironrdp-rdpsnd = { version = "0.1", path = "crates/ironrdp-rdpsnd" }
ironrdp-rdpsnd-native = { version = "0.1", path = "crates/ironrdp-rdpsnd-native" }
ironrdp-server = { version = "0.1", path = "crates/ironrdp-server" }
+24
View File
@@ -0,0 +1,24 @@
[package]
name = "ironrdp-rdpdr-native"
version = "0.1.0"
readme = "README.md"
description = "Native RDPDR static channel backend implementations for IronRDP"
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
authors.workspace = true
keywords.workspace = true
categories.workspace = true
[lib]
doctest = false
test = false
[target.'cfg(any(target_os = "macos", target_os = "linux"))'.dependencies]
ironrdp-pdu.workspace = true
ironrdp-svc.workspace = true
ironrdp-rdpdr.workspace = true
nix = { version = "0.29", features = ["fs", "dir"] }
tracing.workspace = true
+3
View File
@@ -0,0 +1,3 @@
# IronRDP RDPDR native backends
Native RDPDR backend implementations. Currently only *nix systems are supported.
+20
View File
@@ -0,0 +1,20 @@
#![doc = include_str!("../README.md")]
#![warn(unsafe_op_in_unsafe_fn)]
#![warn(invalid_reference_casting)]
#![warn(pointer_structural_match)]
#![warn(clippy::undocumented_unsafe_blocks)]
#![warn(clippy::multiple_unsafe_ops_per_block)]
#![warn(clippy::transmute_ptr_to_ptr)]
#![warn(clippy::as_ptr_cast_mut)]
#![warn(clippy::cast_ptr_alignment)]
#![warn(clippy::fn_to_numeric_cast_any)]
#![warn(clippy::ptr_cast_constness)]
#[cfg(any(target_os = "macos", target_os = "linux"))]
#[macro_use]
extern crate tracing;
#[cfg(any(target_os = "macos", target_os = "linux"))]
mod nix;
#[cfg(any(target_os = "macos", target_os = "linux"))]
pub use nix::backend;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
pub mod backend;
+2 -1
View File
@@ -7,10 +7,11 @@ use ironrdp_svc::AsAny;
use crate::pdu::efs::{DeviceControlRequest, ServerDeviceAnnounceResponse, ServerDriveIoRequest};
use crate::pdu::esc::{ScardCall, ScardIoCtlCode};
use ironrdp_svc::SvcMessage;
/// OS-specific device redirection backend interface.
pub trait RdpdrBackend: AsAny + fmt::Debug + Send {
fn handle_server_device_announce_response(&mut self, pdu: ServerDeviceAnnounceResponse) -> PduResult<()>;
fn handle_scard_call(&mut self, req: DeviceControlRequest<ScardIoCtlCode>, call: ScardCall) -> PduResult<()>;
fn handle_drive_io_request(&mut self, req: ServerDriveIoRequest) -> PduResult<()>;
fn handle_drive_io_request(&mut self, req: ServerDriveIoRequest) -> PduResult<Vec<SvcMessage>>;
}
+3 -3
View File
@@ -1,5 +1,5 @@
use ironrdp_pdu::PduResult;
use ironrdp_svc::impl_as_any;
use ironrdp_svc::{impl_as_any, SvcMessage};
use super::RdpdrBackend;
use crate::pdu::efs::{DeviceControlRequest, ServerDeviceAnnounceResponse};
@@ -17,7 +17,7 @@ impl RdpdrBackend for NoopRdpdrBackend {
fn handle_scard_call(&mut self, _req: DeviceControlRequest<ScardIoCtlCode>, _call: ScardCall) -> PduResult<()> {
Ok(())
}
fn handle_drive_io_request(&mut self, _req: crate::pdu::efs::ServerDriveIoRequest) -> PduResult<()> {
Ok(())
fn handle_drive_io_request(&mut self, _req: crate::pdu::efs::ServerDriveIoRequest) -> PduResult<Vec<SvcMessage>> {
Ok(Vec::new())
}
}
+1 -3
View File
@@ -165,9 +165,7 @@ impl Rdpdr {
debug!(?req);
self.backend.handle_drive_io_request(req)?;
Ok(Vec::new())
Ok(self.backend.handle_drive_io_request(req)?)
}
_ => {
// This should never happen, as we only announce devices that we support.