class SmackRules {
public:
- SmackRules() : m_templateMgr(POLICY_INSTALL_DIR) {
- m_templateMgr.init();
- }
+ SmackRules();
/**
* Install package-specific smack rules plus add rules for specified external apps.
#include <map>
#include <string>
+#include <dpl/exception.h>
#include <smack-common.h>
#include "config-file.h"
namespace SecurityManager {
+class TemplateManagerException {
+public:
+ DECLARE_EXCEPTION_TYPE(SecurityManager::Exception, Base)
+ DECLARE_EXCEPTION_TYPE(Base, ConfigFileError)
+ DECLARE_EXCEPTION_TYPE(Base, ConfigParseError)
+};
+
class TemplateManager {
public:
explicit TemplateManager(const std::string &rootDir) : m_rootDir(rootDir){}
} // namespace anonymous
+SmackRules::SmackRules() : m_templateMgr(POLICY_INSTALL_DIR) {
+ try {
+ m_templateMgr.init();
+ } catch (TemplateManagerException::Base &e) {
+ LogError("Error loading template files: " << e.DumpToString());
+ }
+}
+
void SmackRules::addFromTemplate(
SmackAccesses &rules,
TemplateManager::Type type,
loadFiles();
} catch (FS::Exception::Base &e) {
LogError("Error loading config files: " << e.DumpToString());
+ Throw(TemplateManagerException::ConfigFileError);
} catch (SmackException::FileError &e) {
LogError("Error parsing config files: " << e.DumpToString());
+ Throw(TemplateManagerException::ConfigParseError);
}
}