From a87d8a81765ec52b2c31a560d4ee903695eaf961 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 2 Aug 2013 10:45:39 -0500 Subject: Check the sender by asking who owns the name --- data/unity-greeter-session-broadcast-session.conf | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/data/unity-greeter-session-broadcast-session.conf b/data/unity-greeter-session-broadcast-session.conf index 0e92905..fa1c430 100644 --- a/data/unity-greeter-session-broadcast-session.conf +++ b/data/unity-greeter-session-broadcast-session.conf @@ -6,6 +6,20 @@ task emits application-start #TODO: Check GSettings Key -start on dbus-system SIGNAL="StartApplication" INTERFACE="com.canonical.Unity.Greeter.Broadcast" SENDER="com.canonical.Unity.Greeter.Broadcast" PATH="/com/canonical/Unity/Greeter/Broadcast" ARG0=${USER} +start on dbus-system SIGNAL="StartApplication" INTERFACE="com.canonical.Unity.Greeter.Broadcast" PATH="/com/canonical/Unity/Greeter/Broadcast" ARG0=${USER} + +pre-start script + OWNER=`gdbus call --system --dest org.freedesktop.DBus --object-path / --method org.freedesktop.DBus.GetNameOwner com.canonical.Unity.Greeter.Broadcast | cut -d "'" -f 2` + + if [ -z $OWNER ] ; then + stop + exit 1 + fi + if [ $OWNER -ne $SENDER ] ; then + stop + exit 1 + fi +end script + exec initctl emit application-start APP_ID=${ARG1} -- cgit v1.2.3 From ca03238ba1b189391ffdd7de4b7a15d4a3e7711a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 2 Aug 2013 10:51:09 -0500 Subject: Go for string comparison --- data/unity-greeter-session-broadcast-session.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/unity-greeter-session-broadcast-session.conf b/data/unity-greeter-session-broadcast-session.conf index fa1c430..a5b744c 100644 --- a/data/unity-greeter-session-broadcast-session.conf +++ b/data/unity-greeter-session-broadcast-session.conf @@ -15,7 +15,7 @@ pre-start script stop exit 1 fi - if [ $OWNER -ne $SENDER ] ; then + if [ $OWNER != $SENDER ] ; then stop exit 1 fi -- cgit v1.2.3 From c4a2f359a3a82fa233a486d05213107ee2f64ed7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 27 Aug 2013 20:20:30 -0500 Subject: Add libglib2.0-bin to get gdbus --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 55a0346..9ac58e5 100644 --- a/debian/control +++ b/debian/control @@ -10,6 +10,7 @@ Build-Depends: cmake, intltool, libdbustest1-dev, libdbus-1-dev, + libglib2.0-bin, python3-dbusmock, Standards-Version: 3.9.4 Homepage: http://launchpad.net/unity-greeter-session-broadcast -- cgit v1.2.3 From 6646f8c2a62d8ff7bac22dddb2ccaa4e2b5a2f05 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Aug 2013 14:08:04 -0500 Subject: Move the user into the script and handle the lack of PATH --- data/unity-greeter-session-broadcast-session.conf | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/data/unity-greeter-session-broadcast-session.conf b/data/unity-greeter-session-broadcast-session.conf index a5b744c..db2425c 100644 --- a/data/unity-greeter-session-broadcast-session.conf +++ b/data/unity-greeter-session-broadcast-session.conf @@ -6,9 +6,20 @@ task emits application-start #TODO: Check GSettings Key -start on dbus-system SIGNAL="StartApplication" INTERFACE="com.canonical.Unity.Greeter.Broadcast" PATH="/com/canonical/Unity/Greeter/Broadcast" ARG0=${USER} +start on dbus BUS=system SIGNAL="StartApplication" INTERFACE="com.canonical.Unity.Greeter.Broadcast" PATH="/com/canonical/Unity/Greeter/Broadcast" pre-start script + PATH="/bin:/usr/bin:/sbin:/usr/sbin" + + if [ -z $ARG0 ] ; then + stop + exit 1 + fi + if [ $ARG0 != $USER ] ; then + stop + exit 1 + fi + OWNER=`gdbus call --system --dest org.freedesktop.DBus --object-path / --method org.freedesktop.DBus.GetNameOwner com.canonical.Unity.Greeter.Broadcast | cut -d "'" -f 2` if [ -z $OWNER ] ; then @@ -21,5 +32,4 @@ pre-start script fi end script - -exec initctl emit application-start APP_ID=${ARG1} +exec /sbin/initctl emit application-start APP_ID=${ARG1} -- cgit v1.2.3 From b4ded87e23078de8411ea19bfeb647fb1d3a5b96 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Aug 2013 14:10:12 -0500 Subject: Handy little script --- test-call.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 test-call.sh diff --git a/test-call.sh b/test-call.sh new file mode 100755 index 0000000..bc1ffac --- /dev/null +++ b/test-call.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gdbus call --system --dest com.canonical.Unity.Greeter.Broadcast --object-path /com/canonical/Unity/Greeter/Broadcast --method com.canonical.Unity.Greeter.Broadcast.RequestApplicationStart $1 $2 -- cgit v1.2.3 From 427fce067da2e33fda61fe4f44ae82525a546ec7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Aug 2013 14:12:16 -0500 Subject: Install as a system bus service --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97d6cad..327ffa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ include_directories(${GIO_UNIX2_INCLUDE_DIRS}) if(${LOCAL_INSTALL}) set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services/") else() - EXEC_PROGRAM(${PKG_CONFIG_EXECUTABLE} ARGS dbus-1 --variable session_bus_services_dir OUTPUT_VARIABLE DBUSSERVICEDIR ) + EXEC_PROGRAM(${PKG_CONFIG_EXECUTABLE} ARGS dbus-1 --variable system_bus_services_dir OUTPUT_VARIABLE DBUSSERVICEDIR ) endif() message("Installing DBus services to ${DBUSSERVICEDIR}") -- cgit v1.2.3 From 64ea3383c0e5c3a073078e565cace1bc7d5dbd9b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Aug 2013 14:25:31 -0500 Subject: Add a user so we can do system activation --- data/com.canonical.Unity.Greeter.Broadcast.service.in | 1 + 1 file changed, 1 insertion(+) diff --git a/data/com.canonical.Unity.Greeter.Broadcast.service.in b/data/com.canonical.Unity.Greeter.Broadcast.service.in index 692c371..9cfe989 100644 --- a/data/com.canonical.Unity.Greeter.Broadcast.service.in +++ b/data/com.canonical.Unity.Greeter.Broadcast.service.in @@ -1,3 +1,4 @@ [D-BUS Service] Name=com.canonical.Unity.Greeter.Broadcast Exec=@pkglibexecdir@/unity-greeter-session-broadcast-service +User=root -- cgit v1.2.3 From fc67bcd5aaa0823862951dc05a9c844c833e074b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 30 Aug 2013 14:43:30 -0500 Subject: Making sure the local install directory is correct --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 327ffa8..c2e8001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,11 +40,11 @@ pkg_check_modules(GIO_UNIX2 REQUIRED gio-unix-2.0) include_directories(${GIO_UNIX2_INCLUDE_DIRS}) if(${LOCAL_INSTALL}) - set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/services/") + set(DBUSSERVICEDIR "${CMAKE_INSTALL_DATADIR}/dbus-1/system-services/") else() EXEC_PROGRAM(${PKG_CONFIG_EXECUTABLE} ARGS dbus-1 --variable system_bus_services_dir OUTPUT_VARIABLE DBUSSERVICEDIR ) endif() -message("Installing DBus services to ${DBUSSERVICEDIR}") +message("Installing DBus system services to ${DBUSSERVICEDIR}") if(${LOCAL_INSTALL}) set(DBUSSYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}") -- cgit v1.2.3