/usr/share/horde/passwd/lib/Driver/Adsi.php is in php-horde-passwd 5.0.2-3+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | <?php
/**
* Copyright 2004-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @category Horde
* @copyright 2004-2014 Horde LLC
* @license http://www.horde.org/licenses/gpl GPL
* @package Passwd
*/
/**
* The ADSI class changes a user's password on any Windows Machine/NT-Domain
* using the ADSI COM Interface.
*
* NOTES:
*
* - If you plan to implement passwd over Active Direcory you must use the
* LDAP driver and not this one! This driver is designed for standalone
* machines or NT4 domains, only.
*
* - The host server must be Win32 with ADSI support.
*
* Sample backend configuration:
* <code>
* $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'
* )
* )
* </code>
*
* Backend parameters:
* target = Target Windows machine/domain name (Required)
*
* @author Luiz R Malheiros <malheiros@gmail.com>
* @category Horde
* @copyright 2004-2014 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));
}
}
}
|