- open appsvd db correctly in readonly/readwrite case.
- add caller appid to bundle in start app.
Change-Id: Ic2026eceb291736b0bb4c3601de2743805b7cfc1
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
const char *hwacc;
const char *permission;
const char *preload;
- char caller_appid[256];
+ char *caller_appid;
pkgmgrinfo_cert_compare_result_type_e compare_result;
int delay_reply = 0;
int pad_pid = LAUNCHPAD_PID;
if (cmd == APP_START_RES)
bundle_add(kb, AUL_K_WAIT_RESULT, "1");
- /* FIXME: get caller appid by process label */
-#if 0
- ret = aul_app_get_appid_bypid(caller_pid, caller_appid, sizeof(caller_appid));
- if(ret == 0) {
+ caller_appid = _status_app_get_appid_bypid(caller_pid);
+ if (caller_appid != NULL) {
bundle_add(kb, AUL_K_CALLER_APPID, caller_appid);
+ } else {
+ caller_appid = _status_app_get_appid_bypid(getpgid(caller_pid));
+ if (caller_appid != NULL) {
+ bundle_add(kb, AUL_K_CALLER_APPID, caller_appid);
+ }
}
-#endif
ai = appinfo_find(caller_uid, appid);
if (ai == NULL) {
#define __AUL_SVC_DB_H__
#include <sqlite3.h>
+#include <stdbool.h>
#include <time.h>
#include <sys/types.h>
#include <glib.h>
{
#endif
-int _svc_db_check_perm(uid_t uid);
+int _svc_db_check_perm(uid_t uid, bool readonly);
int _svc_db_add_app(const char *op, const char *mime_type, const char *uri, const char *pkg_name, uid_t uid);
int _svc_db_delete_with_pkgname(const char *pkg_name, uid_t uid);
char* _svc_db_get_app(const char *op, const char *mime_type, const char *uri, uid_t uid);
SECURE_LOGD("op - %s / mime - %s / scheme - %s\n", info.op, info.origin_mime,
info.scheme);
- ret = _svc_db_check_perm(uid);
+ ret = _svc_db_check_perm(uid, true);
if (ret < 0) {
_E("permission error : %d", ret);
ret = AUL_SVC_RET_EILLACC;
GSList *iter = NULL;
- ret = _svc_db_check_perm(uid);
+ ret = _svc_db_check_perm(uid, true);
if (ret < 0) {
_E("permission error : %d", ret);
return AUL_SVC_RET_EILLACC;
if (op == NULL || defapp == NULL)
return AUL_SVC_RET_EINVAL;
- ret = _svc_db_check_perm(uid);
+ ret = _svc_db_check_perm(uid, false);
if (ret < 0) {
_E("permission error : %d", ret);
return AUL_SVC_RET_EILLACC;
if (defapp == NULL)
return AUL_SVC_RET_EINVAL;
- ret = _svc_db_check_perm(uid);
+ ret = _svc_db_check_perm(uid, false);
if (ret < 0) {
_E("permission error : %d", ret);
return AUL_SVC_RET_EILLACC;
{
int ret;
- ret = _svc_db_check_perm(uid);
+ ret = _svc_db_check_perm(uid, false);
if (ret < 0) {
_E("permission error : %d", ret);
return AUL_SVC_RET_EILLACC;
{
int ret;
- ret = _svc_db_check_perm(uid);
+ ret = _svc_db_check_perm(uid, true);
if (ret < 0) {
_E("permission error : %d", ret);
return AUL_SVC_RET_EILLACC;
* db initialize
*/
-static int __init(uid_t uid)
+static int __init(uid_t uid, bool readonly)
{
int rc;
return 0;
}
- rc = sqlite3_open(__get_svc_db(uid), &svc_db);
+ rc = sqlite3_open_v2(__get_svc_db(uid), &svc_db,
+ readonly ? SQLITE_OPEN_READONLY : SQLITE_OPEN_READWRITE, NULL);
if (rc) {
_E("Can't open database: %d, %s, extended: %d", rc, sqlite3_errmsg(svc_db),
sqlite3_extended_errcode(svc_db));
return 0;
}
-int _svc_db_check_perm(uid_t uid)
+int _svc_db_check_perm(uid_t uid, bool readonly)
{
int ret = 0;
- if (__init(uid) < 0)
+ if (__init(uid, readonly) < 0)
return -1;
- ret = access(__get_svc_db(uid), R_OK | W_OK);
+ ret = access(__get_svc_db(uid), readonly ? R_OK : (R_OK | W_OK));
return ret;
}
sqlite3_stmt* p_statement;
int result;
- if (__init(uid) < 0)
+ if (__init(uid, false) < 0)
return -1;
if (op == NULL )
return -1;
}
- if (__init(uid) < 0)
+ if (__init(uid, false) < 0)
return -1;
result = sqlite3_prepare_v2(svc_db, delete_query, strlen(delete_query),
char query[QUERY_MAX_LEN];
char* error_message = NULL;
- if (__init(uid) < 0)
+ if (__init(uid, false) < 0)
return -1;
snprintf(query, QUERY_MAX_LEN, "delete from appsvc;");
return 0;
}
- if (__init(uid) < 0)
+ if (__init(uid, true) < 0)
return 0;
snprintf(query, QUERY_MAX_LEN,
else
strncpy(u, uri, URI_MAX_LEN - 1);
- if (__init(uid) < 0)
+ if (__init(uid, true) < 0)
return NULL;
char *pkgname = NULL;
int found;
- if (__init(uid) < 0)
+ if (__init(uid, true) < 0)
return -1;
snprintf(query, QUERY_MAX_LEN, "select pkg_name from appsvc");