From 1d1781c7d7f72be82c5a95ec361c9ab8b5b28cb0 Mon Sep 17 00:00:00 2001 From: DJMrTV Date: Sat, 17 May 2025 22:13:48 +0200 Subject: [PATCH] fix: fix sending back incorrect supported functions --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++++ src/lib.rs | 11 +++++++++++ src/main.rs | 10 +++++++--- src/prudp/socket.rs | 4 ++-- 5 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 08dd9dc..cc388be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1472,7 +1472,7 @@ checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", "rand_core 0.9.3", - "zerocopy 0.8.14", + "zerocopy 0.8.25", ] [[package]] @@ -2681,11 +2681,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.25", ] [[package]] @@ -2701,9 +2701,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 9e95990..c384cb3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,6 +43,9 @@ paste = "1.0.15" typenum = "1.18.0" futures = "0.3.31" + + + [build-dependencies] tonic-build = "0.12.3" @@ -50,3 +53,4 @@ tonic-build = "0.12.3" default = ["secure", "auth"] secure = [] auth = [] + diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..01d0d4d --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,11 @@ +mod endianness; +mod prudp; +pub mod rmc; +//mod protocols; + +mod grpc; +mod kerberos; +mod nex; +mod result; +mod versions; +mod web; diff --git a/src/main.rs b/src/main.rs index 774adea..64ee3b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -278,7 +278,9 @@ async fn start_auth() -> JoinHandle<()> { .expect("unable to start router"); let mut socket_secure = router_secure - .add_socket(VirtualPort::new(1, 10), Unsecure("6f599f81")) + .add_socket(VirtualPort::new(1, 10), Unsecure( + "6f599f81" + )) .await .expect("unable to add socket"); @@ -322,8 +324,10 @@ async fn start_secure() -> JoinHandle<()> { let mut socket_secure = router_secure .add_socket( VirtualPort::new(1, 10), - Secure("6f599f81", &SECURE_SERVER_ACCOUNT), - //Unsecure("6f599f81"), + Secure( + "6f599f81", + &SECURE_SERVER_ACCOUNT + ), ) .await .expect("unable to add socket"); diff --git a/src/prudp/socket.rs b/src/prudp/socket.rs index 3657290..5bb08f9 100644 --- a/src/prudp/socket.rs +++ b/src/prudp/socket.rs @@ -301,7 +301,7 @@ impl InternalSocket { for options in &packet.options { match options { SupportedFunctions(functions) => { - response.options.push(SupportedFunctions(*functions & 0x04)) + response.options.push(SupportedFunctions(*functions & 0xFF)) } MaximumSubstreamId(max_substream) => { response.options.push(MaximumSubstreamId(*max_substream)) @@ -462,7 +462,7 @@ impl InternalSocket { MaximumSubstreamId(max_substream) => { response.options.push(MaximumSubstreamId(*max_substream)) } - SupportedFunctions(funcs) => response.options.push(SupportedFunctions(*funcs)), + SupportedFunctions(funcs) => response.options.push(SupportedFunctions(*funcs & 0xFF)), _ => { /* ? */ } } }