summaryrefslogtreecommitdiff
path: root/src/notification_permission.c
blob: 5a0709d57ef3bcd53b10416a35c1f278376a70e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *  libnotification
 *
 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <db-util.h>

#include <notification.h>
#include <notification_db.h>
#include <notification_noti.h>
#include <notification_debug.h>
#include <notification_ipc.h>
#include <notification_private.h>

#define NOTIFICATION_DB_ACCESS_READ 0
#define NOTIFICATION_DB_ACCESS_WRITE 1

#if 0
int notification_permission_check_by_pid(const char *noti_pkgname, int pid, int access)
{
	int ret = 0;
	char pkgname[512 + 1] = { 0, };
	bool preload = false;
	package_manager_compare_result_type_e compare_result;

	/* get pkgname by pid */
	const char *pkgname = aul_app_get_pkgname_bypid(pid);
	ret = aul_app_get_pkgname_bypid(pid, pkgname, sizeof(pkgname));
	if (ret == AUL_R_OK) {
		if (strcmp(pkgname, noti_pkgname) == 0)
			return NOTIFICATION_ERROR_NONE;

		package_manager_is_preload_package_by_app_id(pkgname, &preload);
		if (preload == true)
			return NOTIFICATION_ERROR_NONE;

		package_manager_compare_package_cert_info(noti_pkgname, &compare_result);
		if (compare_result == PACKAGE_MANAGER_COMPARE_MATCH)
			return NOTIFICATION_ERROR_NONE;
	}

	return NOTIFICATION_ERROR_PERMISSION_DENIED;
}
#endif