Created
December 3, 2018 01:30
-
-
Save singpolyma/50aa32157b727871fa1f569ddcfc0721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 7a3ac037e57f mod_onions/mod_onions.lua | |
--- a/mod_onions/mod_onions.lua Fri Jun 08 21:59:42 2018 +0200 | |
+++ b/mod_onions/mod_onions.lua Mon Dec 03 01:28:59 2018 +0000 | |
@@ -148,12 +148,16 @@ | |
end | |
function socks5listener.onconnect(conn) | |
+ if not sessions[conn].socks5_handler == socks5_handshake_sent then | |
+ | |
module:log("debug", "Connected to SOCKS5 proxy, sending SOCKS5 handshake."); | |
-- Socks version 5, 1 method, no auth | |
conn:write(c(5) .. c(1) .. c(0)); | |
sessions[conn].socks5_handler = socks5_handshake_sent; | |
+ | |
+ end | |
end | |
function socks5listener.register_outgoing(conn, session) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This
if
condition is almost certainly not what you intended. Due to operator precedence rules, the 'not' affects the immediately adjacent value, i.e. it will turnsessions[conn].socks5_handler
into eithertrue
orfalse
and proceed to compare that withsocks5_handshake_sent
(which is always a function value).You can test this easily in the Lua REPL:
Now, since you said this patch actually fixes your issue, I think we need to further understand the problem...