Fixed to use security_server_label_access() instead of lsetxattr().
authorYoungbok Shin <youngb.shin@samsung.com>
Wed, 23 Sep 2015 10:13:40 +0000 (19:13 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Thu, 24 Sep 2015 06:37:54 +0000 (15:37 +0900)
Change-Id: I8ba5996064fd73bebd2aaff228efdf5682d1637a

CMakeLists.txt
packaging/download-fonts-service.spec
pkgmgr_font/src/font_service_register.c

index db48748..cc300bf 100755 (executable)
@@ -8,6 +8,7 @@ pkg_check_modules(pkg REQUIRED
        capi-system-system-settings
        elementary
        pkgmgr-info
+       security-server
 )
 
 SET(PACKAGE "${PROJECT_NAME}")
index 238d2c2..68db2e0 100755 (executable)
@@ -11,6 +11,7 @@ BuildRequires: pkgconfig(fontconfig)
 BuildRequires: pkgconfig(capi-system-system-settings)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(security-server)
 
 %description
 Master Download fonts service.
index 9c45c3c..31e62e7 100755 (executable)
@@ -28,6 +28,7 @@
 #include <fontconfig/fontconfig.h>
 #include <Elementary.h>
 #include <pkgmgr-info.h>
+#include <security-server.h>
 #include "system_settings.h"
 
 
@@ -102,11 +103,11 @@ static int make_dir(const char *path)
                        return ret;
                }
        }
-       ret = lsetxattr(path, "security.SMACK64", "_", 1, 0);
+       ret = security_server_label_access(path, "_");
 
        if (ret < 0)
        {
-               DEBUG_ERROR("lsetxattr is failed %s\n",path);
+               DEBUG_ERROR("security_server_label_access is failed %s\n",path);
                return ret;
        }
 
@@ -174,11 +175,11 @@ static int symbolic_link(const char *srcpath, const char *destpath)
                                goto FAIL;
                        }
 
-                       ret = lsetxattr(destdir, "security.SMACK64", "_", 1, 0);
+                       ret = security_server_label_access(destdir, "_");
 
                        if (ret < 0)
                        {
-                               DEBUG_ERROR("lsetxattr is failed %s\n",destdir);
+                               DEBUG_ERROR("security_server_label_access is failed %s\n",destdir);
                                goto FAIL;
                        }
                }
@@ -247,11 +248,11 @@ static int move_file(const char *srcpath, const char *destpath)
                                goto FAIL;
                        }
 
-                       ret = lsetxattr(destdir, "security.SMACK64", "_", 1, 0);
+                       ret = security_server_label_access(destdir, "_");
 
                        if (ret < 0)
                        {
-                               DEBUG_ERROR("lsetxattr is failed %s\n",destdir);
+                               DEBUG_ERROR("security_server_label_access is failed %s\n",destdir);
                                goto FAIL;
                        }
                }
@@ -752,7 +753,7 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
                                                chmod (ELM_PROFILE_CFG, 0777);
                                        }
 
-                                       ret = lsetxattr(ELM_PROFILE_CFG, "security.SMACK64", "system::homedir", 15, 0);
+                                       ret = security_server_label_access(ELM_PROFILE_CFG, "system::homedir");
                                        if (ret < 0)
                                        {
                                                chmod (ELM_PROFILE_CFG, 0777);
@@ -781,7 +782,7 @@ int COMMON_PKGMGR_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList *
                                                                        chmod (file_full_path, 0777);
                                                                }
 
-                                                               ret = lsetxattr(file_full_path, "security.SMACK64", "system::homedir", 15, 0);
+                                                               ret = security_server_label_access(file_full_path, "system::homedir");
                                                                if (ret < 0)
                                                                {
                                                                        DEBUG_LOG("chsmack is failed %s", file_full_path);