]> err.no Git - util-linux/commitdiff
swapon: warn if file owner is not root
authorKarel Zak <kzak@redhat.com>
Thu, 7 Oct 2010 07:03:31 +0000 (09:03 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 7 Oct 2010 07:03:31 +0000 (09:03 +0200)
Reported-by: Bernhard Voelker <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/swapon.c

index c7006550ea5ce9ab633a178157552d794054a1f4..d511492517bfc1832c1dec482482bb2807a39ab2 100644 (file)
@@ -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 */