]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Stop enforcing a umask in dhcpcd.
authorRoy Marples <roy@marples.name>
Wed, 25 Feb 2009 14:59:27 +0000 (14:59 +0000)
committerRoy Marples <roy@marples.name>
Wed, 25 Feb 2009 14:59:27 +0000 (14:59 +0000)
Instead we will ensure that /etc/resolv.conf is 644.
Other config files will retain their existing umask or inherit the current one.

dhcpcd-hooks/20-resolv.conf
dhcpcd-hooks/50-ntp.conf
dhcpcd-run-hooks.in
dhcpcd.c

index 357dddc4bbe5d6471e259139dd060ba896d9adc7..64005ee5052f26b07362b6cd74bf8fe1acea12c6 100644 (file)
@@ -10,7 +10,7 @@ resolv_conf_dir="${state_dir}/resolv.conf"
 
 build_resolv_conf()
 {
-       local cf="/etc/resolv.conf.${interface}"
+       local cf="/var/run/resolv.conf.${interface}"
        local interfaces= header= search= srvs= servers= x=
 
        # Build a list of interfaces
@@ -60,7 +60,9 @@ build_resolv_conf()
        else
                echo "# /etc/resolv.conf.tail can replace this line" >> "${cf}"
        fi
-       mv -f "${cf}" /etc/resolv.conf
+       cat "${cf}" > /etc/resolv.conf
+       chmod 644 /etc/resolv.conf
+       rm -f "${cf}"
 }
 
 add_resolv_conf()
index 1a25e31c814f2c10d96cfcf92d1d550decf2e7ee..7ec2d3f65288ee7c872fccd988e318a2cc5710ed 100644 (file)
@@ -23,7 +23,7 @@ ntp_conf=${NTP_CONF:-/etc/ntp.conf}
 
 build_ntp_conf()
 {
-       local cf="${ntp_conf}.${interface}"
+       local cf="/var/run/ntp.conf.${interface}"
        local interfaces= header= srvs= servers= x=
 
        # Build a list of interfaces
@@ -48,7 +48,7 @@ build_ntp_conf()
        # Merge our config into ntp.conf
        [ -e "${cf}" ] && rm -f "${cf}"
        remove_markers "${signature_base}" "${signature_base_end}" \
-               /etc/ntp.conf > "${cf}"
+               "${ntp_conf}" > "${cf}"
        if [ -n "${servers}" ]; then
                echo "${signature_base}${header:+ ${from} }${header}" >> "${cf}"
                printf "${search}${servers}" >> "${cf}"
index f011dcc83fe69b115adab13b0bcded27f1d50932..da37b5dfab5e4185b5b9a1c5ba878b88d23cd2d8 100644 (file)
@@ -105,7 +105,8 @@ change_file()
                rm -f "$2"
                return 1
        fi
-       mv -f "$2" "$1"
+       cat "$2" > "$1"
+       rm -f "$2"
        return 0
 }
 
index 95d7b2cefcd15c41c3ae30515ddc6ee378b6a7c8..56d21b55ea03b3073e6ca3cb1b98773a3c05b01f 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1339,7 +1339,6 @@ main(int argc, char **argv)
 
        if (chdir("/") == -1)
                syslog(LOG_ERR, "chdir `/': %m");
-       umask(022);
        atexit(cleanup);
 
        if (!(options & DHCPCD_MASTER)) {