[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #14186 [Tor]: Try to use fchmod() first when changing permissions on an AF_UNIX socket



#14186: Try to use fchmod() first when changing permissions on an AF_UNIX socket
--------------------+------------------------------------
 Reporter:  andrea  |          Owner:
     Type:  defect  |         Status:  new
 Priority:  normal  |      Milestone:  Tor: 0.2.6.x-final
Component:  Tor     |        Version:  Tor: 0.2.6.2-alpha
 Keywords:          |  Actual Points:
Parent ID:          |         Points:
--------------------+------------------------------------
 In connection_listener_new() of connection.c, we need to change
 permissions of an AF_UNIX socket in one case, and on some platforms it
 doesn't work to use fchmod(), or so a comment claims.  It'd be better to
 avoid the race condition by using fchmod() when possible though.

 We should move this to a unix_socket_chmod() function in compat.c,
 perhaps, which should take a file handle, a path and a mode, and try
 fchmod() and then fall back to chmod() if it fails.

 Point of clarification: if fchmod() fails, will it fail by returning a
 sensible error code or by silently not modifying the permissions?  Should
 unix_socket_chmod() also fdstat() as needed to check that the mode is
 correct?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/14186>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs