From aeebd6dc48865c2c08e1939b1cff40266cd4a229 Mon Sep 17 00:00:00 2001 From: "Sabera Djelti (sdi2)" Date: Wed, 13 Aug 2014 13:39:03 +0200 Subject: [PATCH] Fix (run application with) xwalk-launcher Signed-off-by: Sabera Djelti (sdi2) Signed-off-by: Stephane Desneux Change-Id: I604e4292dca894cf5173d44158afb6423685778f --- CMakeLists.txt | 4 ++-- packaging/pkgmgr-info.spec | 1 + parser/pkgmgr_parser_db.c | 18 +++++++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b8480e..7b9f75d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,14 +18,14 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_ ### Required packages INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 libtzplatform-config) +pkg_check_modules(pkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 libtzplatform-config libsmack) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) -pkg_check_modules(libpkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 libtzplatform-config) +pkg_check_modules(libpkgs REQUIRED glib-2.0 dlog vconf sqlite3 db-util libxml-2.0 dbus-1 dbus-glib-1 libtzplatform-config libsmack) FOREACH(flag ${libpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index 7df92a5..1118e48 100755 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -15,6 +15,7 @@ BuildRequires: pkgconfig(libxml-2.0) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(libtzplatform-config) +BuildRequires: pkgconfig(libsmack) %description Packager Manager infomation api for packaging diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index e02262b..cae2435 100755 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -2145,7 +2146,7 @@ int pkgmgr_parser_initialize_db() return 0; } -static int parserdb_change_perm(const char *db_file) +static int parserdb_change_perm(const char *db_file, uid_t uid) { char buf[BUFSIZE]; char journal_file[BUFSIZE]; @@ -2169,10 +2170,10 @@ static int parserdb_change_perm(const char *db_file) _LOGD("getgrnam(users) returns NULL !"); } for (i = 0; files[i]; i++) { - ret = chown(files[i], OWNER_ROOT, (gid_t)grpinfo->gr_gid); + ret = chown(files[i], uid, (gid_t)grpinfo->gr_gid); if (ret == -1) { strerror_r(errno, buf, sizeof(buf)); - _LOGD("FAIL : chown %s %d.%d, because %s", db_file, OWNER_ROOT, grpinfo->gr_gid, buf); + _LOGD("FAIL : chown %s %d.%d, because %s", db_file, uid, grpinfo->gr_gid, buf); return -1; } @@ -2182,6 +2183,13 @@ static int parserdb_change_perm(const char *db_file) _LOGD("FAIL : chmod %s 0664, because %s", db_file, buf); return -1; } + /* chsmack */ + if(smack_setlabel(db_file, "_", SMACK_LABEL_ACCESS)) + { + _LOGE("failed chsmack -a \"_\" %s", db_file); + } else { + _LOGD("chsmack -a \"_\" %s", db_file); + } } return 0; @@ -2198,7 +2206,7 @@ int pkgmgr_parser_check_and_create_db(uid_t uid) return -1; } if(uid != GLOBAL_USER) { - if( 0 != parserdb_change_perm(getUserPkgParserDBPathUID(uid))) { + if( 0 != parserdb_change_perm(getUserPkgParserDBPathUID(uid), uid)) { _LOGD("Failed to change permission\n"); } } @@ -2209,7 +2217,7 @@ int pkgmgr_parser_check_and_create_db(uid_t uid) return -1; } if(uid != GLOBAL_USER) { - if( 0 != parserdb_change_perm(getUserPkgCertDBPathUID(uid))) { + if( 0 != parserdb_change_perm(getUserPkgCertDBPathUID(uid), uid)) { _LOGD("Failed to change permission\n"); } } -- 2.7.4