Module Name:    src
Committed By:   roy
Date:           Tue Jun 27 17:07:53 UTC 2023

Modified Files:
        src/external/bsd/openresolv/dist: dnsmasq.in libc.in named.in pdnsd.in
            resolvconf.8.in resolvconf.conf.5.in resolvconf.in unbound.in

Log Message:
Sync with openresolv-3.13.2


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/openresolv/dist/dnsmasq.in
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/openresolv/dist/libc.in
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/openresolv/dist/named.in \
    src/external/bsd/openresolv/dist/pdnsd.in
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/openresolv/dist/resolvconf.8.in
cvs rdiff -u -r1.21 -r1.22 \
    src/external/bsd/openresolv/dist/resolvconf.conf.5.in
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/openresolv/dist/resolvconf.in
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/openresolv/dist/unbound.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/openresolv/dist/dnsmasq.in
diff -u src/external/bsd/openresolv/dist/dnsmasq.in:1.6 src/external/bsd/openresolv/dist/dnsmasq.in:1.7
--- src/external/bsd/openresolv/dist/dnsmasq.in:1.6	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/dnsmasq.in	Tue Jun 27 17:07:53 2023
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2020 Roy Marples
+# Copyright (c) 2007-2023 Roy Marples
 # All rights reserved
 
 # dnsmasq subscriber for resolvconf
@@ -105,7 +105,7 @@ for d in $DOMAINS; do
 						empty=true
 						continue
 					fi
-					i=$(($i + 1))
+					i=$((i + 1))
 					while [ ${#addr} -lt 4 ]; do
 						addr="0${addr}"
 					done
@@ -118,7 +118,7 @@ for d in $DOMAINS; do
 					fi
 				done
 				while [ $i != 8 ]; do
-				i=$(($i + 1))
+				i=$((i + 1))
 					front="$front byte:0 byte:0"
 				done
 				front="${front}$back"
@@ -151,7 +151,7 @@ else
 fi
 
 # Try to ensure that config dirs exist
-if type config_mkdirs >/dev/null 2>&1; then
+if command -v config_mkdirs >/dev/null 2>&1; then
 	config_mkdirs "$dnsmasq_conf" "$dnsmasq_resolv"
 else
 	@SBINDIR@/resolvconf -D "$dnsmasq_conf" "$dnsmasq_resolv"

Index: src/external/bsd/openresolv/dist/libc.in
diff -u src/external/bsd/openresolv/dist/libc.in:1.5 src/external/bsd/openresolv/dist/libc.in:1.6
--- src/external/bsd/openresolv/dist/libc.in:1.5	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/libc.in	Tue Jun 27 17:07:53 2023
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2020 Roy Marples
+# Copyright (c) 2007-2023 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -94,6 +94,7 @@ elif [ -d "$SYSCONFDIR"/resolvconf ]; th
 	fi
 fi
 : ${resolv_conf:=/etc/resolv.conf}
+: ${resolv_conf_tmp:="$resolv_conf.$$.openresolv"}
 : ${libc_service:=nscd}
 : ${list_resolv:=@SBINDIR@/resolvconf -l}
 if [ "${resolv_conf_head-x}" = x ] && [ -f "$SYSCONFDIR"/resolv.conf.head ]
@@ -107,7 +108,7 @@ fi
 
 backup=true
 signature="# Generated by resolvconf"
- 
+
 uniqify()
 {
 	result=
@@ -226,8 +227,26 @@ if $backup; then
 	fi
 fi
 
-# Create our resolv.conf now
-(umask 022; printf %s "$newconf" >"$resolv_conf")
+# There are pros and cons for writing directly to resolv.conf
+# instead of a temporary file and then moving it over.
+# The default is to write to resolv.conf as it has the least
+# issues and has been the long standing default behaviour.
+case "${resolv_conf_mv:-NO}" in
+[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
+	# Protect against symlink attack, ensure new file does not exist
+	rm -f "$resolv_conf_tmp"
+	# Keep original file owner, group and mode
+	[ -r "$resolv_conf" ] && cp -p "$resolv_conf" "$resolv_conf_tmp"
+	# Create our resolv.conf now
+	if (umask 022; printf %s "$newconf" >"$resolv_conf_tmp"); then
+		mv "$resolv_conf_tmp" "$resolv_conf"
+	fi
+	;;
+*)
+	(umask 022; printf %s "$newconf" >"$resolv_conf")
+	;;
+esac
+
 if [ -n "$libc_restart" ]; then
 	eval $libc_restart
 elif [ -n "$RESTARTCMD" ]; then

Index: src/external/bsd/openresolv/dist/named.in
diff -u src/external/bsd/openresolv/dist/named.in:1.4 src/external/bsd/openresolv/dist/named.in:1.5
--- src/external/bsd/openresolv/dist/named.in:1.4	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/named.in	Tue Jun 27 17:07:53 2023
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2020 Roy Marples
+# Copyright (c) 2007-2023 Roy Marples
 # All rights reserved
 
 # named subscriber for resolvconf
@@ -79,7 +79,7 @@ for d in $DOMAINS; do
 done
 
 # Try to ensure that config dirs exist
-if type config_mkdirs >/dev/null 2>&1; then
+if command -v config_mkdirs >/dev/null 2>&1; then
 	config_mkdirs "$named_options" "$named_zones"
 else
 	@SBINDIR@/resolvconf -D "$named_options" "$named_zones"
Index: src/external/bsd/openresolv/dist/pdnsd.in
diff -u src/external/bsd/openresolv/dist/pdnsd.in:1.4 src/external/bsd/openresolv/dist/pdnsd.in:1.5
--- src/external/bsd/openresolv/dist/pdnsd.in:1.4	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/pdnsd.in	Tue Jun 27 17:07:53 2023
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2010-2020 Roy Marples
+# Copyright (c) 2010-2023 Roy Marples
 # All rights reserved
 
 # pdnsd subscriber for resolvconf
@@ -46,7 +46,7 @@ remove_markers()
 	in_marker=0
 
 	shift; shift
-	if type sed >/dev/null 2>&1; then
+	if command -v sed >/dev/null 2>&1; then
 		sed "/^$m1/,/^$m2/d" $@
 	else
 		for x do
@@ -66,9 +66,9 @@ remove_markers()
 change_file()
 {
 	if [ -e "$1" ]; then
-		if type cmp >/dev/null 2>&1; then
+		if command -v cmp >/dev/null 2>&1; then
 			cmp -s "$1" "$2"
-		elif type diff >/dev/null 2>&1; then
+		elif command -v diff >/dev/null 2>&1; then
 			diff -q "$1" "$2" >/dev/null
 		else
 			# Hopefully we're only working on small text files ...
@@ -88,7 +88,7 @@ newresolv="# Generated by resolvconf$NL"
 changed=false
 
 # Try to ensure that config dirs exist
-if type config_mkdirs >/dev/null 2>&1; then
+if command -v config_mkdirs >/dev/null 2>&1; then
 	config_mkdirs "$pdnsd_resolv" "$pdnsd_conf"
 else
 	@SBINDIR@/resolvconf -D "$pdnsd_resolv" "$pdnsd_conf"

Index: src/external/bsd/openresolv/dist/resolvconf.8.in
diff -u src/external/bsd/openresolv/dist/resolvconf.8.in:1.11 src/external/bsd/openresolv/dist/resolvconf.8.in:1.12
--- src/external/bsd/openresolv/dist/resolvconf.8.in:1.11	Sun Dec 27 18:26:50 2020
+++ src/external/bsd/openresolv/dist/resolvconf.8.in	Tue Jun 27 17:07:53 2023
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007-2020 Roy Marples
+.\" Copyright (c) 2007-2023 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -189,7 +189,7 @@ Echo the resolvconf version to
 .El
 .Pp
 .Nm
-also has some commands designed to be used by it's subscribers and
+also has some commands designed to be used by its subscribers and
 system startup:-
 .Bl -tag -width pattern_opt
 .It Fl I
@@ -229,7 +229,7 @@ in the correct order.
 .Nm
 first processes interfaces from the
 .Sy interface_order
-list, then interfaces without a metic and that match the
+list, then interfaces without a metric and that match the
 .Sy dynamic_order
 list, then interfaces with a metric in order and finally the rest in
 the operating systems lexical order.

Index: src/external/bsd/openresolv/dist/resolvconf.conf.5.in
diff -u src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.21 src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.22
--- src/external/bsd/openresolv/dist/resolvconf.conf.5.in:1.21	Sun Dec 27 18:26:50 2020
+++ src/external/bsd/openresolv/dist/resolvconf.conf.5.in	Tue Jun 27 17:07:53 2023
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2020 Roy Marples
+.\" Copyright (c) 2009-2023 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd October 1, 2020
+.Dd May 23, 2023
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -134,7 +134,7 @@ search foo.org dead.beef
 nameserver 1.2.3.4
 nameserver 2.3.4.5
 .Ed
-and this configuaration:
+and this configuration:
 .Bd -compact -literal -offset indent
 replace="search/foo*/bar.com"
 replace="$replace nameserver/1.2.3.4/5.6.7.8"
@@ -210,6 +210,12 @@ Prepend name servers to the dynamically 
 Append search domains to the dynamically generated list.
 .It Sy prepend_search
 Prepend search domains to the dynamically generated list.
+.It Sy resolv_conf_mv
+Defaults to NO.
+Defines if
+.Pa /etc/resolv.conf
+is updated by writing to a temporary file and then moving it
+vs writing directly to it.
 .El
 .Sh SUBSCRIBER OPTIONS
 openresolv ships with subscribers for the name servers
@@ -222,7 +228,7 @@ and
 Each subscriber can create configuration files which should be included in
 the subscribers main configuration file.
 .Pp
-To disable a subscriber, simply set it's name to NO.
+To disable a subscriber, simply set its name to NO.
 For example, to disable the libc subscriber you would set:
 .Bd -compact -literal -offset indent
 libc=NO
@@ -322,6 +328,9 @@ forward-zones-file=/etc/pdns/recursor-zo
 This file tells unbound about specific and global name servers.
 .It Sy unbound_insecure
 When set to YES, unbound marks the domains as insecure, thus ignoring DNSSEC.
+.It Sy unbound_forward_zone_options
+Options appended to each forward zone.
+Each option should be separated by an embedded new line.
 .Pp
 Example resolvconf.conf for unbound:
 .Bd -compact -literal -offset indent
@@ -385,4 +394,4 @@ Each distribution is a special snowflake
 differently, namely the named service script.
 .Pp
 Please report them to
-.Lk http://roy.marples.name/projects/openresolv
+.Lk https://roy.marples.name/projects/openresolv

Index: src/external/bsd/openresolv/dist/resolvconf.in
diff -u src/external/bsd/openresolv/dist/resolvconf.in:1.9 src/external/bsd/openresolv/dist/resolvconf.in:1.10
--- src/external/bsd/openresolv/dist/resolvconf.in:1.9	Sun Dec 27 18:26:50 2020
+++ src/external/bsd/openresolv/dist/resolvconf.in	Tue Jun 27 17:07:53 2023
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2020 Roy Marples
+# Copyright (c) 2007-2023 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 RESOLVCONF="$0"
-OPENRESOLV_VERSION="3.12.0"
+OPENRESOLV_VERSION="3.13.2"
 SYSCONFDIR=@SYSCONFDIR@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
@@ -158,7 +158,7 @@ private_iface()
 	if [ -e "$PRIVATEDIR/$iface" ]; then
 		return 0
 	fi
-	
+
 	for p in $private_interfaces; do
 		case "$iface" in
 		"$p"|"$p":*) return 0;;
@@ -290,9 +290,9 @@ config_mkdirs()
 
 # With the advent of alternative init systems, it's possible to have
 # more than one installed. So we need to try and guess what one we're
-# using unless overriden by configure.
+# using unless overridden by configure.
 # Note that restarting a service is a last resort - the subscribers
-# should make a reasonable attempt to reconfigre the service via some
+# should make a reasonable attempt to reconfigure the service via some
 # method, normally SIGHUP.
 detect_init()
 {
@@ -327,6 +327,12 @@ detect_init()
 		   then
 			/usr/sbin/invoke-rc.d $1 restart
 		   fi'
+	elif [ -x /usr/bin/s6-rc ] && [ -x /usr/bin/s6-svc ]; then
+		RESTARTCMD='
+		   if s6-rc -a list | grep -qFx $1-srv
+		   then
+			s6-svc -r /run/service/$1-srv
+		   fi'
 	elif [ -x /sbin/service ]; then
 		# Old RedHat
 		RCDIR=/etc/init.d
@@ -367,6 +373,8 @@ detect_init()
 			then
 				/etc/rc.d/$1 restart
 			fi'
+	elif [ -d /etc/dinit.d ] && command -v dinitctl >/dev/null 2>&1; then
+		RESTARTCMD='dinitctl --quiet restart --ignore-unstarted $1'
 	else
 		for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
 			[ -d $x ] || continue
@@ -432,6 +440,8 @@ list_resolv()
 
 	cmd="$1"
 	shift
+	pattern_specified="$1"
+
 	excl=false
 	list=
 	report=false
@@ -462,7 +472,7 @@ list_resolv()
 
 	# If we have an interface ordering list, then use that.
 	# It works by just using pathname expansion in the interface directory.
-	if [ -n "$1" ]; then
+	if [ -n "$pattern_specified" ]; then
 		list="$*"
 		$force || report=true
 	elif ! $excl; then
@@ -515,7 +525,11 @@ list_resolv()
 	fi
 
 	cd "$IFACEDIR"
-	retval=1
+	if $excl || [ -n "$pattern_specified" ]; then
+		retval=1
+	else
+		retval=0
+	fi
 	for i in $(uniqify $list); do
 		# Only list interfaces which we really have
 		if ! [ -f "$i" ]; then
@@ -542,7 +556,7 @@ list_resolv()
 				fi
 			done
 		fi
-		
+
 		if [ "$cmd" = i ] || [ "$cmd" = "-i" ]; then
 			printf %s "$i "
 		else

Index: src/external/bsd/openresolv/dist/unbound.in
diff -u src/external/bsd/openresolv/dist/unbound.in:1.3 src/external/bsd/openresolv/dist/unbound.in:1.4
--- src/external/bsd/openresolv/dist/unbound.in:1.3	Mon Jan 27 21:13:05 2020
+++ src/external/bsd/openresolv/dist/unbound.in	Tue Jun 27 17:07:53 2023
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2009-2020 Roy Marples
+# Copyright (c) 2009-2023 Roy Marples
 # All rights reserved
 
 # unbound subscriber for resolvconf
@@ -49,6 +49,9 @@ for d in $DOMAINS; do
 		;;
 	esac
 	newconf="$newconf${NL}forward-zone:$NL	name: \"$dn\"$NL"
+	if [ -n "$unbound_forward_zone_options" ]; then
+		newconf="$newconf	$unbound_forward_zone_options${NL}"
+	fi
 	while [ -n "$ns" ]; do
 		newconf="$newconf	forward-addr: ${ns%%,*}$NL"
 		[ "$ns" = "${ns#*,}" ] && break
@@ -58,13 +61,16 @@ done
 
 if [ -n "$NAMESERVERS" ]; then
 	newconf="$newconf${NL}forward-zone:$NL	name: \".\"$NL"
+	if [ -n "$unbound_forward_zone_options" ]; then
+		newconf="$newconf	$unbound_forward_zone_options${NL}"
+	fi
 	for n in $NAMESERVERS; do
 		newconf="$newconf	forward-addr: $n$NL"
 	done
 fi
 
 # Try to ensure that config dirs exist
-if type config_mkdirs >/dev/null 2>&1; then
+if command -v config_mkdirs >/dev/null 2>&1; then
 	config_mkdirs "$unbound_conf"
 else
 	@SBINDIR@/resolvconf -D "$unbound_conf"

Reply via email to