commit b4a4a256db08d14093edf442ab77e8a1763ee80b Author: Cecylia Bocovich cohosh@torproject.org Date: Fri Apr 12 09:52:23 2019 -0400
Ported log sanitization to client --- client/snowflake.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/client/snowflake.go b/client/snowflake.go index 006de6b..715f83f 100644 --- a/client/snowflake.go +++ b/client/snowflake.go @@ -16,6 +16,7 @@ import (
"git.torproject.org/pluggable-transports/goptlib.git" sf "git.torproject.org/pluggable-transports/snowflake.git/client/lib" + "git.torproject.org/pluggable-transports/snowflake.git/common/safelog" "github.com/keroserene/go-webrtc" )
@@ -77,6 +78,12 @@ func main() { webrtc.SetLoggingVerbosity(1) log.SetFlags(log.LstdFlags | log.LUTC)
+ // Don't write to stderr; versions of tor earlier than about + // 0.3.5.6 do not read from the pipe, and eventually we will + // deadlock because the buffer is full. + // https://bugs.torproject.org/26360 + // https://bugs.torproject.org/25600#comment:14 + var logOutput io.Writer = ioutil.Discard if *logFilename != "" { if *logToStateDir { stateDir, err := pt.MakeStateDir() @@ -91,15 +98,10 @@ func main() { log.Fatal(err) } defer logFile.Close() - log.SetOutput(logFile) - } else { - // Don't write to stderr; versions of tor earlier than about - // 0.3.5.6 do not read from the pipe, and eventually we will - // deadlock because the buffer is full. - // https://bugs.torproject.org/26360 - // https://bugs.torproject.org/25600#comment:14 - log.SetOutput(ioutil.Discard) + logOutput = logFile } + //We want to send the log output through our scrubber first + log.SetOutput(&safelog.LogScrubber{Output: logOutput})
log.Println("\n\n\n --- Starting Snowflake Client ---")
tor-commits@lists.torproject.org