aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-03-31 18:09:54 +0000
committerUlrich Drepper <drepper@redhat.com>1999-03-31 18:09:54 +0000
commita0e0c6c5199c9a4a10baee14cf9f77f7b1e5b832 (patch)
treed93659696f2ccc9e8391b5e8ce2c3b90eb94bb66
parent9f9914af70373003dada578091fd276c5578e8cf (diff)
downloadglibc-a0e0c6c5199c9a4a10baee14cf9f77f7b1e5b832.zip
glibc-a0e0c6c5199c9a4a10baee14cf9f77f7b1e5b832.tar.gz
glibc-a0e0c6c5199c9a4a10baee14cf9f77f7b1e5b832.tar.bz2
Update.
1999-03-31 Mark Kettenis <kettenis@gnu.org> * login/programs/pt_chown.c (main): Save effective user ID before dropping priviliges and use this to check if the program is properly installed.
-rw-r--r--ChangeLog6
-rw-r--r--login/programs/pt_chown.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1dd54e8..ee77487 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1999-03-31 Mark Kettenis <kettenis@gnu.org>
+
+ * login/programs/pt_chown.c (main): Save effective user ID before
+ dropping priviliges and use this to check if the program is
+ properly installed.
+
1999-03-31 Ulrich Drepper <drepper@cygnus.com>
* iconvdata/testdata/CP1254: Update for charmap changes.
diff --git a/login/programs/pt_chown.c b/login/programs/pt_chown.c
index 4b78e34..faec86b 100644
--- a/login/programs/pt_chown.c
+++ b/login/programs/pt_chown.c
@@ -133,17 +133,18 @@ do_pt_chown (void)
int
main (int argc, char *argv[])
{
+ uid_t euid = geteuid ();
int remaining;
/* Normal invocation of this program is with no arguments and
with privileges.
FIXME: Should use capable (CAP_CHOWN|CAP_FOWNER). */
- if (argc == 1 && geteuid () == 0)
+ if (argc == 1 && euid == 0)
return do_pt_chown ();
/* We aren't going to be using privileges, so drop them right now. */
setuid (getuid ());
-
+
/* Set locale via LC_ALL. */
setlocale (LC_ALL, "");
@@ -163,7 +164,7 @@ main (int argc, char *argv[])
}
/* Check if we are properly installed. */
- if (geteuid () != 0)
+ if (euid != 0)
error (FAIL_EXEC, 0, gettext ("needs to be installed setuid `root'"));
return EXIT_SUCCESS;