X-Git-Url: https://git.hcoop.net/hcoop/zz_old/config/exim4-hopper.git/blobdiff_plain/9ce616e33d36b195c6c5e3e00d2dc1c208a824dd..17043311950c5e6929e2ea1f025f87517dca41bb:/get-token diff --git a/get-token b/get-token index 4d6f282..b7b5e02 100755 --- a/get-token +++ b/get-token @@ -13,30 +13,34 @@ REALUSER=$(whoami) USER=$1 -LOGFILE=/tmp/exim4/get-token-log.$USER +LOGFILE=/tmp/exim4/weird-error.log if test "$REALUSER" = "root"; then - if test -n "$2"; then + if test "$2" = "norecurse"; then echo "Error: running as root even after trying to change to $USER" \ - > $LOGFILE + >> $LOGFILE exit 1 fi # Decide whether the user exists: getent returns 0 error code if so getent passwd "$USER" >/dev/null if test $? -ne 0; then - echo "$USER is not a local user, so ignoring them" + echo "$USER is not a local user, so ignoring them" \ + >> $LOGFILE exit 1 else + USER=$(getent passwd "$1" | cut -d':' -f 1) exec su $USER -c "$0 $1 norecurse" fi fi # Make sure USER exists, and resolve UIDs to a login name USER=$(getent passwd "$USER" | cut -d':' -f 1) +LOGFILE=/tmp/exim4/get-token-log.$USER if test -z "$USER"; then - echo "$USER is not a local user, so ignoring them" + echo "$USER is not a local user, so ignoring them" \ + >> /tmp/exim4/weird-error.log exit 1 fi @@ -49,6 +53,12 @@ exec >& $LOGFILE # print name of user echo "Running as user $REALUSER" +# debugging output +if test "$2" = "debug"; then + shift; shift + echo "Debugging output: $*" +fi + # set the credentials cache export KRB5CCNAME=FILE:/tmp/exim4/krb5cc_$USER.email