Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/openresolv/dist Import openresolv-3.4.2 with th...



details:   https://anonhg.NetBSD.org/src/rev/6da0ac21cd5e
branches:  trunk
changeset: 766013:6da0ac21cd5e
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Jun 13 11:05:19 2011 +0000

description:
Import openresolv-3.4.2 with the following fix:
* Use printf(1) correctly

diffstat:

 external/bsd/openresolv/dist/dnsmasq.in      |   32 +++--
 external/bsd/openresolv/dist/libc.in         |   32 +++--
 external/bsd/openresolv/dist/named.in        |   42 ++++--
 external/bsd/openresolv/dist/pdnsd.in        |  153 +++++++++++++++++++++++++++
 external/bsd/openresolv/dist/resolvconf.8.in |   22 +-
 external/bsd/openresolv/dist/resolvconf.in   |   37 ++++--
 external/bsd/openresolv/dist/unbound.in      |   21 ++-
 7 files changed, 264 insertions(+), 75 deletions(-)

diffs (truncated from 648 to 300 lines):

diff -r 6914221d5cd9 -r 6da0ac21cd5e external/bsd/openresolv/dist/dnsmasq.in
--- a/external/bsd/openresolv/dist/dnsmasq.in   Mon Jun 13 09:37:23 2011 +0000
+++ b/external/bsd/openresolv/dist/dnsmasq.in   Mon Jun 13 11:05:19 2011 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2011 Roy Marples
 # All rights reserved
 
 # dnsmasq subscriber for resolvconf
@@ -30,10 +30,14 @@
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$dnsmasq_conf" -a -z "$dnsmasq_resolv" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+NL="
+"
 
 : ${dnsmasq_pid:=/var/run/dnsmasq.pid}
-: ${dnsmasq_restart:=@RESTARTCMD dnsmasq@}
-newconf="# Generated by resolvconf\n"
+[ -s "$dnsmasq_pid" ] || dnsmasq_pid=/var/run/dnsmasq/dnsmasq.pid
+: ${dnsmasq_service:=dnsmasq}
+: ${dnsmasq_restart:=@RESTARTCMD ${dnsmasq_service}@}
+newconf="# Generated by resolvconf$NL"
 newresolv="$newconf"
 
 # Using dbus means that we never have to restart the daemon
@@ -54,14 +58,14 @@
                        kill -0 $(cat "$dnsmasq_pid") 2>/dev/null
                then
                        dbus=true
-                       newconf="$newconf\n# Domain specific servers will"
-                       newconf="$newconf be sent over dbus\nenable-dbus\n"
+                       newconf="$newconf$NL# Domain specific servers will"
+                       newconf="$newconf be sent over dbus${NL}enable-dbus$NL"
                fi
        fi
 fi
 
 for n in $NAMESERVERS; do
-       newresolv="${newresolv}nameserver $n\n"
+       newresolv="${newresolv}nameserver $n$NL"
 done
 
 dbusdest=
@@ -73,16 +77,16 @@
                        SIFS=${IFS-y} OIFS=$IFS
                        IFS=.
                        set -- ${ns%%,*}
-                       num="0x$(printf "%02x" $1 $2 $3 $4)"
+                       num="0x$(printf %02x $1 $2 $3 $4)"
                        if [ "$SIFS" = yi ]; then
                                unset IFS
                        else
                                IFS=$OIFS
                        fi
-                       dbusdest="$dbusdest uint32:$(printf "%u" $num)"
+                       dbusdest="$dbusdest uint32:$(printf %u $num)"
                        dbusdest="$dbusdest string:$dn"
                else
-                       newconf="${newconf}server=/$dn/${ns%%,*}\n"
+                       newconf="${newconf}server=/$dn/${ns%%,*}$NL"
                fi
                [ "$ns" = "${ns#*,}" ] && break
                ns="${ns#*,}"
@@ -92,22 +96,22 @@
 changed=false
 if [ -n "$dnsmasq_conf" ]; then
        if [ ! -f "$dnsmasq_conf" ] || \
-               [ "$(cat "$dnsmasq_conf")" != "$(printf "$newconf")" ]
+               [ "$(cat "$dnsmasq_conf")" != "$(printf %s "$newconf")" ]
        then
                changed=true
-               printf "$newconf" >"$dnsmasq_conf"
+               printf %s "$newconf" >"$dnsmasq_conf"
        fi
 fi
 if [ -n "$dnsmasq_resolv" ]; then
        if [ -f "$dnsmasq_resolv" ]; then
-               if [ "$(cat "$dnsmasq_resolv")" != "$(printf "$newresolv")" ]
+               if [ "$(cat "$dnsmasq_resolv")" != "$(printf %s "$newresolv")" ]
                then
                        changed=true
-                       printf "$newresolv" >"$dnsmasq_resolv"
+                       printf %s "$newresolv" >"$dnsmasq_resolv"
                fi
        else
                # dnsmasq polls this file so no need to set changed=true
-               printf "$newresolv" >"$dnsmasq_resolv"
+               printf %s "$newresolv" >"$dnsmasq_resolv"
        fi
 fi
 
diff -r 6914221d5cd9 -r 6da0ac21cd5e external/bsd/openresolv/dist/libc.in
--- a/external/bsd/openresolv/dist/libc.in      Mon Jun 13 09:37:23 2011 +0000
+++ b/external/bsd/openresolv/dist/libc.in      Mon Jun 13 11:05:19 2011 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples
+# Copyright (c) 2007-2011 Roy Marples
 # All rights reserved
 
 # libc subscriber for resolvconf
@@ -30,6 +30,8 @@
 LIBEXECDIR=@LIBEXECDIR@
 VARDIR=@VARDIR@
 IFACEDIR="$VARDIR/interfaces"
+NL="
+"
 
 # sed may not be available, and this is faster on small files
 key_get_value()
@@ -77,7 +79,8 @@
        fi
 fi
 : ${resolv_conf:=/etc/resolv.conf}
-: ${libc_restart:=@RESTARTCMD nscd@}
+: ${libc_service:=nscd}
+: ${libc_restart:=@RESTARTCMD ${libc_service}@}
 : ${list_resolv:=@PREFIX@/sbin/resolvconf -l}
 if [ "${resolv_conf_head-x}" = x -a -f "$SYSCONFDIR"/resolv.conf.head ]; then
        resolv_conf_head="$(cat "${SYSCONFDIR}"/resolv.conf.head)"
@@ -108,21 +111,22 @@
                fi
        done
        [ -z "$newest" ] && exit 0
-       newconf="$(cat "$newest")\n"
+       newconf="$(cat "$newest")$NL"
        ;;
 *)
        [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
-       newsearch="$(uniqify $search_domains $SEARCH)"
-       newns="$(uniqify $name_servers $NAMESERVERS)"
+       newsearch="$(uniqify $search_domains $SEARCH $search_domains_append)"
+       NS="$LOCALNAMESERVERS $NAMESERVERS"
+       newns="$(uniqify $name_servers $NS $name_servers_append)"
 
        # Hold our new resolv.conf in a variable to save on temporary files
-       newconf="# Generated by resolvconf\n"
+       newconf="# Generated by resolvconf$NL"
        if [ -n "$resolv_conf_head" ]; then
-               newconf="$newconf$resolv_conf_head\n"
+               newconf="$newconf$resolv_conf_head$NL"
        fi
-       [ -n "$newsearch" ] && newconf="${newconf}search $newsearch\n"
+       [ -n "$newsearch" ] && newconf="${newconf}search $newsearch$NL"
        for n in $newns; do
-               newconf="${newconf}nameserver $n\n"
+               newconf="${newconf}nameserver $n$NL"
        done
 
        # Now get any configured options
@@ -133,22 +137,22 @@
                for opt in $(uniqify $opts); do
                        newconf="${newconf} $opt"
                done
-               newconf="$newconf\n"
+               newconf="$newconf$NL"
        fi
 
        if [ -n "$resolv_conf_tail" ]; then
-               newconf="$newconf$resolv_conf_tail\n"
+               newconf="$newconf$resolv_conf_tail$NL"
        fi
        ;;
 esac
 
 # Check if the file has actually changed or not
 if [ -e "$resolv_conf" ]; then
-       [ "$(cat "$resolv_conf")" = "$(printf "$newconf")" ] && exit 0
+       [ "$(cat "$resolv_conf")" = "$(printf %s "$newconf")" ] && exit 0
 fi
 
 # Create our resolv.conf now
-(umask 022; printf "$newconf" >"$resolv_conf")
+(umask 022; echo "$newconf" >"$resolv_conf")
 eval $libc_restart
 
 retval=0
@@ -158,7 +162,7 @@
                if [ -x "$script" ]; then
                        "$script" "$@"
                else
-                       (. "$script" "$@")
+                       (. "$script")
                fi
                retval=$(($retval + $?))
        fi
diff -r 6914221d5cd9 -r 6da0ac21cd5e external/bsd/openresolv/dist/named.in
--- a/external/bsd/openresolv/dist/named.in     Mon Jun 13 09:37:23 2011 +0000
+++ b/external/bsd/openresolv/dist/named.in     Mon Jun 13 11:05:19 2011 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2009 Roy Marples <roy%marples.name@localhost>
+# Copyright (c) 2007-2011 Roy Marples
 # All rights reserved
 
 # named subscriber for resolvconf
@@ -30,33 +30,45 @@
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
 [ -z "$named_zones" -a -z "$named_options" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@PREFIX@/sbin/resolvconf -v)"
+NL="
+"
 
-: ${named_restart:=@RESTARTCMD named@}
-newoptions="# Generated by resolvconf\n"
+# Platform specific kludges
+if [ -z "$named_service" -a -z "$named_restart" -a \
+       -d "@RCDIR@" -a ! -x "@RCDIR@"/named ]
+then
+       if [ -x "@RCDIR@"/bind9 ]; then
+               # Debian and derivatives
+               named_service=bind9
+       fi
+fi
+: ${named_service:=named}
+: ${named_restart:=@RESTARTCMD ${named_service}@}
+newoptions="# Generated by resolvconf$NL"
 newzones="$newoptions"
 
 forward=
 for n in $NAMESERVERS; do
        case "$forward" in
-       *"\n\t$n;"*);;
-       *) forward="$forward\n\t$n;";;
+       *"$NL   $n;"*);;
+       *) forward="$forward$NL $n;";;
        esac
 done
 if [ -n "$forward" ]; then
-       newoptions="${newoptions}forward first;\nforwarders {$forward\n};\n"
+       newoptions="${newoptions}forward first;${NL}forwarders {$forward${NL}};$NL"
 fi
 
 for d in $DOMAINS; do
-       newzones="${newzones}zone \"${d%%:*}\" {\n"
-       newzones="$newzones\ttype forward;\n"
-       newzones="$newzones\tforward first;\n\tforwarders {\n"
+       newzones="${newzones}zone \"${d%%:*}\" {$NL"
+       newzones="$newzones     type forward;$NL"
+       newzones="$newzones     forward first;$NL       forwarders {$NL"
        ns="${d#*:}"
        while [ -n "$ns" ]; do
-               newzones="$newzones\t\t${ns%%,*};\n"
+               newzones="$newzones             ${ns%%,*};$NL"
                [ "$ns" = "${ns#*,}" ] && break
                ns="${ns#*,}"
        done
-       newzones="$newzones\t};\n};\n"
+       newzones="$newzones     };$NL};$NL"
 done
 
 # No point in changing files or reloading bind if the end result has not
@@ -64,17 +76,17 @@
 changed=false
 if [ -n "$named_options" ]; then
        if [ ! -f "$named_options" ] || \
-               [ "$(cat "$named_options")" != "$(printf "$newoptions")" ]
+               [ "$(cat "$named_options")" != "$(printf %s "$newoptions")" ]
        then
-               printf "$newoptions" >"$named_options"
+               printf %s "$newoptions" >"$named_options"
                changed=true
        fi
 fi
 if [ -n "$named_zones" ]; then
        if [ ! -f "$named_zones" ] || \
-               [ "$(cat "$named_zones")" != "$(printf "$newzones")" ]
+               [ "$(cat "$named_zones")" != "$(printf %s "$newzones")" ]
        then
-               printf "$newzones" >"$named_zones"
+               printf %s "$newzones" >"$named_zones"
                changed=true
        fi
 fi
diff -r 6914221d5cd9 -r 6da0ac21cd5e external/bsd/openresolv/dist/pdnsd.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/openresolv/dist/pdnsd.in     Mon Jun 13 11:05:19 2011 +0000
@@ -0,0 +1,153 @@
+#!/bin/sh
+# Copyright (c) 2010-2011 Roy Marples
+# All rights reserved
+
+# pdnsd subscriber for resolvconf
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT



Home | Main Index | Thread Index | Old Index