geoclue2/geoclue2-no-root.patch

84 lines
2.6 KiB
Diff
Raw Normal View History

From cb074265bbf0274990b5cc2da084c21d34a38853 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Wed, 04 Sep 2013 17:56:49 +0000
Subject: build: Add configure option to specify service user
This is the user as which the service will run as.
https://bugs.freedesktop.org/show_bug.cgi?id=68947
Co-Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
---
diff --git a/configure.ac b/configure.ac
index b64550c..a2c04e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,12 +119,20 @@ else
fi
AC_SUBST(DBUS_SYS_DIR)
+AC_ARG_WITH(dbus-service-user,
+ AS_HELP_STRING([--with-dbus-service-user=USER],
+ [The USER (existing) as which the service will run (default: root)]),
+ dbus_srv_user="$with_dbus_service_user",
+ dbus_srv_user="root")
+AC_SUBST(dbus_srv_user)
+
AC_CONFIG_FILES([
Makefile
src/Makefile
src/geoclue-2.0.pc
src/geoip-server/Makefile
po/Makefile.in
+ data/org.freedesktop.GeoClue2.conf
data/Makefile
demo/Makefile
])
diff --git a/data/Makefile.am b/data/Makefile.am
index 348ca42..1c46d0e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -3,12 +3,11 @@ service_in_files = org.freedesktop.GeoClue2.service.in
service_DATA = $(service_in_files:.service.in=.service)
$(service_DATA): $(service_in_files) Makefile
- @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+ @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< | \
+ sed -e "s|\@dbus_srv_user\@|$(dbus_srv_user)|" > $@
# DBus Service policy file
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = org.freedesktop.GeoClue2.conf
-EXTRA_DIST = $(service_in_files) \
- $(dbusservice_DATA)
DISTCLEANFILES = $(service_DATA)
diff --git a/data/org.freedesktop.GeoClue2.conf b/data/org.freedesktop.GeoClue2.conf.in
index 3b3292f..79b2f5f 100644
--- a/data/org.freedesktop.GeoClue2.conf
+++ b/data/org.freedesktop.GeoClue2.conf.in
@@ -8,8 +8,8 @@
<allow send_destination="org.freedesktop.GeoClue2"/>
</policy>
- <policy user="root">
- <!-- Only allow root to own the name on the bus -->
+ <policy user="@dbus_srv_user@">
+ <!-- Only allow @dbus_srv_user@ to own the name on the bus -->
<allow own="org.freedesktop.GeoClue2"/>
</policy>
</busconfig>
diff --git a/data/org.freedesktop.GeoClue2.service.in b/data/org.freedesktop.GeoClue2.service.in
index 948c644..51cbdb2 100644
--- a/data/org.freedesktop.GeoClue2.service.in
+++ b/data/org.freedesktop.GeoClue2.service.in
@@ -1,4 +1,4 @@
[D-BUS Service]
Name=org.freedesktop.GeoClue2
Exec=@libexecdir@/geoclue -t 5
-User=root
+User=@dbus_srv_user@
--
cgit v0.9.0.2-2-gbebe