libdir.'/authlib.php'); /** * PAM authentication plugin. */ class auth_plugin_pam extends auth_plugin_base { /** * Store error messages from pam authentication attempts. */ var $lasterror; /** * Constructor. */ function auth_plugin_pam() { $this->authtype = 'pam'; $this->config = get_config('auth/pam'); $this->errormessage = ''; } /** * Returns true if the username and password work and false if they are * wrong or don't exist. * * @param string $username The username (with system magic quotes) * @param string $password The password (with system magic quotes) * @return bool Authentication success or failure. */ function user_login ($username, $password) { // variable to store possible errors during authentication $errormessage = str_repeat(' ', 2048); // just for testing and debugging // error_reporting(E_ALL); // call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth //if (pam_auth($username, $password, &$errormessage)) { if (pam_auth(stripslashes($username), stripslashes($password))) { return true; } else { $this->lasterror = $errormessage; return false; } } function prevent_local_passwords() { return true; } /** * Returns true if this authentication plugin is 'internal'. * * @return bool */ function is_internal() { return false; } /** * Returns true if this authentication plugin can change the user's * password. * * @return bool */ function can_change_password() { return false; } /** * Prints a form for configuring this authentication plugin. * * This function is called from admin/auth.php, and outputs a full page with * a form for configuring this plugin. * * @param array $page An object containing all the data for this page. */ function config_form($config, $err, $user_fields) { include "config.html"; } /** * Processes and stores configuration data for this authentication plugin. */ function process_config($config) { return true; } } ?>