Use umask() to set file and UNIX socket permissions without race conditions.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 2 Aug 2013 17:27:06 +0000 (19:27 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 2 Aug 2013 17:28:34 +0000 (19:28 +0200)
As mentioned by Erik Tews, calling fchmod() after fopen() leaves a small window
for exploits. As long as tinc is single-threaded, we can use umask() instead to
reduce file permissions. This also works when creating the AF_UNIX control socket.

The umask of the user running tinc(d) is used for most files, except for the
private keys, invitation files, PID file and control socket.


No differences found