From eb13b2ff4b759100a7eaa5f7424f7d9536babbe6 Mon Sep 17 00:00:00 2001 From: Cecylia Bocovich Date: Wed, 19 Feb 2025 14:33:32 -0500 Subject: [PATCH] Copy base client config for each SOCKS connection Fixes a bug where socksAcceptLoop was reusing the same client config when processing arguments from multiple SOCKS connections, causing different bridge lines to clobber each other. --- client/snowflake.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/snowflake.go b/client/snowflake.go index 648481f..d7cecbb 100644 --- a/client/snowflake.go +++ b/client/snowflake.go @@ -60,7 +60,8 @@ func copyLoop(socks, sfconn io.ReadWriter) { } // Accept local SOCKS connections and connect to a Snowflake connection -func socksAcceptLoop(ln *pt.SocksListener, config sf.ClientConfig, shutdown chan struct{}, wg *sync.WaitGroup) { +func socksAcceptLoop(ln *pt.SocksListener, baseConfig sf.ClientConfig, + shutdown chan struct{}, wg *sync.WaitGroup) { defer ln.Close() for { conn, err := ln.AcceptSocks() @@ -77,6 +78,7 @@ func socksAcceptLoop(ln *pt.SocksListener, config sf.ClientConfig, shutdown chan defer wg.Done() defer conn.Close() + config := baseConfig // Check to see if our command line options are overriden by SOCKS options if arg, ok := conn.Req.Args.Get("ampcache"); ok { config.AmpCacheURL = arg