Thomas Bruederli
2013-06-20 07c6c69eca8751c0e96a846afb30c24ab2638b1f
commit | author | age
48e9c1 1 <?php
T 2
3 /**
4  * DBMail Password Driver
5  *
6  * Driver that adds functionality to change the users DBMail password.
7  * The code is derrived from the Squirrelmail "Change SASL Password" Plugin
8  * by Galen Johnson.
9  *
10  * It only works with dbmail-users on the same host where Roundcube runs
11  * and requires shell access and gcc in order to compile the binary.
12  *
13  * For installation instructions please read the README file.
14  *
15  * @version 1.0
16  */
17
18 class rcube_dbmail_password
19 {
20     function password_save($currpass, $newpass)
21     {
e2e2e8 22         $curdir   = RCUBE_PLUGINS_DIR . 'password/helpers';
48e9c1 23         $username = escapeshellcmd($_SESSION['username']);
T 24         $args     = rcmail::get_instance()->config->get('password_dbmail_args', '');
25
26         exec("$curdir/chgdbmailusers -c $username -w $newpass $args", $output, $returnvalue);
27
28         if ($returnvalue == 0) {
29             return PASSWORD_SUCCESS;
30         }
31         else {
61be82 32             rcube::raise_error(array(
48e9c1 33                 'code' => 600,
T 34                 'type' => 'php',
35                 'file' => __FILE__, 'line' => __LINE__,
36                 'message' => "Password plugin: Unable to execute $curdir/chgdbmailusers"
37                 ), true, false);
38         }
39
40         return PASSWORD_ERROR;
41     }
42 }