From 57314df9b046a04d7e9e11930e739b4647d1b978 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 6 May 2018 02:00:13 +0200 Subject: Switch from pkglibexecdir -> libexecdir. Replace socket-sucker by socat call. --- Makefile.am | 17 ++------- debian/control | 1 + freerdp2-session.in | 2 +- freerdp2.desktop.in | 4 +- lightdm-remote-session-freerdp2.in | 2 +- socket-sucker.c | 77 -------------------------------------- 6 files changed, 9 insertions(+), 94 deletions(-) delete mode 100644 socket-sucker.c diff --git a/Makefile.am b/Makefile.am index a02b80f..75aab62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,14 +7,14 @@ lightdm_session_DATA = \ freerdp2.desktop %.desktop: %.desktop.in - @sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ + @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ session_startdir = $(pkgdatadir) session_start_SCRIPTS = \ freerdp2-session freerdp2-session: freerdp2-session.in - @sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ + @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ @chmod +x $@ apparmordir = $(sysconfdir)/apparmor.d/ @@ -22,20 +22,11 @@ apparmor_DATA = \ lightdm-remote-session-freerdp2 lightdm-remote-session-freerdp2: lightdm-remote-session-freerdp2.in - @sed -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ + @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ -pkglibexec_PROGRAMS = \ - socket-sucker \ +libexec_PROGRAMS = \ freerdp2-session-wrapper -socket_sucker_SOURCES = \ - socket-sucker.c -socket_sucker_CFLAGS = \ - -Wall -Werror \ - -fPIE -socket_sucker_LDFLAGS = \ - -pie - freerdp2_session_wrapper_SOURCES = \ freerdp2-session-wrapper.c freerdp2_session_wrapper_CFLAGS = \ diff --git a/debian/control b/debian/control index f461785..d20bbf9 100644 --- a/debian/control +++ b/debian/control @@ -24,6 +24,7 @@ Depends: freerdp2-x11 (>= 2~), libpam-freerdp2, lightdm (>= 1.3.3-0~), + socat, Suggests: apparmor, Description: Log into RDP sessions via LightDM diff --git a/freerdp2-session.in b/freerdp2-session.in index e6a8b32..0242a13 100755 --- a/freerdp2-session.in +++ b/freerdp2-session.in @@ -1,7 +1,7 @@ #!/bin/bash if [ -e ~/.freerdp-socket ]; then - @pkglibexecdir@/socket-sucker | /usr/bin/xfreerdp /sound:sys:pulse /f /from-stdin + socat unix-connect:"$socket" - | /usr/bin/xfreerdp /sound:sys:pulse /f /from-stdin else zenity --warning --text="Unable to locate FreeRDP socket" fi; diff --git a/freerdp2.desktop.in b/freerdp2.desktop.in index 1944b83..28c8076 100644 --- a/freerdp2.desktop.in +++ b/freerdp2.desktop.in @@ -1,8 +1,8 @@ [Desktop Entry] Name=FreeRDP Comment=Full Screen RDP session -Exec=@pkglibexecdir@/freerdp2-session-wrapper -TryExec=@pkglibexecdir@/freerdp2-session-wrapper +Exec=@libexecdir@/freerdp2-session-wrapper +TryExec=@libexecdir@/freerdp2-session-wrapper Icon= Type=Application X-LightDM-PAM-Service=lightdm-remote-freerdp2 diff --git a/lightdm-remote-session-freerdp2.in b/lightdm-remote-session-freerdp2.in index f33ec7c..239c5de 100644 --- a/lightdm-remote-session-freerdp2.in +++ b/lightdm-remote-session-freerdp2.in @@ -5,7 +5,7 @@ #include -@pkglibexecdir@/freerdp2-session-wrapper { +@libexecdir@/freerdp2-session-wrapper { #include #include #include diff --git a/socket-sucker.c b/socket-sucker.c deleted file mode 100644 index 07734cc..0000000 --- a/socket-sucker.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright © 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 . - * - * Author: Ted Gould - */ - -#include -#include -#include - -#include -#include -#include - -#define BUFFER_SIZE 256 - -int -main (int argc, char * argv[]) -{ - int socket_fd = 0; - int servlen = 0; - struct sockaddr_un serv_addr; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - - const char * home = getenv("HOME"); - if (home == NULL) { - return -1; - } - - serv_addr.sun_family = AF_UNIX; - - int printsize = snprintf(serv_addr.sun_path, sizeof(serv_addr.sun_path) - 1, "%s/%s", home, ".freerdp2-socket"); - if (printsize > sizeof(serv_addr.sun_path) - 1 || printsize < 0) { - return -1; - } - - servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family); - - if ((socket_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - return -1; - } - - if (connect(socket_fd, (struct sockaddr *)&serv_addr, servlen) < 0) { - return -1; - } - - char buffer[BUFFER_SIZE + 2]; - int in = 0; - int out = 0; - - in = read(socket_fd, buffer, BUFFER_SIZE); - - if (in > 0) { - out = write(1, buffer, in); - } - - close(socket_fd); - - if (in > 0 && out > 0 && in == out) { - return 0; - } else { - return -1; - } -} -- cgit v1.2.3