Generic solution for onlycap issues
[platform/core/test/security-tests.git] / src / common / access_provider.cpp
index 1d3257a..fb53d86 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013 - 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.
@@ -28,6 +28,7 @@
 #include <tests_common.h>
 
 #include <access_provider.h>
+#include <scoped_process_label.h>
 
 namespace SecurityServer {
 
@@ -55,8 +56,7 @@ void AccessProvider::applyAndSwithToUser(int uid, int gid) {
     RUNNER_ASSERT_MSG(0 == smack_revoke_subject(m_myLabel.c_str()),
         "Error in smack_revoke_subject(" << m_myLabel << ")");
     apply();
-    RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(m_myLabel.c_str()),
-        "Error in smack_set_label_for_self.");
+    ScopedProcessLabel spl(m_myLabel, false);
     RUNNER_ASSERT_MSG(0 == setgid(gid),
         "Error in setgid.");
     RUNNER_ASSERT_MSG(0 == setuid(uid),