1: <?php
2: /**
3: * The vmailmgr class attempts to change a user's password on a local vmailmgr
4: * daemon
5: *
6: * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (GPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/gpl.php.
10: *
11: * @author Marco Kaiser <bate@php.net>
12: * @package Passwd
13: */
14: class Passwd_Driver_Vmailmgr extends Passwd_Driver
15: {
16: /**
17: * Changes the user's password.
18: *
19: * @param string $username The user for which to change the password.
20: * @param string $old_password The old (current) user password.
21: * @param string $new_password The new user password to set.
22: *
23: * @throws Passwd_Exception
24: */
25: public function changePassword($username, $old_password, $new_password)
26: {
27: if (isset($this->_params['vmailinc']) &&
28: is_readable($this->_params['vmailinc'])) {
29: include $this->_params['vmailinc'];
30: } else {
31: throw new Passwd_Exception('vmail.inc not found! (' . $this->_params['vmailinc'] . ')');
32: }
33:
34: list($username, $domain) = explode('@', $username);
35: $returnChange = vchpass($domain, $old_password, $username, $new_password);
36:
37: if ($returnChange[0]) {
38: throw new Passwd_Exception(_("Incorrect old password."));
39: }
40: }
41: }
42: