[systemd-devel] [PATCH 2/2] journalctl: add permission check on /var/log/journal
Shawn Landden
shawnlandden at gmail.com
Sun Jul 14 10:48:14 PDT 2013
---
src/journal/journalctl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 5f44fce..77a5fb1 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -748,6 +748,12 @@ static int setup_keys(void) {
return r < 0 ? -errno : -ENOTDIR;
}
+ r = access("/var/log/journal", R_OK | W_OK | X_OK);
+ if (r < 0) {
+ log_error("Insufficient permission on %s: %m", "/var/log/journal");
+ return -errno;
+ }
+
r = sd_id128_get_machine(&machine);
if (r < 0) {
log_error("Failed to get machine ID: %s", strerror(-r));
--
1.8.3.2
More information about the systemd-devel
mailing list