16 include_once (
"WHAT/Class.Provider.php");
19 private function readPwdFile($pwdfile)
21 $fh = fopen($pwdfile,
'r');
23 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: opening file " . $pwdfile);
28 while ($line = fgets($fh)) {
29 $el = explode(
':', $line);
30 if (count($el) != 2) {
33 $passwd{$el[0]} = trim($el[1]);
43 static $pwdFile =
false;
45 if (!array_key_exists(
'authfile', $this->parms)) {
46 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: authfile parm is not defined at __construct");
51 if ($pwdFile ===
false) $pwdFile = $this->readPwdFile($this->parms{
'authfile'});
52 if ($pwdFile ===
false) {
53 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: reading authfile " . $this->parms{
'authfile'});
58 if (!array_key_exists($username, $pwdFile)) {
62 $ret = preg_match(
"/^(..)/", $pwdFile[$username], $salt);
68 if ($pwdFile[$username] == crypt($password, $salt[0])) {
validateCredential($username, $password)