Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 May 2019 14:40:29 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Ian Lepore <ian@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r336547 - in head/etc: defaults rc.d
Message-ID:  <6b966875-23f5-28cf-9e65-7c30974eef05@FreeBSD.org>
In-Reply-To: <201807201359.w6KDxT1p087000@repo.freebsd.org>
References:  <201807201359.w6KDxT1p087000@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6b966875-23f5-28cf-9e65-7c30974eef05>