summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2007-10-19 22:55:42 +0000
committermtm <mtm@FreeBSD.org>2007-10-19 22:55:42 +0000
commit4a5da6b57dc54a358915e1b5eee4b6da8586cf16 (patch)
tree02b4c8d2d065863d22a6a8cf19f7d3d2c7ce6874 /etc
parent3e09edb4faa4876a73fd26c9ac3beb03c9f06159 (diff)
downloadFreeBSD-src-4a5da6b57dc54a358915e1b5eee4b6da8586cf16.zip
FreeBSD-src-4a5da6b57dc54a358915e1b5eee4b6da8586cf16.tar.gz
The amd_map_program knob can potentially contain a command whose output
is then used as an argument to the amd program. This outpu may contain newlines, but the script did not take care to strip those newlines before apending it to rc_flags. Revision 1.72 of rc.subr(8) introduced changes that exposed this problem (specifically putting the final eval'ed command in quotes).[1] Also, for correctness' sake, shell directives appended to the command-line by the script should go into command_args, and not appended directly to rc_flags. Reported by: John E Hein <jhein@timing.com> [1] Tested by: John E Hein <jhein@timing.com> MFC after: 1 week
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/amd5
1 files changed, 3 insertions, 2 deletions
diff --git a/etc/rc.d/amd b/etc/rc.d/amd
index 8c3e85f..040e5ff 100755
--- a/etc/rc.d/amd
+++ b/etc/rc.d/amd
@@ -34,7 +34,7 @@ amd_precmd()
[Nn][Oo] | '')
;;
*)
- rc_flags="${rc_flags} `eval ${amd_map_program}`"
+ rc_flags="${rc_flags} `echo $(eval ${amd_map_program})`"
;;
esac
@@ -46,7 +46,8 @@ amd_precmd()
fi
;;
*)
- rc_flags="-p ${rc_flags} > /var/run/amd.pid 2> /dev/null"
+ rc_flags="-p ${rc_flags}"
+ command_args=" > /var/run/amd.pid 2> /dev/null"
;;
esac
return 0
OpenPOWER on IntegriCloud