summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--legacy-app-handler/Makefile.am7
-rw-r--r--legacy-app-handler/la-handler-service.c10
-rw-r--r--legacy-app-handler/main.c6
-rw-r--r--legacy-app-handler/org.genivi.LegacyAppHandler1.conf9
-rw-r--r--legacy-app-handler/org.genivi.LegacyAppHandler1.service.in (renamed from legacy-app-handler/org.genivi.LAHandler1.service.in)2
5 files changed, 30 insertions, 4 deletions
diff --git a/legacy-app-handler/Makefile.am b/legacy-app-handler/Makefile.am
index 4f2425e..9ac1c0c 100644
--- a/legacy-app-handler/Makefile.am
+++ b/legacy-app-handler/Makefile.am
@@ -1,5 +1,10 @@
# vi:set ts=8 sw=8 noet ai nocindent:
+legacy_app_handler_confdir = /etc/dbus-1/system.d
+
+legacy_app_handler_conf_DATA = \
+ org.genivi.LegacyAppHandler1.conf
+
legacy_app_handlerdir = \
$(libdir)/legacy-app-handler-$(BOOT_MANAGER_VERSION_API)
@@ -49,7 +54,7 @@ legacy_app_handler_LDADD = \
servicedir = $(datadir)/dbus-1/services
service_in_files = \
- org.genivi.LAHandler1.service.in
+ org.genivi.LegacyAppHandler1.service.in
service_DATA = $(service_in_files:.service.in=.service)
diff --git a/legacy-app-handler/la-handler-service.c b/legacy-app-handler/la-handler-service.c
index a774756..d042bf8 100644
--- a/legacy-app-handler/la-handler-service.c
+++ b/legacy-app-handler/la-handler-service.c
@@ -92,6 +92,7 @@ struct _LAHandlerService
const gchar *prefix;
guint index;
+ guint bus_name_id;
};
@@ -137,6 +138,7 @@ la_handler_service_constructed (GObject *object)
GError *error = NULL;
gchar *log_text;
+ /* connect to the boot manager */
service->boot_manager = boot_manager_proxy_new_sync (service->connection,
G_DBUS_PROXY_FLAGS_NONE,
"org.genivi.BootManager1",
@@ -151,6 +153,11 @@ la_handler_service_constructed (GObject *object)
g_free (log_text);
g_error_free (error);
}
+
+ /* get a bus name on the system bus */
+ service->bus_name_id =
+ g_bus_own_name_on_connection (service->connection, "org.genivi.LegacyAppHandler1",
+ G_BUS_NAME_OWNER_FLAGS_NONE, NULL, NULL, NULL, NULL);
}
@@ -189,6 +196,9 @@ la_handler_service_finalize (GObject *object)
{
LAHandlerService *service = LA_HANDLER_SERVICE (object);
+ /* release the bus name */
+ g_bus_unown_name (service->bus_name_id);
+
/* release the D-Bus connection object */
if (service->connection != NULL)
g_object_unref (service->connection);
diff --git a/legacy-app-handler/main.c b/legacy-app-handler/main.c
index 8ac39fc..a7a9d93 100644
--- a/legacy-app-handler/main.c
+++ b/legacy-app-handler/main.c
@@ -69,8 +69,8 @@ main (int argc,
g_type_init ();
/* attempt to connect to D-Bus */
- connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
- if (connection == NULL)
+ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (connection == NULL || error != NULL || !G_IS_DBUS_CONNECTION (connection))
{
log_text = g_strdup_printf ("Failed to connect to D-Bus: %s", error->message);
DLT_LOG (la_handler_context, DLT_LOG_ERROR, DLT_STRING (log_text));
@@ -117,6 +117,8 @@ main (int argc,
application =
la_handler_application_new (service, G_APPLICATION_IS_SERVICE);
}
+
+ /* run the application */
exit_status = g_application_run (G_APPLICATION (application), argc, argv);
g_object_unref (application);
diff --git a/legacy-app-handler/org.genivi.LegacyAppHandler1.conf b/legacy-app-handler/org.genivi.LegacyAppHandler1.conf
new file mode 100644
index 0000000..d418d23
--- /dev/null
+++ b/legacy-app-handler/org.genivi.LegacyAppHandler1.conf
@@ -0,0 +1,9 @@
+<!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.genivi.LegacyAppHandler1"/>
+ <allow send_destination="org.genivi.LegacyAppHandler1" />
+ <allow receive_sender="org.genivi.LegacyAppHandler1" />
+ </policy>
+</busconfig>
diff --git a/legacy-app-handler/org.genivi.LAHandler1.service.in b/legacy-app-handler/org.genivi.LegacyAppHandler1.service.in
index 699c728..ac52817 100644
--- a/legacy-app-handler/org.genivi.LAHandler1.service.in
+++ b/legacy-app-handler/org.genivi.LegacyAppHandler1.service.in
@@ -1,3 +1,3 @@
[D-BUS Service]
-Name=org.genivi.LAHandler1
+Name=org.genivi.LegacyAppHandler1
Exec=@libdir@/legacy-app-handler-@BOOT_MANAGER_VERSION_API@/legacy-app-handler