23614944 ISC should be helpful in case of unwritable lease file
authorVladimir Marek <Vladimir.Marek@oracle.com>
Mon, 20 Jun 2016 07:24:33 +0200
changeset 6259 352cbf24c3f9
parent 6258 926a85aa8bf5
child 6260 c6db55d32fc3
23614944 ISC should be helpful in case of unwritable lease file
components/isc-dhcp/Solaris/isc-dhcp.sh
--- a/components/isc-dhcp/Solaris/isc-dhcp.sh	Mon Jun 20 23:53:43 2016 -0700
+++ b/components/isc-dhcp/Solaris/isc-dhcp.sh	Mon Jun 20 07:24:33 2016 +0200
@@ -29,7 +29,9 @@
 
 SVCPROP=/usr/bin/svcprop
 CHMOD=/usr/bin/chmod
+CHOWN=/usr/bin/chown
 TOUCH=/usr/bin/touch
+ID=/usr/bin/id
 
 DHCPD_IPV4="svc:/network/dhcp/server:ipv4"
 DHCPD_IPV6="svc:/network/dhcp/server:ipv6"
@@ -148,9 +150,17 @@
 		errlog "No lease_file specified, exiting"
 		return 1
 	fi
+
+	LEASEFILE_PERMS="u=rw,go=r"
 	if [ ! -f "$LEASEFILE" ]; then
 		$TOUCH $LEASEFILE
-		$CHMOD u=rw,go=r $LEASEFILE
+		$CHMOD $LEASEFILE_PERMS $LEASEFILE
+	fi
+	if [ ! -w "$LEASEFILE" ]; then
+		errlog "Lease file '$LEASEFILE' is not writable. You should:"
+		errlog "$CHOWN $($ID -u -n) '$LEASEFILE'"
+		errlog "$CHMOD $LEASEFILE_PERMS '$LEASEFILE'"
+		return 1
 	fi
 
 	export OPTIONS="$OPTIONS -cf $CONFIGFILE -lf $LEASEFILE $LISTENIFNAMES"