From: Junghyun Yeon Date: Tue, 2 Nov 2021 10:35:39 +0000 (+0900) Subject: Change file log behavior X-Git-Tag: accepted/tizen/unified/20211125.144721~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F265958%2F1;p=platform%2Fcore%2Fappfw%2Fapp-installers.git Change file log behavior Adjust permission and SMACK label to let platform privileged applications could access it. Also, create empty installer history log file to apply proper SMACK label to it. Change-Id: Icb85e3fbb2f0e69ae5b8e8ad6e1a94eedee576da Signed-off-by: Junghyun Yeon --- diff --git a/packaging/app-installers.spec b/packaging/app-installers.spec index dfc5ddf..f1d2d98 100644 --- a/packaging/app-installers.spec +++ b/packaging/app-installers.spec @@ -101,7 +101,12 @@ mkdir -p %{buildroot}%{logdir} %post chsmack -a System %{unpackdir} -chsmack -a System %{logdir} +chsmack -t -a User::Home %{logdir} +chown -R app_fw:priv_platform %{logdir} +chmod 755 %{logdir} +touch %{logdir}/installation-history.log +chown app_fw:priv_platform %{logdir}/installation-history.log +chsmack -a User::Home %{logdir}/installation-history.log %postun diff --git a/src/common/utils/file_logbackend.cc b/src/common/utils/file_logbackend.cc index a30d5f6..e3513d1 100644 --- a/src/common/utils/file_logbackend.cc +++ b/src/common/utils/file_logbackend.cc @@ -15,6 +15,12 @@ #include #include +namespace { + +constexpr mode_t kDefaultMode640 = S_IRUSR | S_IWUSR | S_IRGRP; + +} // namespace + namespace utils { FileLogBackend::FileLogBackend(std::string file_name, int rotation_size, @@ -47,6 +53,8 @@ void FileLogBackend::WriteLogToFile() { // clean the log stream log_stream_->str(""); log_stream_->clear(); + + chmod(file_name_.c_str(), kDefaultMode640); } bool FileLogBackend::Rotate() {