diff options
author | Garry T. Williams <garry@zvolve.com> | 2000-09-04 08:09:44 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-11-01 20:56:34 +0000 |
commit | a043a68546f5b73797216edaeee5d9ddb364c19a (patch) | |
tree | 1adac73aaa089abb5b9dffc4afb47c6994909b03 /ext | |
parent | e093bcf0cf7ac8078690b5226007992e026a34d0 (diff) | |
download | perl-a043a68546f5b73797216edaeee5d9ddb364c19a.tar.gz |
Make the POSIX::setuid and POSIX::setgid to really call setuid()
and setgid() because they were just changing $< and $( which means
only changing the real uid/gid, as opposed to changing both
real and effective ids. (The alternative way could have been
in POSIX.pm to change $> and $), too, but making a direct call
to the C API feels cleaner.) Fixes the bug
Subject: [ID 20000904.005] POSIX::setuid() Doesn't Call setuid()
Message-Id: <200009041609.e84G9iN12155@ifr.inside.zvolve.net>
p4raw-id: //depot/perl@7521
Diffstat (limited to 'ext')
-rw-r--r-- | ext/POSIX/POSIX.pm | 10 | ||||
-rw-r--r-- | ext/POSIX/POSIX.pod | 16 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 24 | ||||
-rw-r--r-- | ext/POSIX/typemap | 4 |
4 files changed, 30 insertions, 24 deletions
diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm index 252e5bbad1..e1e6b28e40 100644 --- a/ext/POSIX/POSIX.pm +++ b/ext/POSIX/POSIX.pm @@ -734,16 +734,6 @@ sub setbuf { redef "IO::Handle::setbuf()"; } -sub setgid { - usage "setgid(gid)" if @_ != 1; - $( = $_[0]; -} - -sub setuid { - usage "setuid(uid)" if @_ != 1; - $< = $_[0]; -} - sub setvbuf { redef "IO::Handle::setvbuf()"; } diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod index 314147cb2b..e93fb742da 100644 --- a/ext/POSIX/POSIX.pod +++ b/ext/POSIX/POSIX.pod @@ -1008,9 +1008,12 @@ see L<perlre>. =item setgid -Sets the real group identifier for this process. -Identical to assigning a value to the Perl's builtin C<$)> variable, -see L<perlvar/$UID>. +Sets the real group identifier and the effective group identifier for +this process. Similar to assigning a value to the Perl's builtin +C<$)> variable, see L<perlvar/$GID>, except that the latter +will change only the real user identifier, and that the setgid() +uses only a single numeric argument, as opposed to a space-separated +list of numbers. =item setjmp @@ -1063,9 +1066,10 @@ setting the session identifier of the current process. =item setuid -Sets the real user identifier for this process. -Identical to assigning a value to the Perl's builtin C<$E<lt>> variable, -see L<perlvar/$UID>. +Sets the real user identifier and the effective user identifier for +this process. Similar to assigning a value to the Perl's builtin +C<$E<lt>> variable, see L<perlvar/$UID>, except that the latter +will change only the real user identifier. =item sigaction diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index a536671afc..c5d169a9f2 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -65,7 +65,7 @@ # include <lib$routines.h> /* prototype for lib$ediv() */ # include <starlet.h> /* prototype for sys$gettim() */ # if DECC_VERSION < 50000000 -# define pid_t int /* old versions of DECC miss this in types.h */ +# define Pid_t int /* old versions of DECC miss this in types.h */ # endif # undef mkfifo @@ -117,7 +117,7 @@ # define mkfifo(a,b) not_here("mkfifo") # define ttyname(a) (char*)not_here("ttyname") # define sigset_t long -# define pid_t long +# define Pid_t long # ifdef __BORLANDC__ # define tzname _tzname # endif @@ -3545,20 +3545,20 @@ read(fd, buffer, nbytes) SysRet setpgid(pid, pgid) - pid_t pid - pid_t pgid + Pid_t pid + Pid_t pgid -pid_t +Pid_t setsid() -pid_t +Pid_t tcgetpgrp(fd) int fd SysRet tcsetpgrp(fd, pgrp_id) int fd - pid_t pgrp_id + Pid_t pgrp_id int uname() @@ -3940,6 +3940,14 @@ pathconf(filename, name) SysRet pause() +SysRet +setgid(gid) + Gid_t gid + +SysRet +setuid(uid) + Uid_t uid + SysRetLong sysconf(name) int name @@ -3947,3 +3955,5 @@ sysconf(name) char * ttyname(fd) int fd + + diff --git a/ext/POSIX/typemap b/ext/POSIX/typemap index baf9bfc051..c94df7a4b9 100644 --- a/ext/POSIX/typemap +++ b/ext/POSIX/typemap @@ -1,8 +1,10 @@ Mode_t T_NV -pid_t T_NV +Pid_t T_NV Uid_t T_NV Time_t T_NV Gid_t T_NV +Uid_t T_NV +Gid_t T_NV Off_t T_NV Dev_t T_NV NV T_NV |