commit | author | age
|
6bd74d
|
1 |
<?php |
A |
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 1.0 |
|
16 |
* @author Thomas Bruederli |
|
17 |
*/ |
|
18 |
|
|
19 |
function password_save($currpass, $newpass) |
|
20 |
{ |
|
21 |
$curdir = realpath(dirname(__FILE__)); |
|
22 |
$username = escapeshellcmd($_SESSION['username']); |
9da5ed
|
23 |
$args = rcmail::get_instance()->config->get('password_saslpasswd_args', ''); |
6bd74d
|
24 |
|
9da5ed
|
25 |
if ($fh = popen("$curdir/chgsaslpasswd -p $args $username", 'w')) { |
6a765a
|
26 |
fwrite($fh, $newpass."\n"); |
6bd74d
|
27 |
$code = pclose($fh); |
A |
28 |
|
6a765a
|
29 |
if ($code == 0) |
T |
30 |
return PASSWORD_SUCCESS; |
|
31 |
} |
|
32 |
else { |
|
33 |
raise_error(array( |
6bd74d
|
34 |
'code' => 600, |
6a765a
|
35 |
'type' => 'php', |
T |
36 |
'file' => __FILE__, |
|
37 |
'message' => "Password plugin: Unable to execute $curdir/chgsaslpasswd" |
|
38 |
), true, false); |
|
39 |
} |
6bd74d
|
40 |
|
A |
41 |
return PASSWORD_ERROR; |
|
42 |
} |
|
43 |
|
|
44 |
?> |