From owner-svn-src-all@freebsd.org  Mon Nov 25 20:26:01 2019
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12A271B92BA;
 Mon, 25 Nov 2019 20:26:01 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "Client", Issuer "CA" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 47MJT44SDBz3PxN;
 Mon, 25 Nov 2019 20:26:00 +0000 (UTC)
 (envelope-from cy.schubert@cschubert.com)
Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA
 id ZKvkipRW4kqGXZKvliHVDo; Mon, 25 Nov 2019 13:25:58 -0700
X-Authority-Analysis: v=2.3 cv=c/jVvi1l c=1 sm=1 tr=0
 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17
 a=kj9zAlcOel0A:10 a=MeAgGD-zjQ4A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8
 a=wEqQk4lysjINT8RGvMkA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22
 a=Ia-lj3WSrqcvXOmTRaiG:22
Received: from slippy.cwsent.com (slippy8 [10.2.2.6])
 by spqr.komquats.com (Postfix) with ESMTPS id DB145A88;
 Mon, 25 Nov 2019 12:25:55 -0800 (PST)
Received: from slippy.cwsent.com (localhost [127.0.0.1])
 by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id xAPKPtiS004215;
 Mon, 25 Nov 2019 12:25:55 -0800 (PST)
 (envelope-from Cy.Schubert@cschubert.com)
Received: from slippy (cy@localhost)
 by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id xAPKPtBh004212;
 Mon, 25 Nov 2019 12:25:55 -0800 (PST)
 (envelope-from Cy.Schubert@cschubert.com)
Message-Id: <201911252025.xAPKPtBh004212@slippy.cwsent.com>
X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Ian Lepore <ian@FreeBSD.org>
cc: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: Re: svn commit: r355100 - head/libexec/rc/rc.d
In-reply-to: <201911251959.xAPJxsJa088257@repo.freebsd.org>
References: <201911251959.xAPJxsJa088257@repo.freebsd.org>
Comments: In-reply-to Ian Lepore <ian@FreeBSD.org>
 message dated "Mon, 25 Nov 2019 19:59:54 +0000."
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Mon, 25 Nov 2019 12:25:55 -0800
X-CMAE-Envelope: MS4wfKvbNICSeKFG5+9vlQSh7zRhCulBKniaPUUJPDr7FJs2b7yHzqcksHzgDLARSCHB7ifN/eADielKh8z7aqftmuTryrTRwPNdKEa85qhqsdVIEtpsGu/5
 7VwHBAu+pPHckPLUYFPjevqjBK9TRc+SHyWSctLKUugh1NjwhLL/KzE3e4JrEzo6UNy7s6RQMFskcGYEplCeEZLzWilBtgbqOZ5BYCPQJq9mfbVAef6ifGD1
 bZgDxj4uwbATZMkZyj51M060fKW/USYsVsQInSyYf7b6I4dm9j8Aqgv87SqRGqin
X-Rspamd-Queue-Id: 47MJT44SDBz3PxN
X-Spamd-Bar: -----
Authentication-Results: mx1.freebsd.org;
	none
X-Spamd-Result: default: False [-5.99 / 15.00];
 NEURAL_HAM_MEDIUM(-0.99)[-0.995,0];
 NEURAL_HAM_LONG(-0.99)[-0.994,0]; REPLY(-4.00)[]
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 25 Nov 2019 20:26:01 -0000

In message <201911251959.xAPJxsJa088257@repo.freebsd.org>, Ian Lepore 
writes:
> Author: ian
> Date: Mon Nov 25 19:59:53 2019
> New Revision: 355100
> URL: https://svnweb.freebsd.org/changeset/base/355100
>
> Log:
>   Allow opt-out of automatic ntpd leapfile checking/fetching.
>   
>   When a system has no internet connection, or when it is configured to obtai
> n
>   ntpd leapfiles from some source other than the internet, or even when the
>   sysadmin has decided for some reason to customize ntp.conf to eliminate use
>   of the leapfile, the rc.d/ntpd script emits various error messages related
>   to the file.
>   
>   This change allows setting the rc var ntp_db_leapfile to NONE to disable al
> l
>   automatic processing related to that file in rc.d/ntpd.
>   

    Reviewed by:		cy

>   Differential Revision:	https://reviews.freebsd.org/D22461
>
> Modified:
>   head/libexec/rc/rc.d/ntpd
>
> Modified: head/libexec/rc/rc.d/ntpd
> =============================================================================
> =
> --- head/libexec/rc/rc.d/ntpd	Mon Nov 25 19:38:05 2019	(r355099)
> +++ head/libexec/rc/rc.d/ntpd	Mon Nov 25 19:59:53 2019	(r355100)
> @@ -28,6 +28,16 @@ pidfile="${_ntp_default_dir}/${name}.pid"
>  
>  load_rc_config $name
>  
> +leapfile_is_disabled() {
> +	# Return true (0) if automatic leapfile handling is disabled.
> +	case "$ntp_db_leapfile" in
> +	[Nn][Oo] | [Nn][Oo][Nn][Ee] )
> +		return 0;;
> +	* )
> +		return 1;;
> +	esac
> +}
> +
>  can_run_nonroot()
>  {
>  	# If the admin set what uid to use, we don't change it.
> @@ -107,7 +117,12 @@ ntpd_precmd()
>  		command_args="${command_args} -g"
>  	fi
>  
> -	# Make sure the leapfile is ready to use.
> +	# Make sure the leapfile is ready to use, unless leapfile
> +	# handling is disabled.
> +	if leapfile_is_disabled; then
> +		return
> +	fi
> +
>  	ntpd_init_leapfile
>  	if [ ! -f "${ntp_db_leapfile}" ]; then
>  		ntpd_fetch_leapfile
> @@ -135,6 +150,11 @@ get_ntp_leapfile_expiry() {
>  }
>  
>  ntpd_init_leapfile() {
> +
> +	if leapfile_is_disabled; then
> +		return
> +	fi
> +
>  	# Refresh working leapfile with an invalid hash due to
>  	# FreeBSD id header. Ntpd will ignore leapfiles with a
>  	# mismatch hash. The file must be the virgin file from
> @@ -146,7 +166,12 @@ ntpd_init_leapfile() {
>  
>  ntpd_needfetch_leapfile() {
>  	local rc verbose
> -	
> +
> +	if leapfile_is_disabled; then
> +		# Return code 1: ntp leapfile fetch not needed
> +		return 1
> +	fi
> +
>  	if checkyesno ntp_leapfile_fetch_verbose; then
>  		verbose=echo
>  	else
> @@ -182,6 +207,11 @@ ntpd_needfetch_leapfile() {
>  }
>  
>  ntpd_fetch_leapfile() {
> +
> +	if leapfile_is_disabled; then
> +		return
> +	fi
> +
>  	if checkyesno ntp_leapfile_fetch_verbose; then
>  		verbose=echo
>  	else
>


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.