From ec9ec4ad367f494165ced611af6b2641e8cb2472 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 6 Nov 2011 19:13:43 -0500 Subject: functions: implement a environment file parser This adds a 'parse_envfile' function that reads files such as /etc/locale.conf and /etc/vconsole.conf without sourcing them as bash logic. Several benefits are realized from this: - Impossible to execute arbitrary code - Bad syntax won't prevent the entire file from being read - Possible to limit what variables are allowed Signed-off-by: Dave Reisner --- rc.sysinit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'rc.sysinit') diff --git a/rc.sysinit b/rc.sysinit index eb66935..654a409 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -237,7 +237,7 @@ if [[ $HOSTNAME ]]; then fi if [[ -s /etc/locale.conf ]]; then - . /etc/locale.conf + parse_envfile /etc/locale.conf "LANG" [[ $LANG ]] && LOCALE=$LANG fi if [[ ${LOCALE,,} =~ utf ]]; then @@ -263,7 +263,7 @@ else fi if [[ -s /etc/vconsole.conf ]]; then - . /etc/vconsole.conf + parse_envfile /etc/vconsole.conf "${vconsolevars[@]}" [[ $FONT ]] && CONSOLEFONT=$FONT [[ $FONT_MAP ]] && CONSOLEMAP=$FONT_MAP fi -- cgit v1.2.3