Manipulate SMB server passwd files.
Usage Example 1 (modifying existing file):
1 $f = &File_Passwd::factory('SMB');
2 $f->setFile('./smbpasswd');
3 $f->load();
4 $f->addUser('sepp3', 'MyPw', array('userid' => 12));
5 $f->changePasswd('sepp', 'MyPw');
6 $f->delUser('karli');
7 foreach($f->listUser() as $user => $data) {
8 echo $user . ':' . implode(':', $data) ."\n";
9 }
10 $f->save();
Usage Example 2 (creating a new file):
1 $f = &File_Passwd::factory('SMB');
2 $f->setFile('./smbpasswd');
3 $f->addUser('sepp1', 'MyPw', array('userid'=> 12));
4 $f->addUser('sepp3', 'MyPw', array('userid' => 1000));
5 $f->save();
Usage Example 3 (authentication):
1 $f = &File_Passwd::factory('SMB');
2 $f->setFile('./smbpasswd');
3 $f->load();
4 if (true === $f->verifyPasswd('sepp', 'MyPw')) {
5 echo "User valid";
6 } else {
7 echo "User invalid or disabled";
8 }
Located in Program_Root/Passwd/Smb.php (line 78)
File_Passwd_Common | --File_Passwd_Smb
Object which generates the NT-Hash and LAN-Manager-Hash passwds
Inherited from File_Passwd_Common
File_Passwd_Common::$_contents
File_Passwd_Common::$_file
File_Passwd_Common::$_users
Constructor
Add a user
Returns a PEAR_Error if the user already exists
Change the passwd of a certain user
Returns a PEAR_Error if $user doesn't exist.
Modify a certain user
You should not modify the password with this method unless it is already encrypted as nthash and lmhash!
Returns a PEAR_Error if:
Parse smbpasswd file
Returns a PEAR_Error if passwd file has invalid format.
Apply changes and rewrite CVS passwd file
Returns a PEAR_Error if:
Verifies a user's password
Prefer NT-Hash instead of weak LAN-Manager-Hash
Returns a PEAR_Error if:
Verifies an account with the given plaintext password
Returns a PEAR_Error if:
Constructor (ZE2)
Rewritten because we want to init our crypt engine.
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