|Pathologically Eclectic Rubbish Lister|
EUID cannot be setby 0xbeef (Hermit)
|on May 09, 2007 at 21:14 UTC||Need Help??|
0xbeef has asked for the wisdom of the Perl Monks concerning the following question:
I have run into a peculiarity when using the $> variable to demote privileges in one of my programs, which can be simplified to:
This tested fine on my Linux system, the idea being that I would demote myself to nobody (uid 65534) before doing some system calls.
The same code unexpectedly failed on my AIX system with a resulting EUID=-2, which I'm now guessing to be related to an overflow problem since the only difference on AIX is that nobody's uid is 4294967294 by default. When I use a user with a lower uid it works fine.
The AIX system is running v5.8.0, but I got the same result on v5.8.8.
My workaround was to use the "sys" user (uid=3), but can anyone confirm this as an overflow issue with the built-in $> variable and perhaps an alternative solution?