remove supporting Dbus Action 37/255337/1 accepted/tizen/unified/20210317.115804 submit/tizen/20210317.072956
authorYoungjae Shin <yj99.shin@samsung.com>
Wed, 17 Mar 2021 06:01:43 +0000 (15:01 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Wed, 17 Mar 2021 06:03:52 +0000 (15:03 +0900)
Change-Id: I7c135a7e118490041a3766185494ff6c7f29357b

src/server/JobManager.cpp

index 609df9354487c2dd3732523624429cbb142f4305..a1c40ab9da52eb22f0101781f8ccb2ac02370358 100644 (file)
 using namespace ctx;
 
 namespace {
-       class JobIdGenerator {
-       public:
-               void init(JobInfoDatabase& database);
-               int pop();
-       private:
-               void __push(int id);
-               std::deque<int> __usedIds;
-       };
+class JobIdGenerator {
+public:
+       void init(JobInfoDatabase& database);
+       int pop();
+private:
+       void __push(int id);
+       std::deque<int> __usedIds;
+};
 }
 
 void JobIdGenerator::init(JobInfoDatabase& database)
@@ -127,10 +127,8 @@ int JobManager::addJob(JobInfo* jobInfo, IClient* owner)
 
        if (jobInfo->getType() == JobInfo::Type::PERIODIC) {
                jobId = __addPeriodicJob(static_cast<PeriodicJobInfo*>(jobInfo), owner);
-
        } else if (jobInfo->getType() == JobInfo::Type::ON_DEMAND) {
                jobId = __addOnDemandJob(static_cast<OnDemandJobInfo*>(jobInfo), owner);
-
        } else {
                return E_PARAM;
        }
@@ -355,16 +353,16 @@ bool JobManager::__isPermitted(const std::string& uri, IClient* client)
 void JobManager::__verifyPeriodicJob(PeriodicJobInfo* jobInfo, IClient* owner)
 {
        IF_FAIL_THROW_TAG(!(jobInfo->isOneTime() && jobInfo->isPersistent()), E_PARAM,
-                       _W, "A one-time job cannot be persistent.");
+               _W, "A one-time job cannot be persistent.");
 
        IF_FAIL_THROW_TAG(jobInfo->getInterval() >= CTX_MIN_JOB_PERIOD, E_PARAM,
-                       _W, "The interval is too short.");
+               _W, "The interval is too short.");
 
        IF_FAIL_THROW_TAG(jobInfo->getInterval() <= CTX_MAX_JOB_PERIOD, E_PARAM,
-                       _W, "The interval is too long.");
+               _W, "The interval is too long.");
 
        IF_FAIL_THROW_TAG(jobInfo->getAnchor() >= 0, E_PARAM,
-                       _W, "The anchor should be positive.");
+               _W, "The anchor should be positive.");
 
        __verifyRequirements(jobInfo, owner);
        __verifyAction(jobInfo, owner);
@@ -373,7 +371,7 @@ void JobManager::__verifyPeriodicJob(PeriodicJobInfo* jobInfo, IClient* owner)
 void JobManager::__verifyOnDemandJob(OnDemandJobInfo* jobInfo, IClient* owner)
 {
        IF_FAIL_THROW_TAG(!(jobInfo->isOneTime() && jobInfo->isPersistent()), E_PARAM,
-                       _W, "A one-time job cannot be persistent.");
+               _W, "A one-time job cannot be persistent.");
 
        __verifyTriggers(jobInfo, owner);
        __verifyRequirements(jobInfo, owner);
@@ -389,27 +387,27 @@ void JobManager::__verifyTriggers(OnDemandJobInfo* jobInfo, IClient* owner)
                _D("Check %s", uri.c_str());
 
                IF_FAIL_THROW_TAG(isSupported(JobContext::Type::TRIGGER, uri, owner), E_SUPPORT,
-                               _W, "'%s' is not supported.", uri.c_str());
+                       _W, "'%s' is not supported.", uri.c_str());
 
                IF_FAIL_THROW_TAG(__isPermitted(uri, owner), E_ACCESS,
-                               _W, "'%s' is not allowed to use '%s'.", owner->getName().c_str(), uri.c_str());
+                       _W, "'%s' is not allowed to use '%s'.", owner->getName().c_str(), uri.c_str());
        }
 }
 
 void JobManager::__verifyRequirements(JobInfo* jobInfo, IClient* owner)
 {
        IF_FAIL_THROW_TAG(jobInfo->getRequirementTimeout() <= CTX_MAX_REQ_TIMEOUT, E_PARAM,
-                       _W, "The requirement timeout is too short.");
+               _W, "The requirement timeout is too short.");
 
        for (auto& req : jobInfo->getRequirements()) {
                const std::string& uri = req->getUri();
                _D("Check %s", uri.c_str());
 
                IF_FAIL_THROW_TAG(isSupported(JobContext::Type::REQUIREMENT, uri, owner), E_SUPPORT,
-                               _W, "'%s' is not supported.", uri.c_str());
+                       _W, "'%s' is not supported.", uri.c_str());
 
                IF_FAIL_THROW_TAG(__isPermitted(uri, owner), E_ACCESS,
-                               _W, "'%s' is not allowed to use '%s'.", owner->getName().c_str(), uri.c_str());
+                       _W, "'%s' is not allowed to use '%s'.", owner->getName().c_str(), uri.c_str());
        }
 }
 
@@ -444,17 +442,7 @@ void JobManager::__verifyAction(JobInfo* jobInfo, IClient* owner)
                return;
        }
 
-       // DBus Method
-       verified = [&]()->bool {
-               JobDBusCall* dbusAction = dynamic_cast<JobDBusCall*>(action);
-               IF_FAIL_RETURN(dbusAction, false);
-               IF_FAIL_RETURN(!(dbusAction->getBusName().empty()), false);
-               IF_FAIL_RETURN(!(dbusAction->getObjectPath().empty()), false);
-               IF_FAIL_RETURN(!(dbusAction->getInterface().empty()), false);
-               IF_FAIL_RETURN(!(dbusAction->getMethodName().empty()), false);
-               return true;
-       }();
-       if (verified) return;
+       //TODO: DBus Method is not supported due to security issue.
 
        _W("Invalid action");
        throw E_PARAM;