Fix (run application with) xwalk-launcher 27/26027/1 submit/tizen_common/20140814.134251 submit/tizen_ivi/20140818.000000 submit/tizen_ivi/20140818.000001 submit/tizen_ivi/20140818.000002 submit/tizen_ivi/20140822.000000
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Wed, 13 Aug 2014 11:39:03 +0000 (13:39 +0200)
committerSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Thu, 14 Aug 2014 08:41:58 +0000 (10:41 +0200)
Signed-off-by: Sabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Signed-off-by: Stephane Desneux <stephane.desneux@open.eurogiciel.org>
Change-Id: I604e4292dca894cf5173d44158afb6423685778f

CMakeLists.txt
packaging/pkgmgr-info.spec
parser/pkgmgr_parser_db.c

index 4b8480e..7b9f75d 100644 (file)
@@ -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}")
index 7df92a5..1118e48 100755 (executable)
@@ -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
index e02262b..cae2435 100755 (executable)
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/smack.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <db-util.h>
@@ -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");
          }
     }