From abff1a4ec197edd06279f3cc3b8d0b474b07aa1d Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Sat, 6 Nov 2021 20:56:33 -0700 Subject: [PATCH] Remove a duplicated firewall check. --- src/server.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/server.rs b/src/server.rs index 896c051..6e3e469 100644 --- a/src/server.rs +++ b/src/server.rs @@ -85,7 +85,7 @@ impl SOCKSv5Server { let params = self.security_parameters.clone(); let network_mutex_copy = locked_network.clone(); task::spawn(async move { - match run_authentication(params, stream, their_addr.clone(), their_port).await { + match run_authentication(params, stream).await { Ok(authed_stream) => { match run_main_loop(network_mutex_copy, authed_stream).await { Ok(_) => {} @@ -246,18 +246,7 @@ fn reasonable_auth_method_choices() { async fn run_authentication( params: SecurityParameters, mut stream: GenericStream, - addr: SOCKSv5Address, - port: u16, ) -> Result { - // before we do anything at all, we check to see if we just want to blindly reject - // this connection, utterly and completely. - if let Some(firewall_allows) = params.allow_connection { - if !firewall_allows(&addr, port) { - return Err(AuthenticationError::FirewallRejected(addr, port)); - } - } - - // OK, I guess we'll listen to you let greeting = ClientGreeting::read(&mut stream).await?; match choose_authentication_method(¶ms, &greeting.acceptable_methods) {