Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qubes.WaitForSession: refactor by waiting for qrexec-fork-server socket #192

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions qubes-rpc/qubes.WaitForSession
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
#!/bin/sh

# old API - get the user from caller
#read -r IGNORE_USERNAME
USERNAME="$(qubesdb-read /default-user || echo 'user')"

# use default user provided in QubesDB, or hardcoded 'user' - this must be the
# same as the X session owner
USERNAME=$(qubesdb-read /default-user || echo 'user')
cmd='echo $$ >> /tmp/qubes-session-waiter; [ ! -f /tmp/qubes-session-env ] && exec sleep inf'
if [ "$(id -un)" = "$USERNAME" ]; then
sh -c "$cmd" 2>/dev/null
else
su -s /bin/sh -c "$cmd" - "$USERNAME" 2> /dev/null
fi
# the above line is _expected_ to be terminated by a signal, don't treat this as a failure
exit 0
while ! [ -e "/var/run/qubes/qrexec-server.$USERNAME.sock" ]
do
sleep 0.1
done