commit 9b653e81ba24b154510e8fc39222de5c96478bc2 Author: Damian Johnson atagar@torproject.org Date: Sun Apr 24 12:21:34 2011 -0700
fix: Workaround for autogenerated Nickname config
As discussed in ticket 2362 (https://trac.torproject.org/projects/tor/ticket/2362) the "GETINFO config-text" results provide an autogenerated Nickname field if running as a relay and one wasn't provided. --- src/util/torConfig.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/util/torConfig.py b/src/util/torConfig.py index 2e70f5a..030a169 100644 --- a/src/util/torConfig.py +++ b/src/util/torConfig.py @@ -3,6 +3,7 @@ Helper functions for working with tor's configuration file. """
import os +import socket import threading
from util import enum, log, sysTools, torTools, uiTools @@ -367,13 +368,16 @@ def getCustomOptions(includeValue = False): configLines = list(set(configLines))
# The "GETINFO config-text" query only provides options that differ - # from Tor's defaults with the exception of its Log entry which, even - # if undefined, returns "Log notice stdout" as per: + # from Tor's defaults with the exception of its Log and Nickname entries + # which, even if undefined, returns "Log notice stdout" as per: # https://trac.torproject.org/projects/tor/ticket/2362
try: configLines.remove("Log notice stdout") except ValueError: pass
+ try: configLines.remove("Nickname %s" % socket.gethostname()) + except ValueError: pass + if includeValue: return configLines else: return [line[:line.find(" ")] for line in configLines]
tor-commits@lists.torproject.org