diff options
author | Ted Gould <ted@gould.cx> | 2013-08-30 19:50:10 +0000 |
---|---|---|
committer | Tarmac <Unknown> | 2013-08-30 19:50:10 +0000 |
commit | 598003c711072f89a86b3021d3b829f6a8b199ae (patch) | |
tree | 9b1479fa5bad9d17b6336a87bcb919005f2ec1a1 | |
parent | 9ecfe061ca5446d46f9b8a820c9ea6569ba0e64c (diff) | |
parent | fc67bcd5aaa0823862951dc05a9c844c833e074b (diff) | |
download | ayatana-greeter-session-broadcast-598003c711072f89a86b3021d3b829f6a8b199ae.tar.gz ayatana-greeter-session-broadcast-598003c711072f89a86b3021d3b829f6a8b199ae.tar.bz2 ayatana-greeter-session-broadcast-598003c711072f89a86b3021d3b829f6a8b199ae.zip |
Get name owner and make sure it matches the sender.
Approved by Michael Terry, PS Jenkins bot.
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | data/com.canonical.Unity.Greeter.Broadcast.service.in | 1 | ||||
-rw-r--r-- | data/unity-greeter-session-broadcast-session.conf | 28 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rwxr-xr-x | test-call.sh | 3 |
5 files changed, 34 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 97d6cad..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 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}") +message("Installing DBus system services to ${DBUSSERVICEDIR}") if(${LOCAL_INSTALL}) set(DBUSSYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}") 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 diff --git a/data/unity-greeter-session-broadcast-session.conf b/data/unity-greeter-session-broadcast-session.conf index 0e92905..db2425c 100644 --- a/data/unity-greeter-session-broadcast-session.conf +++ b/data/unity-greeter-session-broadcast-session.conf @@ -6,6 +6,30 @@ 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 BUS=system SIGNAL="StartApplication" INTERFACE="com.canonical.Unity.Greeter.Broadcast" PATH="/com/canonical/Unity/Greeter/Broadcast" -exec initctl emit application-start APP_ID=${ARG1} +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 + stop + exit 1 + fi + if [ $OWNER != $SENDER ] ; then + stop + exit 1 + fi +end script + +exec /sbin/initctl emit application-start APP_ID=${ARG1} diff --git a/debian/control b/debian/control index f24aefd..2fa5f9e 100644 --- a/debian/control +++ b/debian/control @@ -10,6 +10,7 @@ Build-Depends: cmake, intltool, libdbus-1-dev, libdbustest1-dev, + libglib2.0-bin, python3-dbusmock, Standards-Version: 3.9.4 Homepage: http://launchpad.net/unity-greeter-session-broadcast 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 |