[fix] sessiond: do not follow symlinks while setting the owner/group 69/279769/1
authorAdam Michalski <a.michalski2@partner.samsung.com>
Wed, 17 Aug 2022 09:12:23 +0000 (11:12 +0200)
committerAdam Michalski <a.michalski2@partner.samsung.com>
Wed, 17 Aug 2022 09:12:23 +0000 (11:12 +0200)
of the copied files

Change-Id: I64aec17972aa916d471b16684a00a073c30a2016

sessiond/src/fs_helpers.cpp

index 2f8f2d1..09f3d35 100644 (file)
@@ -141,7 +141,7 @@ int fs_helpers::get_gid_from_name(std::string_view group_name)
 
 void fs_helpers::change_owner_and_group(std::string_view path, const int session_uid, const int group_id)
 {
-       if (chown(path.data(), session_uid, group_id) == -1)
+       if (lchown(path.data(), session_uid, group_id) == -1)
                throw std::system_error(errno, std::system_category(),
                        "Couldn't set owner/group of the `"s
                        + path.data()