Empty lines in Smack policy are invalid. In most cases we get away with
them as kernel manages to filter them out and ignore.
There are however some nasty corner cases causing kernel to reject policy
with an empty line.
This change removes the cause for empty lines appearing in policy, updates
existing policy and modifies policy generation code to skip empty lines
by default, if they appear in policy templates again.
Change-Id: Id875523d2269ff8466898e9bef9b2a0b81387378
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
User ~PATH_RW~ rwxat
User ~PATH_RO~ rwxat
User ~PATH_SHARED_RO~ rwxat
-
--- /dev/null
+#!/bin/sh -e
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+. /etc/tizen-platform.conf
+
+systemctl stop security-manager.service security-manager.socket
+sed -r '/^\s*$/d' -i $TZ_SYS_VAR/security-manager/rules/* $TZ_SYS_VAR/security-manager/rules-merged/*
+systemctl start security-manager.service security-manager.socket
ThrowMsg(SmackException::FileError, "Cannot open rules template file: " << templatePath);
}
- while (std::getline(templateRulesFile, line)) {
- templateRules.push_back(line);
- }
+ while (std::getline(templateRulesFile, line))
+ if (!line.empty())
+ templateRules.push_back(line);
if (templateRulesFile.bad()) {
LogError("Error reading template file: " << templatePath);