|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00029 if (!defined('MOODLE_INTERNAL')) { 00030 die('Direct access to this script is forbidden.'); 00031 } 00032 00033 require_once($CFG->libdir.'/authlib.php'); 00034 00038 class auth_plugin_pam extends auth_plugin_base { 00039 00043 var $lasterror; 00044 00048 function auth_plugin_pam() { 00049 $this->authtype = 'pam'; 00050 $this->config = get_config('auth/pam'); 00051 $this->errormessage = ''; 00052 } 00053 00062 function user_login ($username, $password) { 00063 // variable to store possible errors during authentication 00064 $errormessage = str_repeat(' ', 2048); 00065 00066 // just for testing and debugging 00067 // error_reporting(E_ALL); 00068 00069 // call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth 00070 //if (pam_auth($username, $password, &$errormessage)) { 00071 if (pam_auth($username, $password)) { 00072 return true; 00073 } 00074 else { 00075 $this->lasterror = $errormessage; 00076 return false; 00077 } 00078 } 00079 00080 function prevent_local_passwords() { 00081 return true; 00082 } 00083 00089 function is_internal() { 00090 return false; 00091 } 00092 00099 function can_change_password() { 00100 return false; 00101 } 00102 00111 function config_form($config, $err, $user_fields) { 00112 include "config.html"; 00113 } 00114 00118 function process_config($config) { 00119 return true; 00120 } 00121 00122 } 00123 00124