[tor-bugs] #4471 [arm]: Arm crashes with 'ControlPort auto'

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Tue Nov 15 16:19:43 UTC 2011


#4471: Arm crashes with 'ControlPort auto'
--------------------+-------------------------------------------------------
 Reporter:  atagar  |          Owner:  atagar
     Type:  defect  |         Status:  new   
 Priority:  normal  |      Milestone:        
Component:  arm     |        Version:        
 Keywords:          |         Parent:        
   Points:          |   Actualpoints:        
--------------------+-------------------------------------------------------
 Arm assumes querying 'GETCONF ControlPort' either provides an int or
 fails. The new 'auto' argument breaks this assumption, causing a
 stacktrace...

 {{{
 cba at cluster3:~$ sudo arm --interface 127.0.0.1:46632
 Traceback (most recent call last):
   File "/usr/share/arm/starter.py", line 390, in <module>
     interface.controller.startTorMonitor(time.time() - initTime,
 expandedEvents, param["startup.blindModeEnabled"])
   File "/usr/share/arm/interface/controller.py", line 1918, in
 startTorMonitor
     curses.wrapper(drawTorMonitor, startTime, loggedEvents, isBlindMode)
   File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
     return func(stdscr, *args, **kwds)
   File "/usr/share/arm/interface/controller.py", line 458, in
 drawTorMonitor
     torPid = torTools.getConn().getMyPid()
   File "/usr/share/arm/util/torTools.py", line 839, in getMyPid
     return self._getRelayAttr("pid", None)
   File "/usr/share/arm/util/torTools.py", line 1647, in _getRelayAttr
     result = getPid(int(self.getOption("ControlPort", 9051)),
 self.getOption("PidFile"))
 ValueError: invalid literal for int() with base 10: 'auto'
 }}}

 On first glance there's four spots that need to be fixed...
 {{{
 atagar at morrigan:~/Desktop/arm$ grep -R "getOption(\"ControlPort" src/
 src/cli/headerPanel.py:      self.vals["tor/controlPort"] =
 conn.getOption("ControlPort", "0")
 src/cli/connections/connEntry.py:    myCtlPort =
 conn.getOption("ControlPort")
 src/cli/graphing/connStats.py:      self.controlPort =
 conn.getOption("ControlPort", "0")
 src/util/torTools.py:          result =
 getPid(int(self.getOption("ControlPort", 9051)),
 self.getOption("PidFile"))
 }}}

 The change should be an isdigit check on the response and, if it fails,
 use the default value (the second argument in the getOption call or None
 if undefined).

 This was caught by PurplePeter.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4471>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list