Authen-PAM
view release on metacpan or search on metacpan
The pam_end function will be called automatically when the object is no
longer referenced.
=head2 Examples
Here is an example of using PAM for changing the password of the current
user:
use Authen::PAM;
$login_name = getpwuid($<);
pam_start("passwd", $login_name, $pamh);
pam_chauthtok($pamh);
pam_end($pamh);
or the same thing but using OO style:
$pamh = new Authen::PAM("passwd", $login_name);
$pamh->pam_chauthtok;
The pam_end function will be called automatically when the object is no
longer referenced.
=head2 Examples
Here is an example of using PAM for changing the password of the current
user:
use Authen::PAM;
$login_name = getpwuid($<);
pam_start("passwd", $login_name, $pamh);
pam_chauthtok($pamh);
pam_end($pamh);
or the same thing but using OO style:
$pamh = new Authen::PAM("passwd", $login_name);
$pamh->pam_chauthtok;
my $delay = shift;
# print "Status: $fd_status, Delay: $delay\n";
}
{
my ($pamh, $item);
my $res = -1;
my $pam_service = "login";
my $login_name = getpwuid($<);
my $tty_name = ttyname(fileno(STDIN)) or
die "Can't obtain the tty name!\n";
# $res = pam_start($pam_service, $login_name, \&Authen::PAM::pam_default_conv, $pamh);
if ($login_name) {
print
"---- The remaining tests will be run for service '$pam_service', ",
"user '$login_name' and\n---- device '$tty_name'.\n";
$res = pam_start($pam_service, $login_name, $pamh);
( run in 0.333 second using v1.01-cache-2.11-cpan-8d75d55dd25 )