[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [goptlib/master] Give a more specific error when TOR_PT_AUTH_COOKIE_FILE is missing.
commit 1b43761ebbb97d54de2253dcd28090f99efaa239
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date: Sun Dec 13 21:46:49 2015 -0800
Give a more specific error when TOR_PT_AUTH_COOKIE_FILE is missing.
Before, if you set TOR_PT_EXTENDED_SERVER_PORT but not
TOR_PT_AUTH_COOKIE_FILE, you would get the misleading error message:
ENV-ERROR need TOR_PT_ORPORT or TOR_PT_EXTENDED_SERVER_PORT environment variable
Now you get:
ENV-ERROR need TOR_PT_AUTH_COOKIE_FILE environment variable with TOR_PT_EXTENDED_SERVER_PORT
---
pt.go | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/pt.go b/pt.go
index d2aedca..a838308 100644
--- a/pt.go
+++ b/pt.go
@@ -668,18 +668,23 @@ func ServerSetup(_ []string) (info ServerInfo, err error) {
}
}
+ info.AuthCookiePath = getenv("TOR_PT_AUTH_COOKIE_FILE")
+
extendedOrPort := getenv("TOR_PT_EXTENDED_SERVER_PORT")
if extendedOrPort != "" {
+ if info.AuthCookiePath == "" {
+ err = envError("need TOR_PT_AUTH_COOKIE_FILE environment variable with TOR_PT_EXTENDED_SERVER_PORT")
+ return
+ }
info.ExtendedOrAddr, err = resolveAddr(extendedOrPort)
if err != nil {
err = envError(fmt.Sprintf("cannot resolve TOR_PT_EXTENDED_SERVER_PORT %q: %s", extendedOrPort, err.Error()))
return
}
}
- info.AuthCookiePath = getenv("TOR_PT_AUTH_COOKIE_FILE")
// Need either OrAddr or ExtendedOrAddr.
- if info.OrAddr == nil && (info.ExtendedOrAddr == nil || info.AuthCookiePath == "") {
+ if info.OrAddr == nil && info.ExtendedOrAddr == nil {
err = envError("need TOR_PT_ORPORT or TOR_PT_EXTENDED_SERVER_PORT environment variable")
return
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits