NAME
Unix::ResUID - Reliable User ID management
VERSION
version 0.001
DESCRIPTION
This module provides a more reliable way to manage user IDs than $</$> and POSIX::setuid()
. It may not work on all systems (though Linux and the BSDs should be supported), but unlike the previously mentioned solutions it will do the same on all of those. See Setuid Demystified for more information on the issues with setuid and friends.
FUNCTIONS
getresuid
Returns a list of the real UID, the effective UID, and the saved set-user-ID of the calling process.
setresuid
setresuid() sets the real user ID, the effective user ID, and the saved set-user-ID of the calling process.
Unprivileged user processes may change the real UID, effective UID, and saved set-user-ID, each to one of: the current real UID, the current effective UID or the current saved set-user-ID. Privileged processes may set the real UID, effective UID, and saved set-user-ID to arbitrary values. If one of the arguments equals -1, the corresponding value is not changed.
getresgid
Returns a list of the real GID, the effective GID, and the saved set-user-ID of the calling process.
setresgid
Completely analogously to setresuid, setresgid() sets the real GID, effective GID, and saved set-group-ID of the calling process, with the same restrictions for unprivileged processes. Note that privilegedness does not depend on any GID value.
ERRORS
These functions don't throw exceptions, but rather return undef/empty list and set $! to an appropriate value. Possible values include:
Operation not permitted (EPERM)
The calling process is not privileged and tried to change the IDs to values that are not permitted.
Resource temporarily unavailable (EAGAIN)
The new real uid does not match the current real UID and this call would bring that user ID over its RLIMIT_NPROC resource limit.
ACKNOWLEDGEMENTS
Large parts of this documentation are taken from linux' manpages on these functions.
AUTHOR
Leon Timmermans <leont@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.