commit | author | age
|
48e9c1
|
1 |
<?php |
T |
2 |
|
|
3 |
/** |
|
4 |
* SASL Password Driver |
|
5 |
* |
|
6 |
* Driver that adds functionality to change the users Cyrus/SASL password. |
|
7 |
* The code is derrived from the Squirrelmail "Change SASL Password" Plugin |
|
8 |
* by Galen Johnson. |
|
9 |
* |
|
10 |
* It only works with saslpasswd2 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 2.0 |
|
16 |
* @author Thomas Bruederli |
|
17 |
*/ |
|
18 |
|
|
19 |
class rcube_sasl_password |
|
20 |
{ |
|
21 |
function save($currpass, $newpass) |
|
22 |
{ |
e2e2e8
|
23 |
$curdir = RCUBE_PLUGINS_DIR . 'password/helpers'; |
48e9c1
|
24 |
$username = escapeshellcmd($_SESSION['username']); |
T |
25 |
$args = rcmail::get_instance()->config->get('password_saslpasswd_args', ''); |
|
26 |
|
|
27 |
if ($fh = popen("$curdir/chgsaslpasswd -p $args $username", 'w')) { |
|
28 |
fwrite($fh, $newpass."\n"); |
|
29 |
$code = pclose($fh); |
|
30 |
|
|
31 |
if ($code == 0) |
|
32 |
return PASSWORD_SUCCESS; |
|
33 |
} |
|
34 |
else { |
61be82
|
35 |
rcube::raise_error(array( |
48e9c1
|
36 |
'code' => 600, |
T |
37 |
'type' => 'php', |
|
38 |
'file' => __FILE__, 'line' => __LINE__, |
|
39 |
'message' => "Password plugin: Unable to execute $curdir/chgsaslpasswd" |
|
40 |
), true, false); |
|
41 |
} |
|
42 |
|
|
43 |
return PASSWORD_ERROR; |
|
44 |
} |
|
45 |
} |