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

Re: [PATCH bleadperl] (was Re: Is this brokenness in $< $( $> & $) ?)

Thread Previous | Thread Next
From:
Rick Delaney
Date:
October 27, 2003 13:24
Subject:
Re: [PATCH bleadperl] (was Re: Is this brokenness in $< $( $> & $) ?)
Message ID:
20031027162416.H2233@biff.bort.ca
On Mon, Oct 27, 2003 at 03:24:13PM -0500, Rick Delaney wrote:
> On Mon, Oct 27, 2003 at 04:53:11PM +0000, Alan Burlison wrote:
> > 
> > According to the setreuid/setregid manpages, the first parameter (real 
> > uid/gid) should be -1 to specify 'no change'.
> 
> Does the following patch work for you?

Probably not since it's filled with stupidities.  Try this instead.

> Also, can someone tell me what I have configured wrong that
> 
>     print $>;
> 
> does not print the euid.  I have this problem in blead and 5.8.0 but not
> 5.6.1 (which is the only one I didn't compile myself).  It makes this a
> little hard to test.

-- 
Rick Delaney
rick@bort.ca


--- pp_hot.c.orig	Mon Oct 27 14:49:30 2003
+++ pp_hot.c	Mon Oct 27 16:14:00 2003
@@ -1066,10 +1066,13 @@
     if (PL_delaymagic & ~DM_DELAY) {
 	if (PL_delaymagic & DM_UID) {
 #ifdef HAS_SETRESUID
-	    (void)setresuid(PL_uid,PL_euid,(Uid_t)-1);
+	    (void)setresuid((PL_delaymagic & DM_RUID) ? PL_uid  : (Uid_t)-1,
+			    (PL_delaymagic & DM_EUID) ? PL_euid : (Uid_t)-1,
+			    (Uid_t)-1);
 #else
 #  ifdef HAS_SETREUID
-	    (void)setreuid(PL_uid,PL_euid);
+	    (void)setreuid((PL_delaymagic & DM_RUID) ? PL_uid  : (Uid_t)-1,
+			   (PL_delaymagic & DM_EUID) ? PL_euid : (Uid_t)-1);
 #  else
 #    ifdef HAS_SETRUID
 	    if ((PL_delaymagic & DM_UID) == DM_RUID) {
@@ -1079,7 +1082,7 @@
 #    endif /* HAS_SETRUID */
 #    ifdef HAS_SETEUID
 	    if ((PL_delaymagic & DM_UID) == DM_EUID) {
-		(void)seteuid(PL_uid);
+		(void)seteuid(PL_euid);
 		PL_delaymagic &= ~DM_EUID;
 	    }
 #    endif /* HAS_SETEUID */
@@ -1095,10 +1098,13 @@
 	}
 	if (PL_delaymagic & DM_GID) {
 #ifdef HAS_SETRESGID
-	    (void)setresgid(PL_gid,PL_egid,(Gid_t)-1);
+	    (void)setresgid((PL_delaymagic & DM_RGID) ? PL_gid  : (Gid_t)-1,
+			    (PL_delaymagic & DM_EGID) ? PL_egid : (Gid_t)-1,
+			    (Gid_t)-1);
 #else
 #  ifdef HAS_SETREGID
-	    (void)setregid(PL_gid,PL_egid);
+	    (void)setregid((PL_delaymagic & DM_RGID) ? PL_gid  : (Gid_t)-1,
+			   (PL_delaymagic & DM_EGID) ? PL_egid : (Gid_t)-1);
 #  else
 #    ifdef HAS_SETRGID
 	    if ((PL_delaymagic & DM_GID) == DM_RGID) {
@@ -1108,7 +1114,7 @@
 #    endif /* HAS_SETRGID */
 #    ifdef HAS_SETEGID
 	    if ((PL_delaymagic & DM_GID) == DM_EGID) {
-		(void)setegid(PL_gid);
+		(void)setegid(PL_egid);
 		PL_delaymagic &= ~DM_EGID;
 	    }
 #    endif /* HAS_SETEGID */

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