File::LckPwdF

File::LckPwdF is a Perl module to lock and unlock the passwd and shadow files with lckpwdf and ulckpwdf.
Download

File::LckPwdF Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • E. Allen Smith
  • Publisher web site:
  • http://search.cpan.org/~allens/File-LckPwdF-0.01/LckPwdF.pm

File::LckPwdF Tags


File::LckPwdF Description

File::LckPwdF is a Perl module to lock and unlock the passwd and shadow files with lckpwdf and ulckpwdf. File::LckPwdF is a Perl module to lock and unlock the passwd and shadow files with lckpwdf and ulckpwdf.SYNOPSIS use File::LckPwdF; (lock_passwd(15)) || (die "Can't lock password file:n$! stopped"); # ... do stuff with the passwd file ... (unlock_passwd()) || (die "Can't unlock password file:n$! stopped");This is a perl module to use lckpwdf(3) and ulckpwdf(3) to lock the /etc/passwd and (if present) /etc/shadow files.Functions exported automaticallylock_passwd($timeout)$timeout works as follows:1. The initial time is checked. 2. If $timeout is 0, it tries lckpwdf() until it succeeds, waiting a random time in between. 3. If $timeout is above 0, it tries lckpwdf() once. If that (or any following lckpwdf()) succeeds, it returns 1. It will try lckpwdf() until either it succeeds or the time is greater than the initial time plus $timeout. In the latter case, it returns 0. It waits a random time in between tries of lckpwdf().The random timeout is controlled by $File::LckPwdF::Rand_Wait, which is exported on request. It is used via sleep int(rand($Rand_Wait) + 1);inside an until loop. This sleep is only done if $File::LckPwdF::Rand_Wait is above 0.$timeout defaults to $File::LckPwdF::Default_Timeout, which is also exported on request; the initial setting of $File::LckPwdF::Default_Timeout (the default default) is 15 seconds. The default setting for $File::LckPwdF::Rand_Wait is 10 seconds.unlock_passwd()This function uses ulckpwdf(). If lock_passwd() has previously been used to lock the passwd file, and unlock_passwd() has not been used to lock it, then it will be used to unlock the passwd file in an END: statement. (Admittedly, with many implementations of lckpwdf() this is not necessary, since when a process exits it loses the passwd file lock; it is present as a safety measure for those systems for which this is not true.)Functions exported by requestlckpwdf() ulckpwdf()These are the xs-loaded versions of lckpwdf(3) and ulckpwdf(3), respectively.Requirements:· Perl Requirements: · Perl


File::LckPwdF Related Software