From: Tomasz Swierczek Date: Tue, 1 Oct 2019 11:05:53 +0000 (+0200) Subject: Do not fail NS worker action if mount point doesn't exist X-Git-Tag: submit/tizen/20191009.143649~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c89ce505f77dd3ba5c8aa0a3d5fc74b1d28fe4f;p=platform%2Fcore%2Fsecurity%2Fsecurity-manager.git Do not fail NS worker action if mount point doesn't exist This mimics actions taken at app launch, where privileges defined for nonexisting mount points are not causing the launch to be failed. Change-Id: I4e8f14452d379ee86efc31412aa940a4aa67b463 --- diff --git a/src/common/worker.cpp b/src/common/worker.cpp index 64b80f3f..466f50da 100644 --- a/src/common/worker.cpp +++ b/src/common/worker.cpp @@ -1,7 +1,7 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2017 - 2019 Samsung Electronics Co., Ltd All Rights Reserved * - * Contact: Rafal Krypa + * Contact: Tomasz Swierczek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,9 +71,15 @@ int Worker::doWork(const NSMountLogic::EntryVector &entries) if (mapIter == storagePrivilegePathMap.end()) continue; - for (auto &privilegePath : mapIter->second) + for (auto &privilegePath : mapIter->second) { + if (FS::directoryStatus(privilegePath.dstPath) == 0) { + LogWarning("Not enforcing privilege " << privName << " for application " << entry.smackLabel << " : " << + "directory " << privilegePath.dstPath << " doesn't exist"); + continue; + } if (SECURITY_MANAGER_SUCCESS != applyPrivilegePath(allowed, privilegePath)) status = -1; + } } } catch (...) { status = -1;