[Pkg-shadow-commits] r2739 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Tue Apr 21 22:46:01 UTC 2009


Author: nekral-guest
Date: 2009-04-21 22:46:01 +0000 (Tue, 21 Apr 2009)
New Revision: 2739

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/login.c
Log:
	* 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.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-04-21 22:39:52 UTC (rev 2738)
+++ upstream/trunk/ChangeLog	2009-04-21 22:46:01 UTC (rev 2739)
@@ -1,5 +1,11 @@
 2009-04-22  Nicolas François  <nicolas.francois at 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 at centraliens.net>
+
 	* libmisc/utmp.c: Reworked. Get rid of Linux specific stuff. Get rid
 	of global utent/utxent variables. Only reuse the ut_id and maybe
 	the ut_host fields from utmp.

Modified: upstream/trunk/src/login.c
===================================================================
--- upstream/trunk/src/login.c	2009-04-21 22:39:52 UTC (rev 2738)
+++ upstream/trunk/src/login.c	2009-04-21 22:46:01 UTC (rev 2739)
@@ -510,6 +510,11 @@
 	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)) {




More information about the Pkg-shadow-commits mailing list