summaryrefslogtreecommitdiffstats
path: root/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close')
-rwxr-xr-xremote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close8
1 files changed, 8 insertions, 0 deletions
diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close b/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
index 0af71c6f..4fc2ce6a 100755
--- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
+++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
@@ -18,6 +18,14 @@ fi
# can only work if script is run as root
[ "x$(whoami)" = "xroot" ] || exit 0
+# source hooks if there are any
+if [ -d "/opt/openslx/scripts/pam_script_ses_close.d" ]; then
+ for HOOK in $(ls "/opt/openslx/scripts/pam_script_ses_close.d"); do
+ # failure is non-critical
+ . "/opt/openslx/scripts/pam_script_ses_close.d/$HOOK" || slxlog "pam-sesclose-hooks" "Could not source '$HOOK'."
+ done
+fi
+
OPENSESSION=$(loginctl show-user "$PAM_USER" | grep "Sessions=" | cut -c 10-)
SESSIONCOUNT=$(echo "$OPENSESSION" | wc -w)
# When using su/sudo there is no session created, so count up by one