]> git.gsnw.org Git - fping.git/commit
fping: retain privileges until after privileged setsockopt
authorHenrique de Moraes Holschuh <henrique@nic.br>
Mon, 24 Aug 2020 23:00:53 +0000 (20:00 -0300)
committerHenrique de Moraes Holschuh <henrique@nic.br>
Tue, 25 Aug 2020 15:53:28 +0000 (12:53 -0300)
commit59d83ed4020673ec09238bbb1cff275158b590a6
treee258857a137ee96ff507524960f4668861facc05
parent296de3d7a28b68476e42409cfd6fdff835a47146
fping: retain privileges until after privileged setsockopt

On Linux, one needs privileges to setsockopt(SO_BINDTODEVICE), and the
current code would drop setuid root privileges too soon.

Temporarily drop privileges instead, and raise them back to issue the
privileged setsockopt().  Once we know we won't need to do any further
privileged setsockopt(), permanently drop privileges.

For now, assume SO_BINDTODEVICE is the only setsockopt that needs this.
src/fping.c