Generic solution for onlycap issues
[platform/core/test/security-tests.git] / src / security-manager-tests / common / sm_commons.cpp
index acaf64d..b8b389b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
 #include <app-runtime.h>
 #include <sys/smack.h>
 #include <privilege_info.h>
+#include <scoped_process_label.h>
 
 #include <cynara_test_client.h>
 #include <dpl/test/test_runner.h>
@@ -358,7 +359,7 @@ void runAccessTest(const std::string &label, uid_t uid, gid_t gid,
                    const std::string &testPath, int accessType) {
     auto fun = [&](){
         int oppositeAccessType = getOppositeAccessType(accessType);
-        change_label(label.c_str());
+        ScopedProcessLabel spl(label, false);
         RUNNER_ASSERT_ERRNO_MSG(0 == drop_root_privileges(uid, gid),
                                 "drop_root_privileges failed.");