[fix] sessiond: do not follow symlinks while setting SMACK attributes 53/279853/3 accepted/tizen/unified/20220821.211106 submit/tizen/20220818.125806
authorAdam Michalski <a.michalski2@partner.samsung.com>
Thu, 18 Aug 2022 09:21:54 +0000 (11:21 +0200)
committerAdam Michalski <a.michalski2@partner.samsung.com>
Thu, 18 Aug 2022 12:46:00 +0000 (14:46 +0200)
of the copied files

Change-Id: Ia775dc9af277a333dbd5e75ee8e4ba2eebe88098

packaging/sessiond.spec
sessiond/src/fs_helpers.cpp

index d41d8bf..54f8e63 100644 (file)
@@ -1,6 +1,6 @@
 Name:       sessiond
 Summary:    Service to manage subsessions
-Version:    0.7.0
+Version:    0.7.1
 Release:    1
 Group:      System/Management
 License:    MIT
index 7a43ea4..35946c4 100644 (file)
@@ -81,7 +81,7 @@ void fs_helpers::copy_ownership(std::string_view src_path, std::string_view dest
 std::string fs_helpers::get_smack_label(std::string_view src_path, smack_label_type type)
 {
        char *label_raw = nullptr;
-       int ret = smack_getlabel(src_path.data(), &label_raw, type);
+       int ret = smack_lgetlabel(src_path.data(), &label_raw, type);
 
        std::unique_ptr<char, decltype([] (char *p) {
                free(p);
@@ -114,10 +114,10 @@ void fs_helpers::copy_smack_attributes(std::string_view src_path, std::string_vi
                        // N.B. Setting TRANSMUTE attribute needs special attention:
                        // the only correct values are: NULL, "", "0" or "1".
                        if (label == "TRUE")
-                               ret = smack_setlabel(dest_path.data(), "1", type);
+                               ret = smack_lsetlabel(dest_path.data(), "1", type);
                }
                else
-                       ret = smack_setlabel(dest_path.data(), label.c_str(), type);
+                       ret = smack_lsetlabel(dest_path.data(), label.c_str(), type);
 
                if (ret)
                        throw std::runtime_error(