From: Roy Marples Date: Wed, 25 Feb 2009 14:59:27 +0000 (+0000) Subject: Stop enforcing a umask in dhcpcd. X-Git-Tag: v5.0.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fd77df4b7063b3498890bdf4ed84e8b364b2dec4;p=thirdparty%2Fdhcpcd.git Stop enforcing a umask in dhcpcd. Instead we will ensure that /etc/resolv.conf is 644. Other config files will retain their existing umask or inherit the current one. --- diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 357dddc4..64005ee5 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -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() diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index 1a25e31c..7ec2d3f6 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -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}" diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in index f011dcc8..da37b5df 100644 --- a/dhcpcd-run-hooks.in +++ b/dhcpcd-run-hooks.in @@ -105,7 +105,8 @@ change_file() rm -f "$2" return 1 fi - mv -f "$2" "$1" + cat "$2" > "$1" + rm -f "$2" return 0 } diff --git a/dhcpcd.c b/dhcpcd.c index 95d7b2ce..56d21b55 100644 --- 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)) {