From 8600e0e3f26990184f73f38b907bd772d55144d1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 12 Nov 2018 13:34:11 +0900 Subject: [PATCH 01/16] Release version 0.1.12 Changes: - Dbus policy: apply default deny for own_prefix Change-Id: Idd0e19f191d48e240bda0607bacb60d6271f43c8 Signed-off-by: Hwankyu Jhun --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index 085d055..d42d355 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.11 +Version: 0.1.12 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From c1fbc105cd1008ea2cf1f5d13ff40cf0f1e5c1c8 Mon Sep 17 00:00:00 2001 From: jusung son Date: Fri, 7 Dec 2018 16:23:08 +0900 Subject: [PATCH 02/16] Fix dlog format Change-Id: I0d4b3327a5f38da5b7dbb4617b05938c6255c132 Signed-off-by: jusung son --- src/esd_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/esd_main.c b/src/esd_main.c index 1655228..d0b58dc 100644 --- a/src/esd_main.c +++ b/src/esd_main.c @@ -1181,7 +1181,7 @@ static int check_user_event_sender_valid(const char *event_name, const char *app } *tmp = '\0'; - _D("app_id(%s), len(%d)", app_id, strlen(app_id)); + _D("app_id(%s), len(%zu)", app_id, strlen(app_id)); valid_name_len = strlen(USER_EVENT_NAME_PREFIX) + strlen(app_id) + 1; valid_name = calloc(1, valid_name_len); -- 2.7.4 From 49853ec13ced15c1f8b2d44ea2e6b14ab821e129 Mon Sep 17 00:00:00 2001 From: jusung son Date: Fri, 7 Dec 2018 17:31:30 +0900 Subject: [PATCH 03/16] Release version 0.1.13 Changes: - Fix dlog format Change-Id: I3ff34104337db22f7e85900df07a0d6f41c07020 Signed-off-by: jusung son --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index d42d355..873477a 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.12 +Version: 0.1.13 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From 320bb0c784a5ad5b1d07c414a6ed0990fc9af9bd Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Thu, 24 Jan 2019 09:08:16 +0900 Subject: [PATCH 04/16] Support launch_on_event with user event Change-Id: I809ca8ec8727c4ad40f81db6002f55d73af4613c Signed-off-by: Inkyun Kil Signed-off-by: jusung son --- CMakeLists.txt | 2 +- packaging/esd.spec | 1 + src/esd_main.c | 277 +++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 231 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3936be4..ef58439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) ### Required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED dlog bundle pkgmgr-info glib-2.0 gio-2.0 appsvc aul vconf libtzplatform-config libsystemd-daemon cynara-client cynara-creds-gdbus cynara-session security-manager) +pkg_check_modules(pkgs REQUIRED dlog bundle pkgmgr-info glib-2.0 gio-2.0 appsvc aul vconf libtzplatform-config libsystemd-daemon cert-svc-vcore cynara-client cynara-creds-gdbus cynara-session security-manager) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/packaging/esd.spec b/packaging/esd.spec index 873477a..95ed77a 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(eventsystem) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libsystemd-daemon) +BuildRequires: pkgconfig(cert-svc-vcore) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(cynara-creds-gdbus) BuildRequires: pkgconfig(cynara-session) diff --git a/src/esd_main.c b/src/esd_main.c index d0b58dc..4826b08 100644 --- a/src/esd_main.c +++ b/src/esd_main.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,8 @@ #include #include #include +#include +#include #include #include #include @@ -96,9 +99,16 @@ typedef struct __eventlaunch_item_param { char *app_id; } eventlaunch_item_param_s; +enum trusted_result { + TRUSTED_UNKNOWN, + TRUSTED_ALLOWED, + TRUSTED_DENIED, +}; + typedef struct esd_list_item { char *pkg_id; char *app_id; + int trusted_info; uid_t uid; } esd_list_item_s; @@ -125,6 +135,10 @@ typedef struct __pkgmgr_event { typedef struct __esd_event_param { char *event_name; bundle *event_data; + uid_t sender_uid; + char *sender_appid; + bool is_user_event; + bool trusted; void *user_data; } esd_event_param; @@ -190,6 +204,74 @@ static int __esd_check_earlier_support(const char *event_name) } #endif +static bool __esd_check_platform_cert(const char *pkgid, uid_t uid) +{ + _D("Checking if %s has a platform certification", pkgid); + + int r; + const char *cert_value; + pkgmgrinfo_certinfo_h certinfo; + CertSvcInstance instance; + CertSvcCertificate certificate; + CertSvcVisibility visibility = CERTSVC_VISIBILITY_PUBLIC; + + r = pkgmgrinfo_pkginfo_create_certinfo(&certinfo); + if (r != PMINFO_R_OK) { + _E("Failed to create certinfo"); + return false; + } + + r = pkgmgrinfo_pkginfo_load_certinfo(pkgid, certinfo, uid); + if (r != PMINFO_R_OK) { + _E("Failed to load certinfo"); + pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); + return false; + } + + r = pkgmgrinfo_pkginfo_get_cert_value(certinfo, + PMINFO_DISTRIBUTOR_ROOT_CERT, &cert_value); + if (r != PMINFO_R_OK || cert_value == NULL) { + _E("Failed to get cert value"); + pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); + return false; + } + + r = certsvc_instance_new(&instance); + if (r != CERTSVC_SUCCESS) { + _E("certsvc_instance_new() is failed."); + pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); + return false; + } + + r = certsvc_certificate_new_from_memory(instance, + (const unsigned char *)cert_value, + strlen(cert_value), + CERTSVC_FORM_DER_BASE64, + &certificate); + if (r != CERTSVC_SUCCESS) { + _E("certsvc_certificate_new_from_memory() is failed."); + pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); + certsvc_instance_free(instance); + return false; + } + + r = certsvc_certificate_get_visibility(certificate, &visibility); + if (r != CERTSVC_SUCCESS) + _E("certsvc_certificate_get_visibility() is failed."); + + pkgmgrinfo_pkginfo_destroy_certinfo(certinfo); + certsvc_instance_free(instance); + certsvc_certificate_free(certificate); + + _D("visibility is %d", visibility); + if (visibility & CERTSVC_VISIBILITY_PLATFORM) { + _D("%s has a platform certification", pkgid); + return true; + } + + return false; +} + static int __esd_check_event_launch_support(const char *event_name) { int i = 0; @@ -544,13 +626,15 @@ static int __esd_add_list_item(uid_t uid, event_launch_item *el_item, item_of_list->uid = uid; item_of_list->app_id = (char *)app_id; item_of_list->pkg_id = (char *)pkg_id; + item_of_list->trusted_info = TRUSTED_UNKNOWN; el_item->app_list_evtlaunch = g_list_append(el_item->app_list_evtlaunch, item_of_list); return ES_R_OK; } -static int __esd_add_launch_item(uid_t uid, const char *event_name, const char *appid, const char *pkgid) +static int __esd_add_launch_item(uid_t uid, const char *event_name, + const char *appid, const char *pkgid) { GList *app_list = NULL; guint subscription_id = 0; @@ -752,18 +836,39 @@ static void __esd_event_launch_with_appid(gpointer data, gpointer user_data) int pid; char event_uri[1024]; bundle *b; + int ret; + + _D("launch_on_event: app_id(%s), event_name(%s), uid(%d), is_user(%d), trusted(%d)", + app_id, eep->event_name, uid, eep->is_user_event, eep->trusted); - _D("launch_on_event: app_id(%s), event_name(%s), uid(%d)", - app_id, eep->event_name, uid); + if (eep->is_user_event && eep->trusted) { + if (item->trusted_info == TRUSTED_UNKNOWN) { + ret = __esd_check_certificate_match(uid, app_id, eep->sender_uid, eep->sender_appid); + if (ret == ES_R_EINVAL) { + item->trusted_info = TRUSTED_DENIED; + return; + } else if (ret == ES_R_ERROR) { + return; + } else { + item->trusted_info = TRUSTED_ALLOWED; + } + } else if (item->trusted_info == TRUSTED_DENIED) { + return; + } + } if (!aul_app_is_running_for_uid(app_id, uid)) { - snprintf(event_uri, sizeof(event_uri), "event://%s", eep->event_name); b = bundle_dup(eep->event_data); + if (eep->is_user_event) + snprintf(event_uri, sizeof(event_uri), "%s%s", USER_EVENT_NAME_PREFIX, eep->event_name); + else + snprintf(event_uri, sizeof(event_uri), "%s%s", SYSTEM_EVENT_NAME_PREFIX, eep->event_name); + appsvc_set_operation(b, APPSVC_OPERATION_LAUNCH_ON_EVENT); appsvc_set_uri(b, event_uri); appsvc_set_appid(b, app_id); - pid = appsvc_usr_run_service(b, req_id++, NULL, eep->user_data, uid); + pid = aul_svc_run_service_async_for_uid(b, req_id++, NULL, eep->user_data, uid); _D("uid(%d), pid(%d)", uid, pid); bundle_free(b); @@ -783,7 +888,9 @@ static void __esd_check_event_launch_with_eventid(gpointer data, gpointer user_d } } -static void __esd_launch_event_handler(char *event_name, bundle *data, void *user_data) +static void __esd_launch_event_handler(char *event_name, bundle *data, + const bool is_user_event, const bool trusted, + const uid_t sender_uid, char *sender_appid, void *user_data) { const char *val; const char *msg_type; @@ -798,38 +905,40 @@ static void __esd_launch_event_handler(char *event_name, bundle *data, void *use return; if (el_item->app_list_evtlaunch != NULL) { - if (strcmp(SYS_EVENT_BATTERY_CHARGER_STATUS, event_name) == 0) { - val = bundle_get_val(data, EVT_KEY_BATTERY_CHARGER_STATUS); - _D("charger val(%s)", val); - if (val && (strcmp(EVT_VAL_BATTERY_CHARGER_CONNECTED, val) != 0)) - return; - } else if (strcmp(SYS_EVENT_USB_STATUS, event_name) == 0) { - val = bundle_get_val(data, EVT_KEY_USB_STATUS); - _D("usb val(%s)", val); - if (val && (strcmp(EVT_VAL_USB_CONNECTED, val) != 0)) - return; - } else if (strcmp(SYS_EVENT_EARJACK_STATUS, event_name) == 0) { - val = bundle_get_val(data, EVT_KEY_EARJACK_STATUS); - _D("earjack val(%s)", val); - if (val && (strcmp(EVT_VAL_EARJACK_CONNECTED, val) != 0)) - return; - } else if (strcmp(SYS_EVENT_INCOMMING_MSG, event_name) == 0) { - msg_type = bundle_get_val(data, EVT_KEY_MSG_TYPE); - _D("msg_type(%s)", msg_type); - if (msg_type == NULL) - return; - - msg_id = bundle_get_val(data, EVT_KEY_MSG_ID); - _D("msg_id(%s)", msg_id); - if (msg_id == NULL) - return; - } else if (strcmp(SYS_EVENT_WIFI_STATE, event_name) == 0) { - val = bundle_get_val(data, EVT_KEY_WIFI_STATE); - if (val == NULL) - return; - _D("wifi_state(%s)", val); - if (strcmp(EVT_VAL_WIFI_CONNECTED, val) != 0) - return; + if (is_user_event == false) { + if (strcmp(SYS_EVENT_BATTERY_CHARGER_STATUS, event_name) == 0) { + val = bundle_get_val(data, EVT_KEY_BATTERY_CHARGER_STATUS); + _D("charger val(%s)", val); + if (val && (strcmp(EVT_VAL_BATTERY_CHARGER_CONNECTED, val) != 0)) + return; + } else if (strcmp(SYS_EVENT_USB_STATUS, event_name) == 0) { + val = bundle_get_val(data, EVT_KEY_USB_STATUS); + _D("usb val(%s)", val); + if (val && (strcmp(EVT_VAL_USB_CONNECTED, val) != 0)) + return; + } else if (strcmp(SYS_EVENT_EARJACK_STATUS, event_name) == 0) { + val = bundle_get_val(data, EVT_KEY_EARJACK_STATUS); + _D("earjack val(%s)", val); + if (val && (strcmp(EVT_VAL_EARJACK_CONNECTED, val) != 0)) + return; + } else if (strcmp(SYS_EVENT_INCOMMING_MSG, event_name) == 0) { + msg_type = bundle_get_val(data, EVT_KEY_MSG_TYPE); + _D("msg_type(%s)", msg_type); + if (msg_type == NULL) + return; + + msg_id = bundle_get_val(data, EVT_KEY_MSG_ID); + _D("msg_id(%s)", msg_id); + if (msg_id == NULL) + return; + } else if (strcmp(SYS_EVENT_WIFI_STATE, event_name) == 0) { + val = bundle_get_val(data, EVT_KEY_WIFI_STATE); + if (val == NULL) + return; + _D("wifi_state(%s)", val); + if (strcmp(EVT_VAL_WIFI_CONNECTED, val) != 0) + return; + } } eep = calloc(1, sizeof(esd_event_param)); @@ -839,6 +948,10 @@ static void __esd_launch_event_handler(char *event_name, bundle *data, void *use } eep->event_name = event_name; eep->event_data = data; + eep->sender_uid = sender_uid; + eep->sender_appid = sender_appid; + eep->is_user_event = is_user_event; + eep->trusted = trusted; eep->user_data = (void *)user_data; __esd_check_event_launch_with_eventid(el_item, eep); free(eep); @@ -915,7 +1028,8 @@ static void __esd_event_handler(char *event_name, bundle *data, void *user_data) #endif if (__esd_check_event_launch_support(event_name)) - __esd_launch_event_handler(event_name, data, user_data); + __esd_launch_event_handler(event_name, data, + false, true, ROOT_USER, NULL, user_data); } static void __esd_trusted_busname_remove_item(char *bus_name) @@ -1126,6 +1240,13 @@ static const gchar introspection_xml[] = " " " " " " +" " +" " +" " +" " +" " +" " +" " " " ""; @@ -1614,6 +1735,56 @@ out: g_dbus_method_invocation_return_value(invocation, param); } +static void launch_on_event_from_userevent(GDBusConnection *connection, + const gchar *sender, GVariant *parameters, + GDBusMethodInvocation *invocation) +{ + GVariant *param; + int result = ES_R_OK; + int len; + bool trusted; + int sender_pid; + uid_t sender_uid; + char *event_name; + char app_id[128]; + char *buf; + bundle *b; + + g_variant_get(parameters, "(&s&sib)", &event_name, &buf, &len, &trusted); + + if (!event_name) { + result = ES_R_ERROR; + _E("invalid event_name"); + goto out; + } + + sender_pid = __get_sender_pid(connection, sender); + sender_uid = (uid_t)__get_sender_uid(connection, sender); + if (__esd_get_appid_by_pid(sender_pid, sender_uid, app_id, + sizeof(app_id)) < 0) { + _E("failed to get appid by pid"); + result = ES_R_ERROR; + goto out; + } + + b = bundle_decode((bundle_raw *)buf, len); + if (b == NULL) { + _E("Out of memory"); + result = ES_R_ENOMEM; + goto out; + } + + __esd_launch_event_handler(event_name, b, true, trusted, + sender_uid, app_id, NULL); + + bundle_free(b); + +out: + param = g_variant_new("(i)", result); + + g_dbus_method_invocation_return_value(invocation, param); +} + static void handle_method_call(GDBusConnection *connection, const gchar *sender, const gchar *object_path, const gchar *interface_name, const gchar *method_name, @@ -1638,6 +1809,8 @@ static void handle_method_call(GDBusConnection *connection, keep_last_data_method_call(connection, sender, parameters, invocation); } else if (g_strcmp0(method_name, "CheckLastData") == 0) { check_last_data_method_call(connection, sender, parameters, invocation); + } else if (g_strcmp0(method_name, "LaunchOnEventFromUserEvent") == 0) { + launch_on_event_from_userevent(connection, sender, parameters, invocation); } } @@ -1905,7 +2078,6 @@ static int __esd_appcontrol_cb(const char *operation, char *appid = NULL; char *pkgid = NULL; char *event_name = NULL; - const char *prefix = "event://"; uid_t uid = 0; if (cb_data == NULL) { @@ -1920,25 +2092,33 @@ static int __esd_appcontrol_cb(const char *operation, uid, appid, pkgid, operation, uri, mime); if (!strcmp(operation, APPSVC_OPERATION_LAUNCH_ON_EVENT)) { - if (uri && !strncmp(uri, prefix, strlen(prefix))) { + if (uri && !strncmp(uri, SYSTEM_EVENT_NAME_PREFIX, strlen(SYSTEM_EVENT_NAME_PREFIX))) { event_name = strdup(&uri[8]); if (event_name) { _D("appid(%s), event_name(%s)", appid, event_name); - if (!__esd_check_event_launch_support(event_name)) { + if (!__esd_check_event_launch_support(event_name)) _E("failed to add item (not support event)"); - } else if (!__esd_check_app_privileged_event(uid, appid, pkgid, event_name)) { + else if (!__esd_check_app_privileged_event(uid, appid, pkgid, event_name)) _E("failed to add item (no privilege)"); - } else { + else if (__esd_add_launch_item(uid, event_name, appid, pkgid)) + _E("failed to add item"); + + } else { + _E("out of memory"); + } + } else if (uri && !strncmp(uri, USER_EVENT_NAME_PREFIX, strlen(USER_EVENT_NAME_PREFIX))) { + event_name = strdup(uri); + if (event_name) { + _D("appid(%s), event_name(%s)", appid, event_name); + if (__esd_check_platform_cert(pkgid, uid)) { if (__esd_add_launch_item(uid, event_name, appid, pkgid)) _E("failed to add item"); } - FREE_AND_NULL(event_name); } else { _E("out of memory"); } - } else { - _E("Invalid uri(%s) for event_name", uri); } + FREE_AND_NULL(event_name); } return 0; @@ -2041,9 +2221,10 @@ static int __esd_pkgmgr_event_callback(uid_t target_uid, int req_id, return 0; } ret = pkgmgrinfo_appinfo_get_usr_list(handle, - PMINFO_ALL_APP, __esd_add_appinfo_handler, &target_uid, target_uid); + PMINFO_SVC_APP, __esd_add_appinfo_handler, &target_uid, target_uid); if (ret < 0) { _E("failed to get appinfo"); + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); __esd_pkgmgr_event_free(pkg_event); return 0; } -- 2.7.4 From d20d0b9c921d209a8932d56c274f01da78583451 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Fri, 5 Jul 2019 08:53:21 +0900 Subject: [PATCH 05/16] Release version 0.1.14 Changes: - Support launch_on_event with user event Change-Id: Ic05f248a73beb9096a63a42535aa121da1a5f2a8 Signed-off-by: Inkyun Kil --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index 95ed77a..5f1dc55 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.13 +Version: 0.1.14 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From 4316cbfda2f5ec5c8bebc997f6651b42f5017b58 Mon Sep 17 00:00:00 2001 From: Jusung Son Date: Fri, 12 Jul 2019 13:09:55 +0900 Subject: [PATCH 06/16] Add dbus activation feature Change-Id: Ibf4510ed3d0e6ce022979ef69beed82de4ffbf51 Signed-off-by: Jusung Son --- CMakeLists.txt | 2 ++ org.tizen.esd.service.in | 4 ++++ packaging/esd.service | 8 +++++--- packaging/esd.spec | 7 ++++--- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 org.tizen.esd.service.in diff --git a/CMakeLists.txt b/CMakeLists.txt index ef58439..eb6a587 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,8 @@ SET_TARGET_PROPERTIES(esd PROPERTIES LINK_FLAGS "-pie -Wl,-z,relro") # pkgconfig file configure_file(esd.manifest.in esd.manifest @ONLY) +configure_file(org.tizen.esd.service.in org.tizen.esd.service @ONLY) INSTALL(TARGETS esd DESTINATION bin) INSTALL(FILES ${CMAKE_SOURCE_DIR}/eventsystem.conf DESTINATION /etc/dbus-1/system.d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.esd.service DESTINATION ${SHARE_INSTALL_PREFIX}/dbus-1/system-services/) \ No newline at end of file diff --git a/org.tizen.esd.service.in b/org.tizen.esd.service.in new file mode 100644 index 0000000..4315d2c --- /dev/null +++ b/org.tizen.esd.service.in @@ -0,0 +1,4 @@ +[D-BUS Service] +Name=tizen.system.event.app2esd +Exec=/bin/false +SystemdService=esd.service \ No newline at end of file diff --git a/packaging/esd.service b/packaging/esd.service index 37a0556..cc8c69e 100644 --- a/packaging/esd.service +++ b/packaging/esd.service @@ -1,15 +1,17 @@ [Unit] Description=Start the Event System Daemon -Wants=wait-mount@opt-usr.service -After=wait-mount@opt-usr.service +Requires=dbus.socket buxton2.service +After=dbus.socket buxton2.service [Service] User=app_fw Group=app_fw +Type=dbus SmackProcessLabel=System +BusName=tizen.system.event.app2esd ExecStart=/usr/bin/esd Restart=on-failure RestartSec=0 [Install] -WantedBy=default.target +WantedBy=multi-user.target \ No newline at end of file diff --git a/packaging/esd.spec b/packaging/esd.spec index 95ed77a..ef615c0 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -55,9 +55,9 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} %make_install -mkdir -p %{buildroot}%{_unitdir}/graphical.target.wants +mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/esd.service -ln -sf ../esd.service %{buildroot}%{_unitdir}/graphical.target.wants/esd.service +ln -sf ../esd.service %{buildroot}%{_unitdir}/multi-user.target.wants/esd.service %post -p /sbin/ldconfig @@ -69,7 +69,8 @@ ln -sf ../esd.service %{buildroot}%{_unitdir}/graphical.target.wants/esd.service %defattr(-,root,root,-) %{_bindir}/esd %{_unitdir}/esd.service -%{_unitdir}/graphical.target.wants/esd.service +%{_unitdir}/multi-user.target.wants/esd.service +%attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.esd.service %license LICENSE %files devel -- 2.7.4 From 13ae737fe79bd2a313c9fa7a3f63171190b81400 Mon Sep 17 00:00:00 2001 From: Jusung Son Date: Tue, 16 Jul 2019 09:02:42 +0900 Subject: [PATCH 07/16] Release version 0.1.15 Changes: - Add dbus activation feature Change-Id: I4e68ddcdf011c36f63ab102d70fce99da4ee1632 Signed-off-by: Jusung Son --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index 3071edb..e973691 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.14 +Version: 0.1.15 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From d4cc8e19eb130a178104b298751058789c499902 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Thu, 25 Jul 2019 16:32:40 +0900 Subject: [PATCH 08/16] Add dbus policy for 'StartupFinished' signal - Since default policy is deny for sending signal to "tizen.system.event.app2esd", ESD couldn't get a signal for 'StartupFinished'. To get the signal, adds the policy for root user. - And adds check policy to get 'UserSessionStartupFinished'. Change-Id: I124fca229d6725c9cf4affd7b9aaf7d3e77a7816 Signed-off-by: Inkyun Kil --- eventsystem.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eventsystem.conf b/eventsystem.conf index 97d42dd..7db624f 100644 --- a/eventsystem.conf +++ b/eventsystem.conf @@ -16,6 +16,7 @@ + @@ -30,5 +31,6 @@ + -- 2.7.4 From 029ef033ca0c9e6dbfce744849d1aef8eb591862 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Fri, 26 Jul 2019 10:49:30 +0900 Subject: [PATCH 09/16] Release version 0.1.16 Changes: - Add dbus policy for 'StartupFinished' signal Change-Id: I3ed5e740d45880d6d5068af7ac49b50e900f6931 Signed-off-by: Inkyun Kil --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index e973691..3bef4e0 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.15 +Version: 0.1.16 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From 5a794d90b30f17adc40c4d4aa5369c28f1d74bf6 Mon Sep 17 00:00:00 2001 From: INSUN PYO Date: Wed, 7 Aug 2019 12:03:26 +0900 Subject: [PATCH 10/16] Remove duplicate dependency with implicit dependencies at "Type=dbus" Refs: https://www.freedesktop.org/software/systemd/man/systemd.service.html - Services with Type=dbus set automatically acquire dependencies of type Requires= and After= on dbus.socket. Change-Id: Ib799c2f8174afad6706228be4b4e6e385abc249a --- packaging/esd.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/esd.service b/packaging/esd.service index cc8c69e..e59df2e 100644 --- a/packaging/esd.service +++ b/packaging/esd.service @@ -1,7 +1,7 @@ [Unit] Description=Start the Event System Daemon -Requires=dbus.socket buxton2.service -After=dbus.socket buxton2.service +Requires=buxton2.service +After=buxton2.service [Service] User=app_fw -- 2.7.4 From 8568b7c291b0863d59837c4cd0a7de38f25b9829 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Thu, 8 Aug 2019 09:17:38 +0900 Subject: [PATCH 11/16] Fix stack overflow gboolean is different from bool Change-Id: Ia0fd3b8b579bcc5b66ef6b15870134dae0875b79 Signed-off-by: Inkyun Kil --- src/esd_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/esd_main.c b/src/esd_main.c index 4826b08..f5de3ca 100644 --- a/src/esd_main.c +++ b/src/esd_main.c @@ -889,7 +889,7 @@ static void __esd_check_event_launch_with_eventid(gpointer data, gpointer user_d } static void __esd_launch_event_handler(char *event_name, bundle *data, - const bool is_user_event, const bool trusted, + const bool is_user_event, gboolean trusted, const uid_t sender_uid, char *sender_appid, void *user_data) { const char *val; @@ -951,7 +951,7 @@ static void __esd_launch_event_handler(char *event_name, bundle *data, eep->sender_uid = sender_uid; eep->sender_appid = sender_appid; eep->is_user_event = is_user_event; - eep->trusted = trusted; + eep->trusted = (bool)trusted; eep->user_data = (void *)user_data; __esd_check_event_launch_with_eventid(el_item, eep); free(eep); @@ -1029,7 +1029,7 @@ static void __esd_event_handler(char *event_name, bundle *data, void *user_data) if (__esd_check_event_launch_support(event_name)) __esd_launch_event_handler(event_name, data, - false, true, ROOT_USER, NULL, user_data); + false, TRUE, ROOT_USER, NULL, user_data); } static void __esd_trusted_busname_remove_item(char *bus_name) @@ -1742,7 +1742,7 @@ static void launch_on_event_from_userevent(GDBusConnection *connection, GVariant *param; int result = ES_R_OK; int len; - bool trusted; + gboolean trusted; int sender_pid; uid_t sender_uid; char *event_name; -- 2.7.4 From 8f1efaeb2862d6bf511edd38ac8878f0c8685ede Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Thu, 8 Aug 2019 09:49:21 +0900 Subject: [PATCH 12/16] Release version 0.1.17 Changes: - Remove duplicate dependency with implicit dependencies at "Type=dbus" - Fix stack overflow Change-Id: I493562e1df978b95964eac4b3e3afd47596b8e16 Signed-off-by: Inkyun Kil --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index 3bef4e0..7028009 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.16 +Version: 0.1.17 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From 606e3015d0627b213a6de076bd9d5857155b6055 Mon Sep 17 00:00:00 2001 From: Hyotaek Shim Date: Wed, 2 Oct 2019 15:12:04 +0900 Subject: [PATCH 13/16] Fix dbus policy Change-Id: Iba350147e61fb3c224d0650dd415ea327f574d9c Signed-off-by: Hyotaek Shim --- eventsystem.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/eventsystem.conf b/eventsystem.conf index 7db624f..ca20d7f 100644 --- a/eventsystem.conf +++ b/eventsystem.conf @@ -26,6 +26,7 @@ + -- 2.7.4 From 42cea404c9ced8f3d356c25c7f7e07f0cc510b7c Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Wed, 2 Oct 2019 16:15:15 +0900 Subject: [PATCH 14/16] Release version 0.1.18 Changes: - Fix dbus policy Change-Id: I3b592284e239951550e420f6b3f033c40459946e Signed-off-by: Inkyun Kil --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index 7028009..cdb63d7 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.17 +Version: 0.1.18 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4 From 131c61ff7a57cbbd25f1cabbdf52721b63a5a3fd Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Tue, 8 Oct 2019 16:48:11 +0900 Subject: [PATCH 15/16] Fix bug that encoded bundle data is null Change-Id: Ic837ac01eef93a7398a1870653ad336e78793032 Signed-off-by: Inkyun Kil Signed-off-by: Jusung Son --- src/esd_main.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/esd_main.c b/src/esd_main.c index f5de3ca..9484e89 100644 --- a/src/esd_main.c +++ b/src/esd_main.c @@ -1548,7 +1548,7 @@ out: static void get_earlier_data_method_call(GVariant *parameters, GDBusMethodInvocation *invocation) { GVariant *param = NULL; - int result = 0; + int result = ES_R_ERROR; char *event_name = NULL; bundle *b = NULL; bundle_raw *raw = NULL; @@ -1556,25 +1556,23 @@ static void get_earlier_data_method_call(GVariant *parameters, GDBusMethodInvoca earlier_item *item; g_variant_get(parameters, "(&s)", &event_name); - - if (event_name && strlen(event_name) > 0) { - _D("event_name(%s)", event_name); - result = ES_R_OK; - } else { - _E("invalid event_name(%s)", event_name); - result = ES_R_ERROR; - } + _D("event_name(%s)", event_name); item = (earlier_item *)g_hash_table_lookup(earlier_event_table, event_name); if (item != NULL) { if (item->earlier_data) { b = bundle_dup(item->earlier_data); bundle_add_str(b, "is_earlier_data", "true"); - bundle_encode(b, &raw, &len); - bundle_free(b); + result = ES_R_OK; } } + if (result == ES_R_ERROR) + b = bundle_create(); + + bundle_encode(b, &raw, &len); + bundle_free(b); + param = g_variant_new("(iis)", result, len, raw); _D("result(%d), len(%d)", result, len); -- 2.7.4 From 4a1f63a521f1436b9b3d33a4f2bff95d7c065440 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Thu, 17 Oct 2019 16:30:48 +0900 Subject: [PATCH 16/16] Release version 0.1.19 Changes: - Fix bug that encoded bundle data is null Change-Id: I37a05ca8055ee46a599870985ed7dbd645937e85 Signed-off-by: Inkyun Kil --- packaging/esd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/esd.spec b/packaging/esd.spec index cdb63d7..2e0a7b5 100644 --- a/packaging/esd.spec +++ b/packaging/esd.spec @@ -1,6 +1,6 @@ Name: esd Summary: Event system daemon -Version: 0.1.18 +Version: 0.1.19 Release: 1 Group: Application Framework/Service License: Apache-2.0 -- 2.7.4