Skip to change ownership and permissions to the symlink file 57/107557/3
authorjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 28 Dec 2016 11:54:39 +0000 (20:54 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Wed, 28 Dec 2016 12:00:56 +0000 (21:00 +0900)
To prevent chaning to the path outside of application path.

Change-Id: Id3c5d3ca33ec7e6f484c8185d0279fc109cafa39
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/step/filesystem/step_change_ownership_and_permission.cc

index 60b7116..a6eb19e 100644 (file)
@@ -103,7 +103,6 @@ bool GrantDefaultPermissions(bf::path pkg_path) {
       boost::make_iterator_range(bf::directory_iterator(pkg_path), {})) {
     auto path = entry.path();
 
-    // symlink will be skipped
     if (bf::is_symlink(symlink_status(path)))
       continue;
 
@@ -119,6 +118,9 @@ bool GrantDefaultPermissions(bf::path pkg_path) {
       for (auto& entry :
           boost::make_iterator_range(bf::directory_iterator(path), {})) {
         auto path = entry.path();
+        if (bf::is_symlink(symlink_status(path)))
+          continue;
+
         if (bf::is_regular_file(path)) {
           if (!GrantPermission755(path))
             return false;
@@ -133,6 +135,9 @@ bool GrantDefaultPermissions(bf::path pkg_path) {
       for (auto& entry :
           boost::make_iterator_range(bf::directory_iterator(path), {})) {
         auto path = entry.path();
+        if (bf::is_symlink(symlink_status(path)))
+          continue;
+
         if (bf::is_regular_file(path)) {
           if (!GrantPermission644(path))
             return false;