aboutsummaryrefslogtreecommitdiff
path: root/freerdp-session.in
diff options
context:
space:
mode:
Diffstat (limited to 'freerdp-session.in')
-rwxr-xr-xfreerdp-session.in75
1 files changed, 75 insertions, 0 deletions
diff --git a/freerdp-session.in b/freerdp-session.in
new file mode 100755
index 0000000..a438ffa
--- /dev/null
+++ b/freerdp-session.in
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2018-2024 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+# Copyright (C) 2012 Canonical Ltd.
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 3, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranties of
+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+# Author lightdm-remote-session-freerdp (where we forked from): Ted Gould <ted@canonical.com>
+#
+
+NULL=
+FREERDP_OPTIONS=""
+
+if [ -f /etc/default/lightdm-remote-session-freerdp ]; then
+ . /etc/default/lightdm-remote-session-freerdp
+fi
+
+socket="$HOME/.freerdp-socket";
+if [ -e "$socket" ]; then
+ AUTH_INFO="$(socat unix-connect:"$socket" -)"
+ AUTH_INFO_USER=$(echo "$AUTH_INFO" | awk '{ print $1 }')
+ AUTH_INFO_PASSWORD=$(echo "$AUTH_INFO" | awk '{ print $2 }')
+ AUTH_INFO_DOMAIN=$(echo "$AUTH_INFO" | awk '{ print $3 }')
+ AUTH_INFO_HOST=$(echo "$AUTH_INFO" | awk '{ print $4 }')
+
+ # FIXME: it seems, pulseaudio is not started at this point for the guest user
+ # However, launching it here with pulseaudio -D feels wrong in the age of systemd
+
+ # give the RDP server a little bit of time to recover from libpam-freerdp's freerdp-auth-check test connect.
+ sleep 1
+
+ FREERDP_OPTIONS="/f \
+ /v:"${AUTH_INFO_HOST}" \
+ /u:"${AUTH_INFO_USER}" \
+ /d:"${AUTH_INFO_DOMAIN}" \
+ /from-stdin \
+ -toggle-fullscreen \
+ ${FREERDP_OPTIONS} \
+ ${NULL}"
+
+ logger -t $(basname $0) "xfreerdp called with options: ${FREERDP_OPTIONS}."
+
+
+ # FIXME: get audio working... add /sound:sys:pulse to xfreerdp cmdline args...
+ echo "$AUTH_INFO_PASSWORD" | /usr/bin/xfreerdp ${FREERDP_OPTIONS} 2>&1 \
+ | logger -t lightdm-remote-session-freerdp -- \
+ ${NULL} &
+
+ unset AUTH_INFO_PASSWORD
+
+ # wait for another second to give the xfreerdp process to settle in process list
+ sleep 1
+
+ USERID=$(id -u)
+ wait $(pgrep -u ${USERID} xfreerdp)
+
+ # FIXME: possibly stop pulseaudio here with -k again (we have seen permissioned denied warnings, when doing this. Better approaches?)
+
+else
+ zenity --warning --text="Unable to locate FreeRDP socket"
+fi;
+
+rm -f "$socket"