File_Passwd::staticAuth
Synopsis
mixed File_Passwd::staticAuth (
string $type
, string $file
, string $user
, string $pass
, mixed $opt = ''
)
Description
Static user autentication.
Though this approach should be reasonable fast, it is NOT with APR compatible MD5 encryption used for htpasswd style password files encrypted in MD5.
Generating one MD5 password takes about 0.25 seconds!
Depending on $type
,
$opt
should be:
-
Smb:
- encryption method (NT or LM)
-
Unix:
- encryption method (des or md5)
-
Authbasic:
- encryption method (des, sha or md5)
-
Authdigest:
- the realm the user is in
-
Cvs:
- n/a (empty)
-
Custom:
- array of 2 elements: encryption function and delimiter
Parameter
-
string
$type
-
Unix, Cvs, Smb, Authbasic or Authdigest
-
string
$file
-
path to passwd file
-
string
$user
-
the user to authenticate
-
string
$pass
-
the plaintext password
-
mixed
$opt
-
-
Smb:
- nt | lm
-
Unix:
- des | md5
-
Authbasic:
- des | sha | md5
-
Authdigest:
- the realm the user is in
-
Cvs:
- n/a (empty)
-
Custom:
- array of 2 elements: encryption function and delimiter
-
Return value
Returns TRUE if authenticated, FALSE if not, or PEAR_Error on failure.
Error Code | Summary |
---|---|
FILE_PASSWD_E_NOT_EXISTS | passwd file doesn't exist |
FILE_PASSWD_E_FILE_NOT_OPENED | passwd file couldn't be opened in read mode |
FILE_PASSWD_E_FILE_NOT_LOCKED | passwd file couldn't be locked shared |
FILE_PASSWD_E_FILE_NOT_UNLOCKED | passwd file couldn't be unlocked (only if auth fails) |
FILE_PASSWD_E_FILE_NOT_CLOSED | passwd file couldn't be closed /only if auth fails) |
FILE_PASSWD_E_UNDEFINED | if class/file couldn't be loaded |
FILE_PASSWD_E_INVALID_ENC_MODE | supplied encryption mode is not supported |
FILE_PASSWD_E_USER_NOT_IN_REALM | user doesn't exist in this realm (only File_Passwd_Authdigest) |
Note
This function should be called statically.