From 3139d821e220f522e8346118432f148b28420697 Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Fri, 6 Apr 2018 11:45:46 +0900 Subject: [PATCH 01/16] Code change for missing DND_SCHEDULE_WEEK_FLAG_MAX Change-Id: I5b6fe8b7d31f6ca3a829da068612e7e691ffbae2 Signed-off-by: mk5004.lee --- src/notification_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notification_service.c b/src/notification_service.c index 9e49034..f11266c 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -1837,7 +1837,7 @@ static int _add_alarm(int dnd_schedule_day, int dnd_start_hour, int dnd_start_mi if (dnd_end_hour < dnd_start_hour || (dnd_end_hour == dnd_start_hour && dnd_end_min <= dnd_start_min)) { dnd_schedule_day = (dnd_schedule_day << 1); - if (dnd_schedule_day & DND_SCHEDULE_WEEK_FLAG_MAX) + if (dnd_schedule_day & (DND_SCHEDULE_WEEK_FLAG_SATURDAY << 1)) dnd_schedule_day = (dnd_schedule_day & DND_SCHEDULE_WEEK_FLAG_ALL) | DND_SCHEDULE_WEEK_FLAG_SUNDAY; } -- 2.7.4 From c15aa6c2cb293ccd397b69a1679f87e319e7b7db Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Wed, 11 Apr 2018 14:58:51 +0900 Subject: [PATCH 02/16] Fix to check return value of notification_get_id priv_id can be used for private sharing related code also. Change-Id: I279562d047b2efef30e067d251bcbc34d8925a37 Signed-off-by: Semun Lee --- src/notification_service.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/notification_service.c b/src/notification_service.c index f11266c..3501f18 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -735,11 +735,16 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid) __print_noti(noti); + ret = notification_get_id(noti, NULL, &priv_id); + if (ret != NOTIFICATION_ERROR_NONE) { + ERR("Failed to get priv_id [%d]", ret); + return ret; + } + if (notification_validate_private_sharing(noti) == false) { source_noti = notification_create(NOTIFICATION_TYPE_NOTI); if (source_noti == NULL) return get_last_result(); - notification_get_id(noti, NULL, &priv_id); notification_noti_get_by_priv_id(source_noti, priv_id); notification_calibrate_private_sharing(noti, source_noti); @@ -752,12 +757,6 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid) return ret; } - ret = notification_get_id(noti, NULL, &priv_id); - if (ret != NOTIFICATION_ERROR_NONE) { - ERR("Failed to gets priv_id [%d]", ret); - return ret; - } - notification_set_private_sharing(noti, uid); body = notification_ipc_make_gvariant_from_noti(noti, true); -- 2.7.4 From a64cc9be43757bebe3bc1443daacff394ba2c90b Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Wed, 11 Apr 2018 17:26:26 +0900 Subject: [PATCH 03/16] Release version 1.5.7 - Fix to check return value of notification_get_id Code change for missing DND_SCHEDULE_WEEK_FLAG_MAX Change-Id: If477bfbc8e42c138e2da7db35583807ccdecfe06 Signed-off-by: mk5004.lee --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index e0bacb8..1342d26 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.5.6 +Version: 1.5.7 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 619863aeb89a37a05b14d8630ed1192257323f80 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 13 Apr 2018 11:12:51 +0900 Subject: [PATCH 04/16] Set indirect request info While creating bundle data, the alarm-manager sets "indirect-request" info for the amd. And then, the amd checks whether the caller has privilege or NOT when getting the request from the data-provider-master. Requires: - https://review.tizen.org/gerrit/#/c/175262/ - https://review.tizen.org/gerrit/#/c/175212/ - https://review.tizen.org/gerrit/#/c/175419/ - https://review.tizen.org/gerrit/#/c/175210/ Change-Id: Ie0ef7b2371183ea41746896fcc979c7ec1fe336f Signed-off-by: Hwankyu Jhun --- include/notification_service.h | 6 ++++-- src/notification_service.c | 16 ++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/notification_service.h b/include/notification_service.h index 312fc48..4d3fffd 100755 --- a/include/notification_service.h +++ b/include/notification_service.h @@ -19,8 +19,10 @@ extern int notification_service_init(void); extern int notification_service_fini(void); -int notification_add_noti(GVariant *parameters, GVariant **reply_body, const char *sender, uid_t uid); -int notification_update_noti(GVariant *parameters, GVariant **reply_body, uid_t uid); +int notification_add_noti(GVariant *parameters, GVariant **reply_body, + const char *sender, pid_t pid, uid_t uid); +int notification_update_noti(GVariant *parameters, GVariant **reply_body, + pid_t pid, uid_t uid); int notification_refresh_noti(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_del_noti_single(GVariant *parameters, GVariant **reply_body, uid_t uid); int notification_del_noti_multiple(GVariant *parameters, GVariant **reply_body, uid_t uid); diff --git a/src/notification_service.c b/src/notification_service.c index 3501f18..980d9c0 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -141,9 +141,9 @@ static void _noti_dbus_method_call_handler(GDBusConnection *conn, if (ret == NOTIFICATION_ERROR_NONE) notification_add_private_sharing_target_id(pid, sender, uid); } else if (g_strcmp0(method_name, "update_noti") == 0) { - ret = notification_update_noti(parameters, &reply_body, uid); + ret = notification_update_noti(parameters, &reply_body, pid, uid); } else if (g_strcmp0(method_name, "add_noti") == 0) { - ret = notification_add_noti(parameters, &reply_body, sender, uid); + ret = notification_add_noti(parameters, &reply_body, sender, pid, uid); } else if (g_strcmp0(method_name, "refresh_noti") == 0) { ret = notification_refresh_noti(parameters, &reply_body, uid); } else if (g_strcmp0(method_name, "del_noti_single") == 0) { @@ -676,7 +676,8 @@ static void __add_sender_info(int priv_id, const char *busname) } } -int notification_add_noti(GVariant *parameters, GVariant **reply_body, const char *sender, uid_t uid) +int notification_add_noti(GVariant *parameters, GVariant **reply_body, + const char *sender, pid_t pid, uid_t uid) { int ret; int priv_id; @@ -691,6 +692,9 @@ int notification_add_noti(GVariant *parameters, GVariant **reply_body, const cha ret = notification_ipc_make_noti_from_gvariant(noti, body); g_variant_unref(body); + if (uid >= NORMAL_UID_BASE) + notification_set_indirect_request(noti, pid, uid); + ret = _validate_and_set_noti_with_uid(uid, noti, ¬i_uid); if (ret != NOTIFICATION_ERROR_NONE) goto out; @@ -792,7 +796,8 @@ static int _update_noti(GVariant **reply_body, notification_h noti, uid_t uid) return ret; } -int notification_update_noti(GVariant *parameters, GVariant **reply_body, uid_t uid) +int notification_update_noti(GVariant *parameters, GVariant **reply_body, + pid_t pid, uid_t uid) { notification_h noti; int ret; @@ -805,6 +810,9 @@ int notification_update_noti(GVariant *parameters, GVariant **reply_body, uid_t ret = notification_ipc_make_noti_from_gvariant(noti, body); g_variant_unref(body); + if (uid >= NORMAL_UID_BASE) + notification_set_indirect_request(noti, pid, uid); + ret = _validate_and_set_noti_with_uid(uid, noti, ¬i_uid); if (ret != NOTIFICATION_ERROR_NONE) goto out; -- 2.7.4 From 09cf809694df3bf879187385ccdd346d578154bc Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 16 Apr 2018 13:41:23 +0900 Subject: [PATCH 05/16] Release version 1.5.8 Changes: - Set indirect request info Change-Id: I94afc1e8566bb9b95ff475d0cb492ea8a016f177 Signed-off-by: Hwankyu Jhun --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 1342d26..6f47f5a 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.5.7 +Version: 1.5.8 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 05a62f048831903e3acafa2b84eeb5c66e6b5813 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Tue, 17 Apr 2018 19:33:32 +0900 Subject: [PATCH 06/16] Change rules for default dbus policy Change-Id: I9f0c13c5c41939923dc75a144368d4646214c3f8 Signed-off-by: Inkyun Kil --- data-provider-master.conf.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data-provider-master.conf.in b/data-provider-master.conf.in index 38cd0e9..68c539c 100644 --- a/data-provider-master.conf.in +++ b/data-provider-master.conf.in @@ -7,7 +7,8 @@ - + + -- 2.7.4 From 403157094e87b75e91dd5f3b7ce206bd0319c2a2 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Thu, 10 May 2018 17:01:33 +0900 Subject: [PATCH 07/16] Release version 1.5.9 Changes: - Change rules for default dbus policy Change-Id: I396b42fe7b393bfc949efe76716ae6d283503d23 Signed-off-by: Inkyun Kil --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 6f47f5a..f08df3d 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.5.8 +Version: 1.5.9 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From e16a7c2ba3b323b2c9f54c9cbd54ac476ab63431 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Fri, 11 May 2018 08:56:40 +0900 Subject: [PATCH 08/16] Change dbus policy rule Change-Id: I88f31235085aaff66fb150542ed161a9b94916e8 Signed-off-by: Inkyun Kil --- data-provider-master.conf.in | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/data-provider-master.conf.in b/data-provider-master.conf.in index 68c539c..8965c9c 100644 --- a/data-provider-master.conf.in +++ b/data-provider-master.conf.in @@ -8,16 +8,7 @@ - - - - - - - - - - + -- 2.7.4 From 09e585d70fb30d066d5f95e0e8beb2b6948a8c03 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Wed, 16 May 2018 16:42:28 +0900 Subject: [PATCH 09/16] Add rule for dbus policy Change-Id: Ic743c911e69c31c91b79b0a7b642a07dbd082c26 Signed-off-by: Inkyun Kil --- data-provider-master.conf.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data-provider-master.conf.in b/data-provider-master.conf.in index 8965c9c..ea74486 100644 --- a/data-provider-master.conf.in +++ b/data-provider-master.conf.in @@ -8,6 +8,8 @@ + + -- 2.7.4 From 71effd43f1fea12185980cd10f1aeb28d538ca49 Mon Sep 17 00:00:00 2001 From: jusung son Date: Mon, 25 Jun 2018 20:11:36 +0900 Subject: [PATCH 10/16] Improve package signal handling performance Change-Id: If3bae8e5e2f1e4ed8780da92e734f534b8844251 Signed-off-by: jusung son (cherry picked from commit e24860bfd9d9896845cf9dc88aaf9d73c58bf490) --- src/service_common.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 8 deletions(-) diff --git a/src/service_common.c b/src/service_common.c index 30547bb..ed93768 100755 --- a/src/service_common.c +++ b/src/service_common.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "debug.h" #include "pkgmgr.h" @@ -43,6 +44,8 @@ #define PROVIDER_OBJECT_PATH "/org/tizen/data_provider_service" static GDBusConnection *_gdbus_conn = NULL; +static GHashTable *_noti_pkg_privilege_info; +static GHashTable *_badge_pkg_privilege_info; uid_t get_sender_uid(const char *sender_name) { @@ -421,11 +424,42 @@ out: static int _package_install_cb(uid_t uid, const char *pkgname, enum pkgmgr_status status, double value, void *data) { - if (status == PKGMGR_STATUS_END) { - if (uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)) - uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER); - notification_setting_insert_package_for_uid(pkgname, uid); - badge_setting_insert_package_for_uid(pkgname, uid); + int ret; + gpointer tmp; + int privilege_info; + + if (status != PKGMGR_STATUS_END) + return 0; + + if (uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)) + uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER); + + if (g_hash_table_contains(_noti_pkg_privilege_info, pkgname)) { + tmp = g_hash_table_lookup(_noti_pkg_privilege_info, pkgname); + privilege_info = GPOINTER_TO_UINT(tmp); + if (privilege_info == 1) + notification_setting_db_update_pkg_disabled(pkgname, false, uid); + + g_hash_table_remove(_noti_pkg_privilege_info, pkgname); + } else { + /* In consideration of the reboot status, change the disable information. */ + ret = notification_setting_db_update_pkg_disabled(pkgname, false, uid); + if (ret != NOTIFICATION_ERROR_NONE) + notification_setting_insert_package_for_uid(pkgname, uid); + } + + if (g_hash_table_contains(_badge_pkg_privilege_info, pkgname)) { + tmp = g_hash_table_lookup(_badge_pkg_privilege_info, pkgname); + privilege_info = GPOINTER_TO_UINT(tmp); + if (privilege_info == 1) + badge_db_update_pkg_disabled(pkgname, false, uid); + + g_hash_table_remove(_badge_pkg_privilege_info, pkgname); + } else { + /* In consideration of the reboot status, change the disable information. */ + ret = badge_db_update_pkg_disabled(pkgname, false, uid); + if (ret != BADGE_ERROR_NONE) + badge_setting_insert_package_for_uid(pkgname, uid); } return 0; @@ -433,9 +467,36 @@ static int _package_install_cb(uid_t uid, const char *pkgname, enum pkgmgr_statu static int _package_uninstall_cb(uid_t uid, const char *pkgname, enum pkgmgr_status status, double value, void *data) { - if (status == PKGMGR_STATUS_END) { - if (uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)) - uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER); + int ret; + pkgmgrinfo_pkginfo_h pkginfo; + + if (status != PKGMGR_STATUS_END) + return 0; + + if (uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)) + uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER); + + ret = pkgmgrinfo_pkginfo_get_usr_disabled_pkginfo(pkgname, uid, &pkginfo); + if (ret == PMINFO_R_OK) { + pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo); + + if (_noti_pkg_privilege_info == NULL) { + _noti_pkg_privilege_info = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); + _badge_pkg_privilege_info = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); + } + + ret = notification_setting_db_update_pkg_disabled(pkgname, true, uid); + if (ret == NOTIFICATION_ERROR_NONE) + g_hash_table_insert(_noti_pkg_privilege_info, strdup(pkgname), GUINT_TO_POINTER(1)); + else + g_hash_table_insert(_noti_pkg_privilege_info, strdup(pkgname), GUINT_TO_POINTER(0)); + + ret = badge_db_update_pkg_disabled(pkgname, true, uid); + if (ret == BADGE_ERROR_NONE) + g_hash_table_insert(_badge_pkg_privilege_info, strdup(pkgname), GUINT_TO_POINTER(1)); + else + g_hash_table_insert(_badge_pkg_privilege_info, strdup(pkgname), GUINT_TO_POINTER(0)); + } else { notification_setting_delete_package_for_uid(pkgname, uid); badge_db_delete_by_pkgname(pkgname, uid); badge_setting_delete_package_for_uid(pkgname, uid); -- 2.7.4 From ce27d56c85a4c9b03b707e2849a39b24ee5f2115 Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Thu, 12 Jul 2018 14:22:44 +0900 Subject: [PATCH 11/16] Add num to parameter when deleting multiple noties Change-Id: Ic13c65fbdb8edc8d5370c5a264f57c84ced039a9 Signed-off-by: mk5004.lee --- src/notification_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notification_service.c b/src/notification_service.c index 980d9c0..52cac7a 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -1499,7 +1499,7 @@ int notification_del_noti_multiple(GVariant *parameters, GVariant **reply_body, for (i = 0; i < num_deleted; i++) g_variant_builder_add(builder, "(i)", *(list_deleted + i)); - deleted_noti_list = g_variant_new("(a(i)i)", builder, param_uid); + deleted_noti_list = g_variant_new("(a(i)ii)", builder, num_deleted, param_uid); ret = send_notify(deleted_noti_list, "delete_multiple_notify", &_monitoring_hash, PROVIDER_NOTI_INTERFACE_NAME, param_uid); g_variant_builder_unref(builder); g_variant_unref(deleted_noti_list); -- 2.7.4 From 1def604b7a960cc58c3cba18fc66dfcc4e822ef2 Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Wed, 18 Jul 2018 13:47:37 +0900 Subject: [PATCH 12/16] Add missed parameter - Add num to parameter when deleting multiple noties Change-Id: I126ff846beddbfc9f4a3e7e0e2df565f1b53e1b1 Signed-off-by: mk5004.lee --- src/notification_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notification_service.c b/src/notification_service.c index 52cac7a..8c94a70 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -2453,7 +2453,7 @@ HAPI int notification_delete_noti_by_app_id(const char *app_id, uid_t uid) for (i = 0; i < num_deleted; i++) g_variant_builder_add(builder, "(i)", *(list_deleted + i)); - deleted_noti_list = g_variant_new("(a(i)i)", builder, uid); + deleted_noti_list = g_variant_new("(a(i)ii)", builder, num_deleted, uid); ret = send_notify(deleted_noti_list, "delete_multiple_notify", &_monitoring_hash, PROVIDER_NOTI_INTERFACE_NAME, uid); g_variant_builder_unref(builder); g_variant_unref(deleted_noti_list); -- 2.7.4 From 7e33b379694565de1c71d5e6f368a6729a86f157 Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Wed, 18 Jul 2018 17:23:15 +0900 Subject: [PATCH 13/16] Release version 1.5.10 - Add missed parameter Add num to parameter when deleting multiple noties Improve package signal handling performance Add rule for dbus policy Change dbus policy rule Change-Id: I0fbee12c46dfb079f169cf0d6f1b8f06582d91c8 Signed-off-by: mk5004.lee --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index f08df3d..8845a37 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.5.9 +Version: 1.5.10 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 992adebe3520524d7d5a4b83731bafa9e9d9519a Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Fri, 14 Sep 2018 15:02:56 +0900 Subject: [PATCH 14/16] Check coding style Change-Id: I115cd22330f16f6aed07a1a12d4abafb36a0d039 Signed-off-by: mk5004.lee --- src/badge_service.c | 70 ++++++++++++++++++++++------------------------ src/notification_service.c | 5 ++-- src/pkgmgr.c | 1 + src/service_common.c | 7 ++--- src/shortcut_service.c | 8 ++++-- 5 files changed, 45 insertions(+), 46 deletions(-) diff --git a/src/badge_service.c b/src/badge_service.c index 4f35522..3941d07 100755 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -30,7 +30,7 @@ #include "debug.h" #define PROVIDER_BADGE_INTERFACE_NAME "org.tizen.data_provider_badge_service" -static GHashTable *_monitoring_hash = NULL; +static GHashTable *_monitoring_hash; static void _on_name_appeared(GDBusConnection *connection, const gchar *name, @@ -46,6 +46,7 @@ static void _on_name_vanished(GDBusConnection *connection, { DBG("name [%s]", name); monitoring_info_s *info = (monitoring_info_s *)user_data; + if (info) { DBG("vanished uid [%d]", info->uid); g_bus_unwatch_name(info->watcher_id); @@ -117,7 +118,7 @@ static const GDBusInterfaceVTable _badge_interface_vtable = { NULL }; -int badge_register_dbus_interface() +int badge_register_dbus_interface(void) { static gchar introspection_xml[] = " " @@ -216,7 +217,9 @@ static int _validate_and_set_param_uid_with_uid(uid_t uid, uid_t *param_uid) static void _release_badge_info(gpointer data) { - badge_info_s *badge = (badge_info_s *)data; + badge_info_s *badge; + + badge = (badge_info_s *)data; if (badge == NULL) return; if (badge->pkg) @@ -234,21 +237,19 @@ int badge_get_badge_existing(GVariant *parameters, GVariant **reply_body, uid_t g_variant_get(parameters, "(&si)", &pkgname, ¶m_uid); + if (pkgname == NULL) + return BADGE_ERROR_INVALID_PARAMETER; + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL) - ret = badge_db_is_existing(pkgname, &existing, param_uid); - else - return BADGE_ERROR_INVALID_PARAMETER; - + ret = badge_db_is_existing(pkgname, &existing, param_uid); if (ret != BADGE_ERROR_NONE) { ERR("Failed to get badge existing :%d", ret); return ret; - } else { - INFO("The badge of [%s] exists", pkgname); } + INFO("The badge of [%s] exists", pkgname); *reply_body = g_variant_new("(i)", existing); if (*reply_body == NULL) { @@ -375,15 +376,14 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid, pid_t p g_variant_get(parameters, "(&s&si)", &pkgname, &caller, ¶m_uid); + if (pkgname == NULL || caller == NULL) + return BADGE_ERROR_INVALID_PARAMETER; + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL && caller != NULL) - ret = badge_db_delete(pkgname, caller, param_uid, pid); - else - return BADGE_ERROR_INVALID_PARAMETER; - + ret = badge_db_delete(pkgname, caller, param_uid, pid); if (ret != BADGE_ERROR_NONE) { ERR("Failed to delete badge [%d]", ret); return ret; @@ -427,15 +427,14 @@ int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid g_variant_get(parameters, "(&s&sii)", &pkgname, &caller, &count, ¶m_uid); + if (pkgname == NULL || caller == NULL) + return BADGE_ERROR_INVALID_PARAMETER; + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL && caller != NULL) - ret = badge_db_set_count(pkgname, caller, count, param_uid, pid); - else - return BADGE_ERROR_INVALID_PARAMETER; - + ret = badge_db_set_count(pkgname, caller, count, param_uid, pid); if (ret != BADGE_ERROR_NONE) { ERR("Failed to set badge [%d]", ret); return ret; @@ -484,15 +483,14 @@ int badge_get_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid g_variant_get(parameters, "(&si)", &pkgname, ¶m_uid); + if (pkgname == NULL) + return BADGE_ERROR_INVALID_PARAMETER; + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL) - ret = badge_db_get_count(pkgname, &count, param_uid); - else - return BADGE_ERROR_INVALID_PARAMETER; - + ret = badge_db_get_count(pkgname, &count, param_uid); if (ret != BADGE_ERROR_NONE) { ERR("Failed to get badge count [%d]", ret); return ret; @@ -521,15 +519,14 @@ int badge_set_display_option(GVariant *parameters, GVariant **reply_body, uid_t g_variant_get(parameters, "(&s&sii)", &pkgname, &caller, &is_display, ¶m_uid); + if (pkgname == NULL || caller == NULL) + return BADGE_ERROR_INVALID_PARAMETER; + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL && caller != NULL) - ret = badge_db_set_display_option(pkgname, is_display, param_uid); - else - return BADGE_ERROR_INVALID_PARAMETER; - + ret = badge_db_set_display_option(pkgname, is_display, param_uid); if (ret != BADGE_ERROR_NONE) { ERR("Failed to set display option [%d]", ret); return ret; @@ -590,17 +587,14 @@ int badge_get_display_option(GVariant *parameters, GVariant **reply_body, const g_variant_get(parameters, "(&si)", &pkgname, ¶m_uid); + if (pkgname == NULL) + return BADGE_ERROR_INVALID_PARAMETER; + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; - if (pkgname != NULL) { - ret = badge_db_get_display_option(pkgname, &is_display, param_uid); - } else { - ERR("Invalid pkgname"); - return BADGE_ERROR_INVALID_PARAMETER; - } - + ret = badge_db_get_display_option(pkgname, &is_display, param_uid); if (ret != BADGE_ERROR_NONE) { ERR("Failed to get display option [%d]", ret); return ret; @@ -709,6 +703,7 @@ int badge_get_setting_by_appid(GVariant *parameters, GVariant **reply_body, uid_ uid_t param_uid; g_variant_get(parameters, "(&si)", &appid, ¶m_uid); + if (appid == NULL) return BADGE_ERROR_INVALID_PARAMETER; @@ -751,6 +746,7 @@ int badge_init_display(GVariant *parameters, GVariant **reply_body, uid_t uid) uid_t param_uid; g_variant_get(parameters, "(i)", ¶m_uid); + ret = _validate_and_set_param_uid_with_uid(uid, ¶m_uid); if (ret != BADGE_ERROR_NONE) return ret; diff --git a/src/notification_service.c b/src/notification_service.c index 8c94a70..22d3ae7 100755 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -59,7 +59,7 @@ typedef struct _dnd_alarm_id { alarm_id_t dnd_end_id; } dnd_alarm_id_s; -static GList *__event_list = NULL; +static GList *__event_list; typedef struct _event_sender_info { int priv_id; @@ -218,7 +218,7 @@ static const GDBusInterfaceVTable _noti_interface_vtable = { NULL }; -int notification_register_dbus_interface() +int notification_register_dbus_interface(void) { static gchar introspection_xml[] = " " @@ -612,6 +612,7 @@ static void __sender_name_vanished_cb(GDBusConnection *connection, static guint __insert_sender_watcher_id(event_sender_info_s *sender_info) { guint watcher_id = 0; + watcher_id = g_bus_watch_name(G_BUS_TYPE_SYSTEM, sender_info->busname, G_BUS_NAME_WATCHER_FLAGS_NONE, diff --git a/src/pkgmgr.c b/src/pkgmgr.c index 56c3c1c..af1512a 100755 --- a/src/pkgmgr.c +++ b/src/pkgmgr.c @@ -445,6 +445,7 @@ HAPI int pkgmgr_init(void) HAPI int pkgmgr_fini(void) { int i; + if (!s_info.listen_pc) return SERVICE_COMMON_ERROR_INVALID_PARAMETER; diff --git a/src/service_common.c b/src/service_common.c index ed93768..9c07f1e 100755 --- a/src/service_common.c +++ b/src/service_common.c @@ -43,7 +43,7 @@ #define PROVIDER_BUS_NAME "org.tizen.data_provider_service" #define PROVIDER_OBJECT_PATH "/org/tizen/data_provider_service" -static GDBusConnection *_gdbus_conn = NULL; +static GDBusConnection *_gdbus_conn; static GHashTable *_noti_pkg_privilege_info; static GHashTable *_badge_pkg_privilege_info; @@ -287,9 +287,8 @@ int service_register(GVariant *parameters, GVariant **reply_body, const gchar *s free(m_info->bus_name); free(m_info); return SERVICE_COMMON_ERROR_IO_ERROR; - } else { - DBG("Watch on [%s] success", bus_name); } + DBG("Watch on [%s] success", bus_name); monitoring_list = g_list_append(monitoring_list, strdup(bus_name)); DBG("Success, sender[%s] length[%d]", @@ -452,7 +451,7 @@ static int _package_install_cb(uid_t uid, const char *pkgname, enum pkgmgr_statu tmp = g_hash_table_lookup(_badge_pkg_privilege_info, pkgname); privilege_info = GPOINTER_TO_UINT(tmp); if (privilege_info == 1) - badge_db_update_pkg_disabled(pkgname, false, uid); + badge_db_update_pkg_disabled(pkgname, false, uid); g_hash_table_remove(_badge_pkg_privilege_info, pkgname); } else { diff --git a/src/shortcut_service.c b/src/shortcut_service.c index 92b6f02..d542045 100755 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -22,10 +22,9 @@ #include "debug.h" #define PROVIDER_SHORTCUT_INTERFACE_NAME "org.tizen.data_provider_shortcut_service" - #define SHORTCUT_INVOCATION_KEY_POS 0 -static GHashTable *_monitoring_hash = NULL; +static GHashTable *_monitoring_hash; static GHashTable *_invocation_hash; static void _on_name_appeared(GDBusConnection *connection, @@ -42,6 +41,7 @@ static void _on_name_vanished(GDBusConnection *connection, { DBG("name [%s]", name); monitoring_info_s *info = (monitoring_info_s *)user_data; + if (info) { DBG("vanished uid [%d]", info->uid); g_bus_unwatch_name(info->watcher_id); @@ -106,7 +106,7 @@ static const GDBusInterfaceVTable _shortcut_interface_vtable = { NULL }; -int shortcut_register_dbus_interface() +int shortcut_register_dbus_interface(void) { static gchar introspection_xml[] = " " @@ -173,6 +173,7 @@ static void _release_shortcut_info(gpointer data) return; shortcut_info_s *shortcut = (shortcut_info_s *)data; + if (shortcut->package_name) free(shortcut->package_name); if (shortcut->icon) @@ -359,6 +360,7 @@ int shortcut_send_return_value(GVariant *parameters, GVariant **reply_body) HAPI int shortcut_service_init(void) { int result; + _monitoring_hash = g_hash_table_new(g_direct_hash, g_direct_equal); _invocation_hash = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL); -- 2.7.4 From 0555d24425d836e713be65f1061c7d9603ee25f6 Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Thu, 27 Sep 2018 14:25:20 +0900 Subject: [PATCH 15/16] Release version 1.5.11 - Check coding style Change-Id: I69ea50ce535808212f008379cb244a79163b85cc Signed-off-by: mk5004.lee --- packaging/data-provider-master.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 8845a37..138e042 100755 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for badge, shortcut, notification -Version: 1.5.10 +Version: 1.5.11 Release: 1 Group: Applications/Core Applications License: Apache-2.0 -- 2.7.4 From 42f67cc141514c990f6bb503f69b06f54934936a Mon Sep 17 00:00:00 2001 From: "mk5004.lee" Date: Tue, 23 Oct 2018 18:22:16 +0900 Subject: [PATCH 16/16] Update dbus policy Change-Id: I9bacee7affe44933d20b3f5025e8492339a70690 Signed-off-by: mk5004.lee --- data-provider-master.conf.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data-provider-master.conf.in b/data-provider-master.conf.in index ea74486..1433d76 100644 --- a/data-provider-master.conf.in +++ b/data-provider-master.conf.in @@ -5,11 +5,19 @@ + + + + + + + + -- 2.7.4