diff --git a/bin/hsadmin-ng b/bin/hsadmin-ng index 3dca47d8..2522c564 100755 --- a/bin/hsadmin-ng +++ b/bin/hsadmin-ng @@ -2,7 +2,7 @@ if [ "$#" -eq 0 ] || [ "$1" == "help" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then cat <> [parameters] commands: @@ -31,7 +31,7 @@ else fi if [ -z "$HSADMINNG_CAS_LOGIN" ] || [ -z "$HSADMINNG_CAS_VALIDATE" ] || \ - [ -z "$HSADMINNG_CAS_SERVICE" ]; then + [ -z "$HSADMINNG_CAS_SERVICE_ID" ]; then cat >&2 <> - export HSADMINNG_CAS_SERVICE=https://hsadminng.hostsharing.net:443/ + export HSADMINNG_CAS_SERVICE_ID=https://hsadminng.hostsharing.net:443/ EOF exit 1 fi @@ -73,8 +73,8 @@ function casTicket() { trace "CAS-TGT: $HSADMINNG_CAS_TGT" trace "fetching CAS service ticket" - trace "curl -s -d \"service=$HSADMINNG_CAS_SERVICE\" $HSADMINNG_CAS_TGT" - HSADMINNG_CAS_TICKET=$(curl -s -d "service=$HSADMINNG_CAS_SERVICE" $HSADMINNG_CAS_TGT) + trace "curl -s -d \"service=$HSADMINNG_CAS_SERVICE_ID\" $HSADMINNG_CAS_TGT" + HSADMINNG_CAS_TICKET=$(curl -s -d "service=$HSADMINNG_CAS_SERVICE_ID" $HSADMINNG_CAS_TGT) if [[ -z "$HSADMINNG_CAS_TICKET" ]]; then echo "ERROR: cannot get CAS service ticket" >&2 exit 1 @@ -87,8 +87,8 @@ function casValidate() { HSADMINNG_CAS_TICKET=`casTicket` trace "validating CAS-TICKET: $HSADMINNG_CAS_TICKET" - trace curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE} - HSADMINNG_CAS_USER=`curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE} | grep -oPm1 "(?<=)[^<]+"` + trace curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE_ID} + HSADMINNG_CAS_USER=`curl -i -s $HSADMINNG_CAS_VALIDATE?ticket=${HSADMINNG_CAS_TICKET}\&service=${HSADMINNG_CAS_SERVICE_ID} | grep -oPm1 "(?<=)[^<]+"` if [ -z "$HSADMINNG_CAS_USER" ]; then echo "validation failed" >&2 exit 1 @@ -100,7 +100,7 @@ if ! find ~/.cas-login-tgt -type f -size +0c -mmin -60 2>/dev/null | grep -q .; casLogin fi -case "$1" in +case "${1,,}" in "login") # explicitly login using CAS-server and credentials in HSADMINNG_CAS_..., fetches ticket granting ticket casLogin ;;