summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2010-10-07 09:03:31 +0200
committerKarel Zak <kzak@redhat.com>2010-10-07 09:03:31 +0200
commit306c1df2f781652b9bab67d42423c5518f17205b (patch)
tree94df0c93011d9eb571445db8e78299d9b972d631
parenteac8c7dac9441bd9cfb3b9e78519b3ea51caab0e (diff)
downloadutil-linux-old-306c1df2f781652b9bab67d42423c5518f17205b.tar.gz
swapon: warn if file owner is not root
Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com> Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--mount/swapon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mount/swapon.c b/mount/swapon.c
index c7006550..d5114925 100644
--- a/mount/swapon.c
+++ b/mount/swapon.c
@@ -392,6 +392,10 @@ swapon_checks(const char *special)
warnx(_("%s: insecure permissions %04o, %04o suggested."),
special, st.st_mode & 07777,
~permMask & 0666);
+
+ if (S_ISREG(st.st_mode) && st.st_uid != 0)
+ warnx(_("%s: insecure file owner %d, 0 (root) suggested."),
+ special, st.st_uid);
}
/* test for holes by LBT */