develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24122] setreuid and friends borked on darwin/osx

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
October 12, 2003 14:13
Subject:
Re: [perl #24122] setreuid and friends borked on darwin/osx
Message ID:
20031012231708.7a34df7c.rgarciasuarez@free.fr
pxm@nubz.org (via RT) wrote:
> 
> To further add to the joy, setuid(x) fails if x != ruid && euid != 0,
> which means that $< = $> doesn't work, only ($>,$<)=($uid,$uid) does
> thanks to delay-magic..  a workaround (tested) for this:

Thanks, I applied this patch as change #21440.

> --- mg.c.bak	2003-10-05 22:29:39.000000000 +0200
> +++ mg.c	2003-10-05 22:32:49.000000000 +0200
> @@ -2253,5 +2253,9 @@
>  #else
> -	if (PL_uid == PL_euid)		/* special case $< = $> */
> +	if (PL_uid == PL_euid) {		/* special case $< = $> */
> +#ifdef PERL_DARWIN
> +	    if (PL_uid != 0 && PerlProc_getuid() == 0)
> +		(void)PerlProc_setuid(0);
> +#endif
>  	    (void)PerlProc_setuid(PL_uid);
> -	else {
> +	} else {
>  	    PL_uid = PerlProc_getuid();

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About