* $backends['adsi'] = array( * 'name' => 'Sample ADSI backend', * 'preferred' => 'localhost', * 'policy' => array( * 'minLength' => 8, * 'maxLength' => 14 * ), * 'driver' => 'adsi', * 'params' => array( * 'target' => 'YOUR_MACHINE/DOMAIN_NAME_HERE' * ) * ) * * * Backend parameters: * target = Target Windows machine/domain name (Required) * * @author Luiz R Malheiros * @category Horde * @copyright 2004-2017 Horde LLC * @license http://www.horde.org/licenses/gpl GPL * @package Passwd */ class Passwd_Driver_Adsi extends Passwd_Driver { /** */ protected function _changePassword($user, $oldpass, $newpass) { if (empty($this->_params['target'])) { throw new Passwd_Exception(_("Password module is missing target parameter.")); } $root = new COM('WinNT:'); $adsi = $root->OpenDSObject( 'WinNT://' . $this->_params['target'] . '/' . $user . ',user', $this->_params['target'] . '\\' . $user, $oldpass, 1 ); if (!$adsi) { throw new Passwd_Exception(_("Access Denied.")); } if ($result = $adsi->ChangePassword($oldpass, $newpass)) { throw new Passwd_Exception(sprintf(_("ADSI error %s."), $result)); } } }