4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
27 #include <notification.h>
28 #include <notification_db.h>
29 #include <notification_noti.h>
30 #include <notification_debug.h>
31 #include <notification_ipc.h>
32 #include <notification_private.h>
34 #define NOTIFICATION_DB_ACCESS_READ 0
35 #define NOTIFICATION_DB_ACCESS_WRITE 1
38 int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access)
41 char pkgname[512 + 1] = { 0, };
43 package_manager_compare_result_type_e compare_result;
45 /* get pkgname by pid */
46 const char *pkgname = aul_app_get_pkgname_bypid(pid);
47 ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
48 if (ret == AUL_R_OK) {
49 if (strcmp(pkgname, noti_pkgname) == 0)
50 return NOTIFICATION_ERROR_NONE;
52 package_manager_is_preload_package_by_app_id(pkgname, &preload);
54 return NOTIFICATION_ERROR_NONE;
56 package_manager_compare_package_cert_info(noti_pkgname, &compare_result);
57 if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH)
58 return NOTIFICATION_ERROR_NONE;
61 return NOTIFICATION_ERROR_PERMISSION_DENIED;