diff options
| author | Roy Marples <roy@marples.name> | 2009-02-25 14:59:27 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2009-02-25 14:59:27 +0000 |
| commit | fd77df4b7063b3498890bdf4ed84e8b364b2dec4 (patch) | |
| tree | 6e7ef087f3faab4f1b746cc52384c7c4dde61abc | |
| parent | 7dcb2e0b722483db09552c6951b695efd87c058e (diff) | |
| download | dhcpcd-fd77df4b7063b3498890bdf4ed84e8b364b2dec4.tar.xz | |
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.
| -rw-r--r-- | dhcpcd-hooks/20-resolv.conf | 6 | ||||
| -rw-r--r-- | dhcpcd-hooks/50-ntp.conf | 4 | ||||
| -rw-r--r-- | dhcpcd-run-hooks.in | 3 | ||||
| -rw-r--r-- | dhcpcd.c | 1 |
4 files changed, 8 insertions, 6 deletions
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 } @@ -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)) { |
