X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fckm-integration%2Fprocess-settings%2Fchange-smack.cpp;h=f83aec4f203d564f3302db65f7e77a0dbf035afd;hb=73f509909a3e4942cc60efbe5963e3bcac9cd7d4;hp=f56c5060c272082b5e84900bb6e6317f39e87b3a;hpb=99ac53ca4f1ef7a2b931711969c08a4acee06fad;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git diff --git a/src/ckm-integration/process-settings/change-smack.cpp b/src/ckm-integration/process-settings/change-smack.cpp index f56c506..f83aec4 100644 --- a/src/ckm-integration/process-settings/change-smack.cpp +++ b/src/ckm-integration/process-settings/change-smack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2015 - 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. @@ -16,6 +16,7 @@ /* * @file change-smack.cpp * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com) + * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) * @version 1.0 */ #include @@ -23,6 +24,7 @@ #include #include +#include namespace ProcessSettings { @@ -31,22 +33,11 @@ ChangeSmack::ChangeSmack(const Policy &policy) {} void ChangeSmack::Apply() { - char *my_label = nullptr; - - RUNNER_ASSERT(-1 != smack_new_label_from_self(&my_label)); - - if (my_label) - m_originalLabel = my_label; - - free(my_label); - - RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(m_policy.GetSmackLabel().c_str()), - "Error in smack_set_label_for_self(" << m_policy.GetSmackLabel() << ")"); + m_processLabel.reset(new ScopedProcessLabel(m_policy.GetSmackLabel())); } void ChangeSmack::Revoke() { - RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(m_originalLabel.c_str()), - "Error in smack_set_label_for_self(" << m_originalLabel << ")"); + m_processLabel.reset(); } ChangeSmack::~ChangeSmack() {}