summaryrefslogtreecommitdiffstats
path: root/core/modules/xscreensaver/data
diff options
context:
space:
mode:
authorSimon Rettberg2022-07-18 16:12:38 +0200
committerSimon Rettberg2022-07-18 16:12:38 +0200
commit959f56e2f36b1e853e95121d458fcd489509ebf6 (patch)
tree247b1975134b6ba2679cfe06039dceace35a234e /core/modules/xscreensaver/data
parent[pam-bwidm] Try UID gen 10 times, invert counting to simplify check (diff)
downloadmltk-959f56e2f36b1e853e95121d458fcd489509ebf6.tar.gz
mltk-959f56e2f36b1e853e95121d458fcd489509ebf6.tar.xz
mltk-959f56e2f36b1e853e95121d458fcd489509ebf6.zip
[idleaction/xscreensaver] Disllow locking for exam mode/browser logins
Diffstat (limited to 'core/modules/xscreensaver/data')
-rwxr-xr-xcore/modules/xscreensaver/data/opt/openslx/pvs2/lockDesktop.sh35
1 files changed, 16 insertions, 19 deletions
diff --git a/core/modules/xscreensaver/data/opt/openslx/pvs2/lockDesktop.sh b/core/modules/xscreensaver/data/opt/openslx/pvs2/lockDesktop.sh
index 2796de8f..8b759e3c 100755
--- a/core/modules/xscreensaver/data/opt/openslx/pvs2/lockDesktop.sh
+++ b/core/modules/xscreensaver/data/opt/openslx/pvs2/lockDesktop.sh
@@ -1,25 +1,22 @@
#!/bin/ash
-# Problem: While any application (e.g. VMware) is holding the mouse and
-# keyboard grab, xscreensaver couldn't grab them, so it will ignore the
-# locking request. Without the keyboard grab, all input would still go
-# to the vmware window below the black screen, which is, you know, bad,
-# since you cannot enter your password to unlock the workstation again.
+[ -z "$UID" ] && UID="$( id -u )"
-# So we minimize vmware, lock the screen, and then restore vmware.
-# TODO: Add other virtualizers (vbox, kvm) later if needed.
-WINDOWS=$(xdotool search --onlyvisible --class vmplayer)
-for window in $WINDOWS; do
- xdotool windowminimize $window
-done
-# move mouse pointer to the center of the screen to avoid some problems with ghost clicks
-xdotool mousemove --sync --polar 0 0
+usrname="$( < "/etc/passwd" awk -v "uid=$UID" -F ':' '$3 == uid {print $5; exit}' )"
+# Yes, this really checks if $usrname ends in @browser, and sets NEVER_LOCK to true if so
+if [ "${usrname%"@browser"}" != "${usrname}" ]; then
+ xmessage "Web-Basierte Logins koennen die Sitzung leider nicht sperren."
+ exit 0
+else
+ . /opt/openslx/config
+ if [ -n "$SLX_EXAM" ]; then
+ xmessage "Im Klausurmodus nicht moeglich"
+ exit 0
+ fi
+fi
-# now actually lock
-xscreensaver-command --lock
+# Any mouse-ungrab logic is embedded in our modded xscreensaver now,
+# via external ungrab script
-# above lock call is blocking, so now xscreensaver should be active - let's restore vmware
-for window in $WINDOWS; do
- xdotool windowmap $window
-done
+xscreensaver-command --lock