Harden the locking mechanism
[openresolv] / named.in
index de61906aef14a394dc4ebefc7d760dd10c981084..3301896416bb215f5a8356e44ae6ee4eefac425b 100644 (file)
--- a/named.in
+++ b/named.in
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2016 Roy Marples
+# Copyright (c) 2007-2020 Roy Marples
 # All rights reserved
 
 # named subscriber for resolvconf
 
 [ -f "@SYSCONFDIR@"/resolvconf.conf ] || exit 0
 . "@SYSCONFDIR@/resolvconf.conf" || exit 1
-[ -z "$named_zones" -a -z "$named_options" ] && exit 0
+[ -z "${named_zones}${named_options}" ] && exit 0
 [ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)"
 NL="
 "
 
 # Platform specific kludges
-if [ -z "$named_service" -a -z "$named_restart" -a \
-       -d "$RCDIR" -a ! -x "$RCDIR"/named ]
+if [ -z "${named_service}${named_restart}" ] &&
+   [ -d "$RCDIR" ] && ! [ -x "$RCDIR"/named ]
 then
        if [ -x "$RCDIR"/bind9 ]; then
                # Debian and derivatives
@@ -105,19 +105,13 @@ if [ -n "$named_zones" ]; then
        fi
 fi
 
-# Try to send SIGHUP first
-if $changed && [ -s "$named_pid" ]; then
-       echo "SENDING HUP"
-       kill -SIGHUP $(cat "$named_pid") && changed=false
-fi
-
+# named does not seem to work with SIGHUP which is a same
 if $changed; then
-       echo "RESTARTING"
        if [ -n "$named_restart" ]; then
                eval $named_restart
        elif [ -n "$RESTARTCMD" ]; then
                set -- ${named_service}
-               eval $RESTARTCMD
+               eval "$RESTARTCMD"
        else
                @SBINDIR@/resolvconf -r ${named_service}
        fi