Finally, stopped with this final patch: client.c:client_try() function ... ssl_start(c); if(c->opt->protocol_middle) { if (redirect(c)) c->opt->already_redirected = 1; else c->opt->protocol_middle(c); } remote_start(c); ... ---
client.c:redirect() function (to prevent all the logic in redirect() function called twice - saves some ticks, kind of): NOEXPORT int redirect(CLI *c) { ... if (c->opt->already_redirected) { c->opt->already_redirected = 0; return 1; } ...
---
Works as a charm. Now "protocol = socks" "accept" port doesn't expose itself to non-authorized connections.