Rechercher une page de manuel
NOCpulse::SetID.3pm
Langue: en
Version: 2009-02-09 (fedora - 04/07/09)
Section: 3 (Bibliothèques de fonctions)
NAME
NOCpulse::SetID - Set user and group IDs and revertSYNOPSIS
use NOCpulse::SetID; # Create a new identity my $identity = NOCpulse::SetID->new( user => 'nocpulse'); # Temporarily set credentials $identity->su(); # Set IDs to $identity's IDs # ... reduced-privilege code goes here $identity->revert(); # Revert to credentials before su() # Permanently set IDs to $identity (revert not possible) $identity->su(permanent => 1);
DESCRIPTION
NOCpulse::SetID allows a process to change its credentials by setting real and effective user and group IDs, supplemental group memberships, and user-related environment variables ($HOME, $LOGNAME, $SHELL, $USER, $USERNAME, and $PATH).METHODS
- new()
- Create a new identity. Without arguments, new() takes all parameters from the current environment. With a 'user' argument, new() takes all parameters from the user's passwd and group entries. In either case, you can override individual parameters. The full syntax is:
my $identity = new ( [user => $username,] [ruid => $username_or_uid,] [euid => $username_or_uid,] [rgid => $groupname_or_gid,] [egid => $groupname_or_gid,] [groups => \@groupnames_or_gids,] [env => \%env_hash,] );
- su()
- Become the new identity. Without arguments, su() temporarily changes to the new identity; the identity that was in effect when su() was called can be restored by calling revert(). With the 'permanent' argument set to a true value, su() will switch to the new identity permanently, and revert() will generate a fatal error if called.
- revert()
- Switch back to the previous identity. When you call su(), the function stores the current identity (real and effective UIDs and GIDs, supplemental group memberships, and user-related environment variables) in the object, unless the 'permanent' argument is supplied. revert() switches back to the stored identity.
EXPORTS
None.AUTHOR
Dave Faraldo <dfaraldo@redhat.com>SEE ALSO
perl, perlvars, EnglishContenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre