commit 60a611d110481b237dc62516493bbccf1cb61389 Author: David Fifield david@bamsoftware.com Date: Mon Jan 28 22:26:23 2013 -0800
Add dummy reading of auth cookie file. --- websocket-transport/pt.go | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/websocket-transport/pt.go b/websocket-transport/pt.go index ac5270e..d5435fa 100644 --- a/websocket-transport/pt.go +++ b/websocket-transport/pt.go @@ -259,12 +259,21 @@ func getServerBindAddrs(methodNames []string) []PtBindAddr { return result }
+// Reads and validates the contents of an auth cookie file. Returns the 32-byte +// cookie. See section 4.2.1.2 of pt-spec.txt. +func readAuthCookieFile(filename string) ([]byte, error) { + cookie := make([]byte, 32) + + return cookie, nil +} + // This structure is returned by PtServerSetup. It consists of a list of // PtBindAddrs, along with a single address for the ORPort. type PtServerInfo struct { BindAddrs []PtBindAddr OrAddr *net.TCPAddr ExtendedOrAddr *net.TCPAddr + AuthCookie []byte }
// Check the server pluggable transports environments, emitting an error message @@ -302,5 +311,13 @@ func PtServerSetup(methodNames []string) PtServerInfo { } }
+ var authCookieFilename = getenv("TOR_PT_AUTH_COOKIE_FILE") + if authCookieFilename != "" { + info.AuthCookie, err = readAuthCookieFile(authCookieFilename) + if err != nil { + PtEnvError(fmt.Sprintf("error reading TOR_PT_AUTH_COOKIE_FILE %q: %s", authCookieFilename, err.Error())) + } + } + return info }