svn commit: r336547 - in head/etc: defaults rc.d
Andriy Gapon
avg at FreeBSD.org
Wed May 22 11:40:40 UTC 2019
Something I've just noticed about this commit:
On 20/07/2018 16:59, Ian Lepore wrote:
> Author: ian
> Date: Fri Jul 20 13:59:29 2018
> New Revision: 336547
> URL: https://svnweb.freebsd.org/changeset/base/336547
>
> Log:
> Automatically run ntpd as non-root when possible.
[snip]
> +ntpd_precmd()
> +{
> + local driftopt
> +
> + # If we can run as a non-root user, switch uid to ntpd and use the
> + # new default location for the driftfile inside the ntpd-owned dir.
> + # Otherwise, figure out what to do about the driftfile option. If set
> + # by the admin, we don't add the option. If the file exists in the old
> + # default location we use that, else we use the new default location.
> + if can_run_nonroot; then
> + _user="ntpd"
> + driftopt="-f ${_ntp_default_driftfile}"
> + elif [ -z "${rc_flags##*-f*}" ] ||
> + [ -z "${rc_flags##*--driftfile*}" ] ||
It seems that the two checks above produce a false positive if rc_flags is empty
already. And that's the case on a system that I recently brought up (very
recent CURRENT via source install). /etc/defaults/rc.conf has ntpd_flags="".
As a result ntpd is started without the drift file option.
And the stock /etc/ntp.conf also does not have the directive.
> + grep -q "^[ \t]*driftfile" "${ntpd_config}"; then
> + driftopt="" # admin set the option, we don't need to add it.
> + elif [ -f "${_ntp_old_driftfile}" ]; then
> + driftopt="-f ${_ntp_old_driftfile}"
> + else
> + driftopt="-f ${_ntp_default_driftfile}"
> fi
--
Andriy Gapon
More information about the svn-src-all
mailing list