]> granicus.if.org Git - shadow/commitdiff
* src/login.c: Check if login is run with effective root
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 21 Apr 2009 22:46:01 +0000 (22:46 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Tue, 21 Apr 2009 22:46:01 +0000 (22:46 +0000)
privileges. This should be more helpful to users than a failure to
find an utmp entry or failure to access a file.

ChangeLog
src/login.c

index 1b668be7ad881b7e8025065fd2fd79bd88f7e161..573e6873038ac9522a9513663600ef97e601aa58 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-22  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/login.c: Check if login is run with effective root
+       privileges. This should be more helpful to users than a failure to
+       find an utmp entry or failure to access a file.
+
 2009-04-22  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/utmp.c: Reworked. Get rid of Linux specific stuff. Get rid
index 1e0a39eddc8e4a64a08fcf92eb54cd38952cfdd3..3f2068e0ab07bfe639331b9d895443c2dd8d99ba 100644 (file)
@@ -510,6 +510,11 @@ int main (int argc, char **argv)
        amroot = (getuid () == 0);
        Prog = Basename (argv[0]);
 
+       if (geteuid() != 0) {
+               fprintf (stderr, _("%s: Cannot possibly work without effective root\n"), Prog);
+               exit (1);
+       }
+
        process_flags (argc, argv);
 
        if ((isatty (0) == 0) || (isatty (1) == 0) || (isatty (2) == 0)) {