mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:05:06 -05:00
sys_netbsd: allow running without root privileges
On NetBSD programs with write access to /dev/clockctl can adjust or set the system clock without the root privileges. Add a function to drop the privileges and check if the process has write access to the device to get a more descriptive error message when the chrony uid/gid doesn't match the owner of the device.
This commit is contained in:
8
configure
vendored
8
configure
vendored
@@ -215,6 +215,7 @@ feat_rtc=1
|
||||
try_rtc=0
|
||||
feat_droproot=1
|
||||
try_libcap=0
|
||||
try_clockctl=0
|
||||
readline_lib=""
|
||||
readline_inc=""
|
||||
ncurses_lib=""
|
||||
@@ -405,6 +406,7 @@ case $SYSTEM in
|
||||
NetBSD-* )
|
||||
EXTRA_OBJECTS="sys_netbsd.o"
|
||||
EXTRA_LIBS="-lkvm"
|
||||
try_clockctl=1
|
||||
add_def NETBSD
|
||||
echo "Configuring for $SYSTEM"
|
||||
;;
|
||||
@@ -590,6 +592,12 @@ then
|
||||
EXTRA_LIBS="$EXTRA_LIBS -lcap"
|
||||
fi
|
||||
|
||||
if [ $feat_droproot = "1" ] && [ $try_clockctl = "1" ] && \
|
||||
test_code '<sys/clockctl.h>' 'sys/clockctl.h' '' '' ''
|
||||
then
|
||||
add_def FEAT_PRIVDROP
|
||||
fi
|
||||
|
||||
if [ $feat_rtc = "1" ] && [ $try_rtc = "1" ] && \
|
||||
test_code '<linux/rtc.h>' 'sys/ioctl.h linux/rtc.h' '' '' \
|
||||
'ioctl(1, RTC_UIE_ON&RTC_UIE_OFF&RTC_RD_TIME&RTC_SET_TIME, 0&RTC_UF);'
|
||||
|
||||
Reference in New Issue
Block a user