Skip to content
  • Kathleen Brade's avatar
    Bug 20185: Avoid using Unix domain socket paths that are too long · 4dd8f613
    Kathleen Brade authored
    Enforce a maximum length of 100 for Unix domain socket paths.
    
    If $XDG_RUNTIME_DIR is set, create a unique subdirectory within that
      directory and place the control and SOCKS sockets there if the
      resulting paths will not be too long
    else if the length of <tor-data-dir>/control.socket is less than 100
      characters, place both sockets under <tor-data-dir> (this is compatible
      with the Tor Browser 6.5a3 behavior)
    else create a unique subdirectory under /tmp and place the sockets there.
    
    The unique subdirectory that is created under $XDG_RUNTIME_DIR or /tmp
    will be named Tor if no such directory exists; otherwise, an integer
    suffix will be appended until a new, uniquely named directory is found
    such as /tmp/Tor-1.
    
    Also, when starting tor, only include a SocksPort argument if a Unix
    domain socket path or a host/port is available.
    4dd8f613