From f1bacaa50130f42b545a2b577df0652b74db9f3d Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Thu, 26 Jan 2006 21:05:39 +0000 Subject: [PATCH] Fix rev 1.12. /tmp may not be writeable yet when dhclient is first run via /etc/rc.d/netif so using it may not work. Also, writing to a predictable file in /tmp as root is a really bad idea since a malicious user may be able to win a race and insert a symlink which will allow them to cause any file to be overwritten. To solve these problems, create the tempory file in /var/run which will exist this early and is writable only by root. Security: Local risk if users can cause dhclient to run on demand (such as by unplugging and replugging the network cable). --- sbin/dhclient/dhclient-script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index da2a99be430c..ced527d39428 100644 --- a/sbin/dhclient/dhclient-script +++ b/sbin/dhclient/dhclient-script @@ -135,7 +135,7 @@ add_new_resolv_conf() { # thus broke the script. This code creates the resolv.conf if either # are provided. - local tmpres=${TMPDIR:-/tmp}/resolv.conf.std + local tmpres=/var/run/resolv.conf.${interface} rm -f $tmpres if [ -n "$new_domain_name" ]; then