Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9258 closed defect (fixed)

Breaks in non-obvious ways when control socket path has no slashes

Reported by: weasel Owned by:
Priority: Medium Milestone: Tor: 0.2.5.x-final
Component: Core Tor/Tor Version: Tor: 0.2.4.15-rc
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description (last modified by weasel)

Hi,

I made a torrc and I wanted to run tor with it but it didn't work and didn't say why:

weasel@defiant:~/tmp/tor$ tor -f torrc 
Jul 15 10:39:06.382 [notice] Tor v0.2.4.14-alpha (git-da7587e870f422a6) running on Linux with Libevent 2.0.19-stable and OpenSSL 1.0.1e.
Jul 15 10:39:06.382 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Jul 15 10:39:06.383 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Jul 15 10:39:06.383 [notice] Read configuration file "/home/weasel/.temp/2013-06-28/tor/torrc".
Jul 15 10:39:06.390 [notice] Opening Socks listener on 127.0.0.1:9913
Jul 15 10:39:06.390 [notice] Closing partially-constructed Socks listener on 127.0.0.1:9913
Jul 15 10:39:06.391 [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
Jul 15 10:39:06.391 [err] Reading config failed--see warnings above.

My torrc:

DataDirectory .
SocksPort 9913
PidFile pid
log debug stderr
SafeLogging 0
ControlSocket sock
StrictNodes 1

Turns out that in get_parent_directory, called via

retry_listener_ports
connection_listener_new
check_location_for_unix_socket
get_parent_directory

the path "sock" gets rejected, but nobody bothers logging about it.

connection_listener_new returns a NULL conn and we tear down stuff again.

It works if I specify ControlSocket ./sock.

Child Tickets

Attachments (3)

Change History (8)

comment:1 Changed 7 years ago by weasel

Description: modified (diff)

One could argue that we should not allow relative paths
for unix domain sockets (it would require the peer to be
in the same working directory, AIUI).

I think my patch does that.

If you think we should support relative paths, then check_location_for_unix_socket() probably needs some other fix.

Cheers

Changed 7 years ago by weasel

comment:2 Changed 7 years ago by weasel

[patches are against master]

comment:3 Changed 7 years ago by nickm

Keywords: tor-client added
Milestone: Tor: 0.2.5.x-final
Resolution: fixed
Status: newclosed

I think this is fine; merging to master.

comment:4 Changed 7 years ago by arma

Tricksy! the changes file says bug 9047, which is nowhere in sight I think.

comment:5 Changed 7 years ago by arma

Actually, the whole "Fixes bug 9047; bugfix on 0.2.2.6-alpha." line was a lie. Fun.

Note: See TracTickets for help on using tickets.