aboutsummaryrefslogtreecommitdiffstats
path: root/init-sh
diff options
context:
space:
mode:
authorYoann Vandoorselaere <yoann@mandriva.com>1999-12-14 13:11:00 +0000
committerYoann Vandoorselaere <yoann@mandriva.com>1999-12-14 13:11:00 +0000
commit4dc0240a5cf80501ea30478015f5796c91c57d30 (patch)
treed2456bf27818353641a17d90da924373bf8faa22 /init-sh
parent667bf979ccc661bc6c935ff0dac4be234414fb51 (diff)
downloadmsec-4dc0240a5cf80501ea30478015f5796c91c57d30.tar
msec-4dc0240a5cf80501ea30478015f5796c91c57d30.tar.gz
msec-4dc0240a5cf80501ea30478015f5796c91c57d30.tar.bz2
msec-4dc0240a5cf80501ea30478015f5796c91c57d30.tar.xz
msec-4dc0240a5cf80501ea30478015f5796c91c57d30.zip
*** empty log message ***
Diffstat (limited to 'init-sh')
-rwxr-xr-xinit-sh/level0.sh4
-rwxr-xr-xinit-sh/level1.sh4
-rwxr-xr-xinit-sh/level2.sh4
-rw-r--r--init-sh/lib.sh29
4 files changed, 35 insertions, 6 deletions
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