Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
---
 configure.ac                 | 10 ++++++++++
 data/Makefile.am             |  8 +++++++-
 data/system/org.libvirt.conf | 12 ++++++++++++
 libvirt-dbus.spec.in         |  1 +
 4 files changed, 30 insertions(+), 1 deletion(-)
 create mode 100644 data/system/org.libvirt.conf

diff --git a/configure.ac b/configure.ac
index 65071f9..4c654fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,16 @@ else
 fi
 AC_SUBST(DBUS_SYSTEM_SERVICES_DIR)
 
+AC_ARG_WITH(dbus-system-policies,
+            [AC_HELP_STRING([--with-dbus-system-policies=<dir>],
+                            [where D-BUS system policies directory is])])
+if ! test -z "$with_dbus_system_policies" ; then
+    DBUS_SYSTEM_POLICIES_DIR="$with_dbus_system_policies"
+else
+    DBUS_SYSTEM_POLICIES_DIR="$datadir/dbus-1/system.d"
+fi
+AC_SUBST(DBUS_SYSTEM_POLICIES_DIR)
+
 AC_OUTPUT(Makefile
           data/Makefile
           src/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index b8f1376..58e855f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -8,9 +8,15 @@ system_service_in_files = \
 system_servicedir = $(DBUS_SYSTEM_SERVICES_DIR)
 system_service_DATA = $(system_service_in_files:.service.in=.service)
 
+system_policy_files = \
+       system/org.libvirt.conf
+system_policydir = $(DBUS_SYSTEM_POLICIES_DIR)
+system_policy_DATA = $(system_policy_files)
+
 EXTRA_DIST = \
        $(service_in_files) \
-       $(system_service_in_files)
+       $(system_service_in_files) \
+       $(system_policy_files)
 
 CLEANFILES = \
        $(service_DATA) \
diff --git a/data/system/org.libvirt.conf b/data/system/org.libvirt.conf
new file mode 100644
index 0000000..5cbc732
--- /dev/null
+++ b/data/system/org.libvirt.conf
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 
1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
+
+<busconfig>
+
+  <policy user="root">
+    <allow own="org.libvirt"/>
+    <allow send_destination="org.libvirt"/>
+  </policy>
+
+</busconfig>
diff --git a/libvirt-dbus.spec.in b/libvirt-dbus.spec.in
index 0f76de2..5be4c22 100644
--- a/libvirt-dbus.spec.in
+++ b/libvirt-dbus.spec.in
@@ -43,5 +43,6 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/libvirt-dbus
 %{_datadir}/dbus-1/services/org.libvirt.service
 %{_datadir}/dbus-1/system-services/org.libvirt.service
+%{_datadir}/dbus-1/system.d/org.libvirt.conf
 
 %changelog
-- 
2.13.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to