mirror of
https://github.com/0intro/wmii
synced 2024-11-22 13:52:17 +03:00
Replaced the security check from the last commit. Moved the proglist to $WMII_NS_DIR and got rid of mktemp.
This commit is contained in:
parent
76202dcf48
commit
d1428091e2
29
cmd/wm/wmii
29
cmd/wm/wmii
@ -4,25 +4,20 @@
|
||||
wmiiwm -c || exit 1
|
||||
|
||||
WMII_CONFPATH="$HOME/.wmii-4:CONFPREFIX/wmii-4" export WMII_CONFPATH
|
||||
WMII_NS_DIR="/tmp/ns.$USER.${DISPLAY%.0}"
|
||||
WMII_NS_DIR="/tmp/ns.$USER.${DISPLAY%.0}" export WMII_NS_DIR
|
||||
WMII_ADDRESS="unix!$WMII_NS_DIR/wmii" export WMII_ADDRESS
|
||||
|
||||
error() {
|
||||
echo "There was an error starting wmii."
|
||||
echo "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ -d "$WMII_NS_DIR" ]; then
|
||||
if [ -O "$WMII_NS_DIR" ]; then
|
||||
if ls -ld "$WMII_NS_DIR" | grep -v '^drwx------' >/dev/null 2>&1; then
|
||||
error "Your namespace directory ($WMII_NS_DIR) exists but is group or world readable or writable"
|
||||
fi
|
||||
else
|
||||
error "Your namespace directory ($WMII_NS_DIR) exists but is not owned by you."
|
||||
fi
|
||||
else
|
||||
mkdir -m 700 "$WMII_NS_DIR" || error "Your namespace directory ($WMII_NS_DIR) doesn't exist and I can't create it"
|
||||
# Make sure that the namespace directory exists and has correct permissions
|
||||
mkdir -m 700 "$WMII_NS_DIR" 2>/dev/null ||
|
||||
if ls -ld "$WMII_NS_DIR" |
|
||||
awk -v "user=`id -un`" \
|
||||
'{ if ($3 == user && match($1,"^drwx-----"))
|
||||
exit 1 }'
|
||||
then
|
||||
echo "The socket directory \"$WMII_NS_DIR\" " \
|
||||
"is group or world writable " \
|
||||
"or is not owned by you" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wmiiwm -a $WMII_ADDRESS &
|
||||
|
@ -62,8 +62,9 @@ EOF
|
||||
# MISC
|
||||
xsetroot -solid '#333333'
|
||||
`conf_which status` &
|
||||
PROGS_FILE=`mktemp /tmp/.wmiimenu.proglist.XXXXXX` || exit 2
|
||||
proglist `echo "$OLD_PATH" | tr : ' '` >$PROGS_FILE &
|
||||
PROGS_FILE="$WMII_NS_DIR/.wmiimenu.proglist" || exit 2
|
||||
ACTIONS_DIRS=`echo "$WMII_CONFPATH" | tr : ' '`
|
||||
proglist `echo "$PATH" | tr : ' '` >$PROGS_FILE &
|
||||
|
||||
# SHORTCUTS
|
||||
wmiir write /keys <<EOF
|
||||
@ -141,7 +142,6 @@ do
|
||||
Start)
|
||||
if test wmiirc = "$1"
|
||||
then
|
||||
rm -f $PROGS_FILE
|
||||
exit
|
||||
fi;;
|
||||
CreateTag)
|
||||
@ -180,7 +180,7 @@ do
|
||||
$MODKEY-f)
|
||||
xwrite /tag/sel/0/sel/geom 0 0 0 0;;
|
||||
$MODKEY-a)
|
||||
`conf_which \`proglist $HOME/.wmii-4 CONFPREFIX/wmii-4 | wmiimenu\`` &;;
|
||||
`conf_which \`proglist $ACTIONS_DIRS | wmiimenu\`` &;;
|
||||
$MODKEY-p)
|
||||
wmiisetsid sh -c "`wmiimenu <$PROGS_FILE`" &;;
|
||||
$MODKEY-t)
|
||||
|
Loading…
Reference in New Issue
Block a user