Authen::SimplePam is a simple Perl interface to PAM authentication.
SYNOPSIS
use Authen::SimplePam;
$auth = new Authen::PAM;
$auth->auth_user( $user, $password, $service );
$auth->change_password ( $user, $old_password, $new_password );
This module simplifies the use of PAM to Authenticate users. It makes things simple so that no PAM knowledge is necessary.
API
The API is simple:
new
Creates a Authen::SimplePam object.
username ( $username )
If the parameter $username is set, it sets the username. It will return the current username.
user ( $username )
Same as username().
name ( $username )
Same as username().
current_password ( $password )
The user current password. If $password is given, the password is set. It will return the current set password.
password ( $password )
Same as current_password().
old_password( $password )
Same as current_password().
new_password ( $password )
If $password is present, it will set the user new password. It returns the current set new password.
service ( $service )
If $service is given, it will set the PAM service to use. It will return the current service set.
pam_result ()
Returns the last PAM result code.
error_code ()
Returns undef if no error has happened, otherwise returns the error code.
error_message ()
Returns undef if no error has happened, otherwise returns the error message.
Note that the error message is the pam message give to a PAM_ERROR_MSG call.
Other error might have happened, but did not set PAM_ERROR_MSG, but is in the result code from the functions auth_user () and change_password ().
auth_user ($user, $password, $service)
Authenticates a user $user, with the passwod $password agains service $service.
Note that $user, $password and $service are optional. If given they will overwrite any previously given one.
If no $serice has being yet specified, it will defaults to the service 'login'.
If no $username has being yet specified, it will defaults to the current EFECTIVE USER ID (EUID).
It will return Authen::SimplePam own result code. If you would like to know the real PAM result code, use pam_result() to get it.
To get and string representation of the result, use result2string () .
result2string ($result)
Converts a result returned by auth_user() or change_password () to a string.
Product's homepage
Requirements:
· Perl