From 4dc0240a5cf80501ea30478015f5796c91c57d30 Mon Sep 17 00:00:00 2001 From: Yoann Vandoorselaere Date: Tue, 14 Dec 1999 13:11:00 +0000 Subject: *** empty log message *** --- init-sh/level0.sh | 4 ++-- init-sh/level1.sh | 4 ++-- init-sh/level2.sh | 4 ++-- init-sh/lib.sh | 29 +++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 6 deletions(-) (limited to 'init-sh') diff --git a/init-sh/level0.sh b/init-sh/level0.sh index edea66d..2dfbc1e 100755 --- a/init-sh/level0.sh +++ b/init-sh/level0.sh @@ -67,8 +67,8 @@ AddRules "export PATH SECURE_LEVEL" /etc/profile # Xserver echo "Allowing users to connect X server from everywhere :" -AddRules "/usr/X11R6/bin/xhost +" /etc/X11/xdm/Xsession quiet -AddRules "/usr/X11R6/bin/xhost +" /etc/X11/xinit/xinitrc +AddBegRules "/usr/X11R6/bin/xhost +" /etc/X11/xdm/Xsession quiet +AddBegRules "/usr/X11R6/bin/xhost +" /etc/X11/xinit/xinitrc # Group if [[ ! -z ${DRAKX_USERS} ]]; then diff --git a/init-sh/level1.sh b/init-sh/level1.sh index 583c547..b3d4488 100755 --- a/init-sh/level1.sh +++ b/init-sh/level1.sh @@ -68,8 +68,8 @@ AddRules "export PATH SECURE_LEVEL" /etc/profile # Xserver echo "Allowing users to connect X server from localhost :" -AddRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xdm/Xsession quiet -AddRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xinit/xinitrc +AddBegRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xdm/Xsession +AddBegRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xinit/xinitrc ### diff --git a/init-sh/level2.sh b/init-sh/level2.sh index 09bfca8..7f68980 100755 --- a/init-sh/level2.sh +++ b/init-sh/level2.sh @@ -67,8 +67,8 @@ AddRules "export PATH SECURE_LEVEL" /etc/profile # Xserver echo "Allowing users to connect X server from localhost :" -AddRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xdm/Xsession quiet -AddRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xinit/xinitrc +AddBegRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xdm/Xsession quiet +AddBegRules "/usr/X11R6/bin/xhost + localhost" /etc/X11/xinit/xinitrc # Group if [[ ! -z ${DRAKX_USERS} ]]; then diff --git a/init-sh/lib.sh b/init-sh/lib.sh index ec93c61..ee046a9 100644 --- a/init-sh/lib.sh +++ b/init-sh/lib.sh @@ -43,6 +43,35 @@ AddRules () { fi } +AddBegRules() { + string=$1 + file=$2 + quiet=$3 + ctrl=0 + + if [[ -z ${string} ]]; then + return; + fi + + if [[ -z ${quiet} ]]; then + echo "Modifying config in ${file}..." + fi + + mv ${file} /tmp/secure.tmp + + if ! grep -Eqx "^${string}" /tmp/secure.tmp; then + echo -e "${COMMENT}" >> ${file}; + echo -e "${string}" >> ${file}; + fi + + cat /tmp/secure.tmp >> ${file} + + if [[ -z ${3} ]]; then + echo -e "done.\n" + fi +} + + CleanRules() { file=$1 ctrl=0 -- cgit v1.2.1