diff options
| author | Christian Rößler | 2015-09-14 13:21:55 +0200 |
|---|---|---|
| committer | Christian Rößler | 2015-09-14 13:21:55 +0200 |
| commit | 92c04f646e86f01425e1e1ac3382498f0c189302 (patch) | |
| tree | e8954c04587ee70230cd7f5c3ecf62c9b5f4f813 /remote/modules/pam/data/opt | |
| parent | [runvirt] [vmware] Minor cosmetics, logging (diff) | |
| parent | [binutil] Fix accidental exclusion of libs by using full path for automatic b... (diff) | |
| download | tm-scripts-92c04f646e86f01425e1e1ac3382498f0c189302.tar.gz tm-scripts-92c04f646e86f01425e1e1ac3382498f0c189302.tar.xz tm-scripts-92c04f646e86f01425e1e1ac3382498f0c189302.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/pam/data/opt')
| -rwxr-xr-x | remote/modules/pam/data/opt/openslx/scripts/pam_script_auth | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth index 65eefcdc..b8ed4166 100755 --- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth +++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth @@ -3,21 +3,17 @@ # Needed as pam_script clears PATH export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" -touch "/tmp/ldapsearch.${PAM_USER}" -chmod 0600 "/tmp/ldapsearch.${PAM_USER}" -if ldapsearch -l 3 -o nettimeout=3 -x -LLL uid="${PAM_USER}" uid homeMount realAccount > "/tmp/ldapsearch.${PAM_USER}" 2>/dev/null; then - VOLUME=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^homeMount:" | head -n 1 | cut -d" " -f2) - REAL_ACCOUNT=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^realAccount:" | head -n 1 | cut -d" " -f2) - PCASE=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^uid:" | head -n 1 | cut -d" " -f2) - [ -n "$PCASE" ] && PAM_USER=$PCASE -fi +# check if the script runs as root +[ "x$(whoami)" != "xroot" ] && exit 0 -PASSWD=$(/usr/bin/getent passwd "$PAM_USER") +PASSWD=$(getent passwd "$PAM_USER") +USER_NAME=$(echo "$PASSWD" | awk -F ':' '{print $1}') USER_UID=$(echo "$PASSWD" | awk -F ':' '{print $3}') USER_GID=$(echo "$PASSWD" | awk -F ':' '{print $4}') USER_HOME=$(echo "$PASSWD" | awk -F ':' '{print $6}') -[ -z "$USER_UID" ] && USER_UID=$(/usr/bin/id -u "$PAM_USER") -[ -z "$USER_GID" ] && USER_GID=$(/usr/bin/id -g "$PAM_USER") +[ -n "$USER_NAME" ] && PAM_USER="$USER_NAME" +[ -z "$USER_UID" ] && USER_UID=$(id -u "$PAM_USER") +[ -z "$USER_GID" ] && USER_GID=$(id -g "$PAM_USER") [ -z "$USER_HOME" ] && USER_HOME="/home/$PAM_USER" if [ -z "$USER_UID" -o -z "$USER_GID" ]; then slxlog "pam-get-ids" "Could not determine UID or GID for user '$PAM_USER'." @@ -27,9 +23,6 @@ fi # The user's non-persistent home directory mount point, which should be their linux home TEMP_HOME_DIR="$USER_HOME" -# check if the script runs as root -[ "x$(/usr/bin/whoami)" != "xroot" ] && exit 0 - # check if PAM_USER is root and skip if it is the case [ "x${PAM_USER}" == "xroot" ] && exit 0 |
