From 75c205827469595065cab92b30593a059c4294bc Mon Sep 17 00:00:00 2001 From: PierreGode Date: Wed, 8 Aug 2018 09:01:39 +0200 Subject: [PATCH] Update ADconnection.sh --- ADconnection.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ADconnection.sh b/ADconnection.sh index fef4cb8..e3a845a 100644 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -871,9 +871,14 @@ fi ########################################### Leave Realm ################################ leave(){ -echo "${NUMBER}This funktion only works properly if this computer can locate the domain${END}" LEFT=$(sudo realm discover | grep configured | awk '{print $2}') DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}') +SSSD=$( sudo cat /etc/sssd/sssd.conf | grep domain | awk '{print $3}' | head -1 ) +DOMAINlower=$( echo $DOMAIN | tr '[:upper:]' '[:lower:]' ) +if [ "$DOMAINlower" = "$SSSD" ] +then +echo "Detecting realm $SSSD" +else if [ "$LEFT" = "no" ] then echo "" @@ -881,6 +886,7 @@ DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}') echo "" exit fi + fi read -p "Do you really want to leave the domain: $DOMAIN (y/n)?" yn case $yn in [Yy]* ) echo "Listing domain"