Change 14217 by jhi@alpha on 2002/01/12 16:09:59
One should first drop the real uid, not the effective uid.
[ID 20020110.003]
Affected files ...
.... //depot/perl/utils/perldoc.PL#62 edit
Differences ...
==== //depot/perl/utils/perldoc.PL#62 (text) ====
Index: perl/utils/perldoc.PL
--- perl/utils/perldoc.PL.~1~ Sat Jan 12 09:15:05 2002
+++ perl/utils/perldoc.PL Sat Jan 12 09:15:05 2002
@@ -170,8 +170,14 @@
$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 !$@ && $< && $>;
}
End of Patch.