[tor-bugs] #1922 [Tor]: torrc.d-style configuration directories

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Aug 29 06:33:18 UTC 2013


#1922: torrc.d-style configuration directories
-----------------------------+------------------------------
     Reporter:  aa138346     |      Owner:
         Type:  enhancement  |     Status:  needs_revision
     Priority:  normal       |  Milestone:  Tor: unspecified
    Component:  Tor          |    Version:
   Resolution:               |   Keywords:  tor-client
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+------------------------------
Changes (by nickm):

 * status:  needs_review => needs_revision


Comment:

 Quick notes:
   * We don't use malloc; we use tor_malloc.
   * We don't use free; see tor_free.
   * Please use the same indentation style as the rest of Tor.
   * strcpy? Please, no. We don't want heap overflows.
     * In fact, please don't use strcpy in any other program that's
 supposed to be secure.
   * Please no bubble sorts, insertion sorts, or other inefficient
 reimplementations of algorithms that are supposed to be O(n lg n). Just
 use smartlist_sort() or smartlist_sort_strings().
   * Rather than hardwiring "/etc/", try using CONFDIR ?
   * If we can't get FN_FILE from file_status(), why skip the file?
 Shouldn't we warn?
   * Nothing in this code frees dirlist or its contents.
   * Rather than making a fake command line and passing it to
 load_torrc_from_disk(), why not refactor the code into two functions: one
 to find the right configuration file, and the other to read and parse it.
 That way, this code could only send the second one.

 Some more fundamental issues
   * I thought that the semantics of options_init_from_string were that it
 replaced the current configuration with cf_defaults+cf. But that appears
 to means that, in this code, the original torrc file is completely
 replaced with the first file in /etc/tor.d/, then by the second, then by
 the third, and so on.  (Is this tested?)
   * It seems that for an ordinary Tor user, there's no way to override
 this stuff.  If the system has an /etc/tor.d, I can't override those
 options even with "-f my_torrc", since the torrc is considered second, and
 the /etc/tor.d contents are considered last.  There is no way to override
 that directory with another one, either.  I don't think that can be the
 right way to do it, can it?

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


More information about the tor-bugs mailing list