wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit d1428091e20d3e500e4e6e0137568b5f1e2dd1d4
parent 76202dcf48f5b58ae17aa2b929b72fd5a4db2395
Author: Kris Maglione <bsdaemon@wmii.de>
Date:   Sat, 24 Jun 2006 06:45:27 -0400

Replaced the security check from the last commit. Moved the proglist to $WMII_NS_DIR and got rid of mktemp.


Diffstat:
cmd/wm/wmii | 29++++++++++++-----------------
rc/wmiirc | 8++++----
2 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/cmd/wm/wmii b/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 & diff --git a/rc/wmiirc b/rc/wmiirc @@ -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)