summaryrefslogtreecommitdiffstats
path: root/core/modules/idleaction
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/idleaction
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/idleaction')
-rwxr-xr-xcore/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver b/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
index 5cdeeac5..441d9243 100755
--- a/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
+++ b/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
@@ -3,6 +3,7 @@
if command -v xscreensaver; then
DPMS=False
AUTOLOCK=True
+ NEVER_LOCK=
secsToTime() {
local NUM SECS MINS HRS
NUM="$1"
@@ -23,6 +24,7 @@ if command -v xscreensaver; then
if [ -n "${SLX_EXAM}" ]; then
SLX_SCREEN_SAVER_GRACE_TIME=
AUTOLOCK=False
+ NEVER_LOCK=True
SBY=0
SVR=0
elif [ -z "$SBY" ]; then
@@ -32,6 +34,12 @@ if command -v xscreensaver; then
elif ! [ "$SBY" -ge 0 ]; then # isNumeric?
SBY=0
fi
+ # If web based login, we can't authenticate again as we don't have the password - never lock
+ if [ -z "$NEVER_LOCK" ]; then
+ 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
+ [ "${usrname%"@browser"}" != "${usrname}" ] && NEVER_LOCK=True
+ fi
# Create config value for standby timeout
if [ "$SBY" -gt 0 ]; then
DPMS=True
@@ -79,7 +87,7 @@ EOF
# HACK: This env vars prevent xscreensaver from ever locking
# Only one would be needed but set both in case one of them
# gets removed in the future.
- if [ -n "$SLX_EXAM" ]; then
+ if [ -n "$NEVER_LOCK" ]; then
export RUNNING_UNDER_GDM="not really but yea"
export WAYLAND_DISPLAY="none, haha"
fi