/*
- * Copyright (c) 2013 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013 - 2020 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.
{
RUNNER_ASSERT_MSG(m_inSwitchContext == false, "already switched context");
- RUNNER_ASSERT_MSG(0 == smack_revoke_subject(m_mySubject.c_str()),
- "Error in smack_revoke_subject(" << m_mySubject << ")");
+ clear();
apply();
m_processLabel.reset(new ScopedProcessLabel(m_mySubject));
m_inSwitchContext = true;
}
+void AccessProvider::clear() {
+ m_smackAccess.clear();
+}
+
void AccessProvider::allowJournaldLogs() {
allowAPI("System::Run","wx"); // necessary for logging with journald
}
{
RUNNER_ASSERT_MSG(0 == setegid(m_origGid), "Error in setgid.");
RUNNER_ASSERT_MSG(0 == seteuid(m_origUid), "Error in setuid.");
- RUNNER_ASSERT_MSG(0 == smack_revoke_subject(m_mySubject.c_str()),
- "Error in smack_revoke_subject(" << m_mySubject << ")");
+ clear();
m_processLabel.reset();
m_inSwitchContext = false;
}
/*
- * Copyright (c) 2013 - 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013 - 2020 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.
void allowAPI(const std::string &api, const std::string &rules);
void apply();
void applyAndSwithToUser(int uid, int gid);
+ void clear();
private:
void allowJournaldLogs();
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013 - 2020 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.
"Error in smack_accessses_apply.");
}
+void SmackAccess::clear() {
+ RUNNER_ASSERT_MSG(0 == smack_accesses_clear(m_handle),
+ "Error in smack_accesses_clear.");
+}
+
SmackAccess::~SmackAccess() {
if (m_handle)
smack_accesses_free(m_handle);
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2013 - 2020 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.
const std::string &object,
const std::string &rights);
void apply();
+ void clear();
virtual ~SmackAccess();
private:
struct smack_accesses *m_handle;