summaryrefslogtreecommitdiff
path: root/utils/perldoc.PL
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-12 16:09:59 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-12 16:09:59 +0000
commit996aae182a59ea0e165108a1cc21191bf20b4a55 (patch)
treea55780bcb9ce3a906008b45129d565fc3a1b9d07 /utils/perldoc.PL
parent9d2bbe64880a61780d874de13a887a9237f604de (diff)
downloadperl-996aae182a59ea0e165108a1cc21191bf20b4a55.tar.gz
One should first drop the real uid, not the effective uid.
[ID 20020110.003] p4raw-id: //depot/perl@14217
Diffstat (limited to 'utils/perldoc.PL')
-rw-r--r--utils/perldoc.PL10
1 files changed, 8 insertions, 2 deletions
diff --git a/utils/perldoc.PL b/utils/perldoc.PL
index ea381a48b7..62a82f381f 100644
--- a/utils/perldoc.PL
+++ b/utils/perldoc.PL
@@ -170,8 +170,14 @@ if (!($Is_VMS || $Is_MSWin32 || $Is_Dos || $Is_OS2) && ($> == 0 || $< == 0)
$id = eval { getpwnam("nouser") } unless defined $id;
$id = -2 unless defined $id;
eval {
- $> = $id; # must do this one first!
- $< = $id;
+ # According to Stevens' APUE and various
+ # (BSD, Solaris, HP-UX) man pages setting
+ # the real uid first and effective uid second
+ # is the way to go if one wants to drop privileges,
+ # because if one changes into an effective uid of
+ # non-zero, one cannot change the real uid any more.
+ $< = $id; # real uid
+ $> = $id; # effective uid
};
last if !$@ && $< && $>;
}