aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-02-14 00:52:24 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-02-14 00:52:24 +0000
commitf5f8da18b3aeca5175bbf09f66938190c1ee67fc (patch)
treeea534bf886f2e049a616c23bb49ed682b584a403
parent102709ca341438a5f5a21532b4fd2b6a2f820f97 (diff)
downloadmsec-f5f8da18b3aeca5175bbf09f66938190c1ee67fc.tar
msec-f5f8da18b3aeca5175bbf09f66938190c1ee67fc.tar.gz
msec-f5f8da18b3aeca5175bbf09f66938190c1ee67fc.tar.bz2
msec-f5f8da18b3aeca5175bbf09f66938190c1ee67fc.tar.xz
msec-f5f8da18b3aeca5175bbf09f66938190c1ee67fc.zip
handle umask and . in path
-rwxr-xr-xmsec.csh41
-rwxr-xr-xmsec.sh36
2 files changed, 67 insertions, 10 deletions
diff --git a/msec.csh b/msec.csh
index 0792667..8ca9bc1 100755
--- a/msec.csh
+++ b/msec.csh
@@ -1,7 +1,31 @@
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : msec
+# File : msec.csh
+# Version : $Id$
+# Author : Yoann Vandoorselaere
+# Created On : Wed Feb 13 18:35:58 2002
+# Purpose : settings according to security level
+#---------------------------------------------------------------
+
if ( -r /etc/sysconfig/msec ) then
eval `sed -n 's/^\([^#]*\)=\([^#]*\)/set \1=\2;/p' < /etc/sysconfig/msec`
endif
+if ( { id -u } >= 500 ) then
+ if ( ${?UMASK_USER} ) then
+ umask ${UMASK_USER}
+ else
+ umask 022
+ endif
+else
+ if ( ${?UMASK_ROOT} ) then
+ umask ${UMASK_ROOT}
+ else
+ umask 002
+ endif
+endif
+
if ! { (echo "${PATH}" | grep -q /usr/X11R6/bin) } then
setenv PATH "${PATH}:/usr/X11R6/bin"
endif
@@ -10,18 +34,21 @@ if ! { (echo "${PATH}" | grep -q /usr/games) } then
setenv PATH "${PATH}:/usr/games"
endif
+if ( ${?SECURE_LEVEL} && ${SECURE_LEVEL} <= 1 ) then
+ if ! { (echo "${PATH}" | fgrep -q :.) } then
+ setenv PATH "${PATH}:."
+ endif
+endif
+
# translate sh variables from /etc/sysconfig/msec to their equivalent in csh
if ( ${?TMOUT} ) then
- if ( "$TMOUT" != "" ) then
- set autologout=`expr $TMOUT / 60`
- endif
-
+ set autologout=`expr $TMOUT / 60`
endif
if ( ${?HISTFILESIZE} ) then
- if ( "$HISTFILESIZE" != "" ) then
- set history=$HISTFILESIZE
- endif
+ set history=$HISTFILESIZE
endif
setenv SECURE_LEVEL ${SECURE_LEVEL}
+
+# msec.csh ends here
diff --git a/msec.sh b/msec.sh
index d01e68b..dd3a429 100755
--- a/msec.sh
+++ b/msec.sh
@@ -1,15 +1,45 @@
+#---------------------------------------------------------------
+# Project : Mandrake Linux
+# Module : msec
+# File : msec.sh
+# Version : $Id$
+# Author : Yoann Vandoorselaere
+# Created On : Wed Feb 13 18:35:58 2002
+# Purpose : settings according to security level
+#---------------------------------------------------------------
+
if [ -r /etc/sysconfig/msec ]; then
. /etc/sysconfig/msec
fi
+if [ `id -u` -ge 500 ]; then
+ if [ -n "$UMASK_USER" ]; then
+ umask $UMASK_USER
+ else
+ umask 022
+ fi
+else
+ if [ -n "$UMASK_ROOT" ]; then
+ umask $UMASK_ROOT
+ else
+ umask 002
+ fi
+fi
+
if ! echo ${PATH} |grep -q /usr/X11R6/bin ; then
- export PATH=$PATH:/usr/X11R6/bin
+ export PATH=$PATH:/usr/X11R6/bin
fi
if ! echo ${PATH} |grep -q /usr/games ; then
- export PATH=$PATH:/usr/games
+ export PATH=$PATH:/usr/games
fi
-export SECURE_LEVEL=${SECURE_LEVEL}
+if [ "$SECURE_LEVEL" -le 1 ] && ! echo ${PATH} | fgrep -q :.; then
+ export PATH=$PATH:.
+fi
+
+export SECURE_LEVEL
[ -n "$TMOUT" ] && typeset -r TMOUT
+
+# msec.sh ends here