Manipulate standard Unix passwd files.
Usage Example:
1 $passwd = &File_Passwd::factory('Unix');
2 $passwd->setFile('/my/passwd/file');
3 $passwd->load();
4 $passwd->addUser('mike', 'secret');
5 $passwd->save();
Output of listUser()
array + user => array + pass => crypted_passwd or 'x' if shadowed + uid => user id + gid => group id + gecos => comments + home => home directory + shell => standard shell
array + user => array + 0 => crypted_passwd + 1 => ... + 2 => ...
Located in Program_Root/Passwd/Unix.php (line 68)
File_Passwd_Common | --File_Passwd_Unix
Inherited from File_Passwd_Common
File_Passwd_Common::$_contents
File_Passwd_Common::$_file
File_Passwd_Common::$_users
Constructor
Add an user
The username must start with an alphabetical character and must NOT contain any other characters than alphanumerics, the underline and dash.
If you use the 'name map' you should also use these naming in the supplied extra array, because your values would get mixed up if they are in the wrong order, which is always true if you DON'T use the 'name map'!
So be warned and USE the 'name map'!
If the passwd file is shadowed, the user will be added though, but with an 'x' as password, and a PEAR_Error will be returned, too.
Returns a PEAR_Error if:
Change the password of a certain user
Returns a PEAR_Error if:
Get the 'name map' which is used for the extra properties of the user
Get actual encryption mode
If the passwords of this passwd file are shadowed in another file.
Get supported encryption modes
array + md5 + des
Modify properties of a certain user
Returns a PEAR_Error if:
Parse the Unix password file
Returns a PEAR_Error if passwd file has invalid format.
Apply changes an rewrite passwd file
Returns a PEAR_Error if:
Set the 'name map' to use with the extra properties of the user
This map is used for naming the associative array of the extra properties.
Returns a PEAR_Error if $map was not of type array.
Set the encryption mode
Supported encryption modes are des and md5.
Returns a PEAR_Error if supplied encryption mode is not supported.
Whether to use the 'name map' of the extra properties or not
Default Unix passwd files look like:
user:password:user_id:group_id:home_dir:shell
The default 'name map' for properties except user and password looks like:
Verify the password of a certain user
Returns a PEAR_Error if:
Generate crypted password from the plaintext password
Returns a PEAR_Error if actual encryption mode is not supported.
Inherited From File_Passwd_Common
File_Passwd_Common::delUser()
File_Passwd_Common::getFile()
File_Passwd_Common::listUser()
File_Passwd_Common::load()
File_Passwd_Common::parse()
File_Passwd_Common::save()
File_Passwd_Common::setFile()
File_Passwd_Common::userExists()
File_Passwd_Common::_close()
File_Passwd_Common::_open()
File_Passwd_Common::_save()
File_Passwd_Common::__clone()
File_Passwd_Common::__construct()
Documention generated on Sat, 20 Sep 2003 16:14:43 +0200 by phpDocumentor 1.2.1