File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,14 @@ while IFS= read -r line; do
2929 if [ -f " /tmp/codam_web_greeter_lock_timestamp_$USERNAME " ]; then
3030 # Get the locked_at_timestamp from the file
3131 LOCKED_AT_TIMESTAMP=$( /usr/bin/awk ' {print $1}' " /tmp/codam_web_greeter_lock_timestamp_$USERNAME " )
32- # Calculate the time since the session was locked
33- TIME_SINCE_LOCK=$(( ($(date +% s) - LOCKED_AT_TIMESTAMP) * 1000 ))
32+ # Sanitize the timestamp to ensure it's a number
33+ if [[ " $LOCKED_AT_TIMESTAMP " =~ ^[0-9]+$ ]]; then
34+ # Calculate the time since the session was locked
35+ TIME_SINCE_LOCK=$(( ($(date +% s) - LOCKED_AT_TIMESTAMP) * 1000 ))
36+ else
37+ echo " Warning: Invalid timestamp in /tmp/codam_web_greeter_lock_timestamp_$USERNAME : $LOCKED_AT_TIMESTAMP " >&2
38+ TIME_SINCE_LOCK=0
39+ fi
3440 fi
3541
3642 # Check if session has been idle for long enough
You can’t perform that action at this time.
0 commit comments