18 include_once (
"WHAT/Class.Provider.php");
22 private function readPwdFile($pwdfile)
24 $fh = fopen($pwdfile,
'r');
26 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: opening file " . $pwdfile);
31 while (
$line = fgets($fh)) {
32 $el = explode(
':',
$line);
33 if (count($el) != 2) {
36 $passwd{$el[0]} = trim($el[1]);
46 static $pwdFile =
false;
48 if (!array_key_exists(
'authfile', $this->parms)) {
49 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: authfile parm is not defined at __construct");
54 if ($pwdFile ===
false) $pwdFile = $this->readPwdFile($this->parms{
'authfile'});
55 if ($pwdFile ===
false) {
56 error_log(__CLASS__ .
"::" . __FUNCTION__ .
" " .
"Error: reading authfile " . $this->parms{
'authfile'});
61 if (!array_key_exists($username, $pwdFile)) {
65 $ret = preg_match(
"/^(..)/", $pwdFile[$username], $salt);
71 if ($pwdFile[$username] == crypt(
$password, $salt[0])) {