diff options
Diffstat (limited to 'plugins/password/drivers/sasl.php')
| -rw-r--r-- | plugins/password/drivers/sasl.php | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/plugins/password/drivers/sasl.php b/plugins/password/drivers/sasl.php index f8ac5c606..3e6fe1c8b 100644 --- a/plugins/password/drivers/sasl.php +++ b/plugins/password/drivers/sasl.php @@ -12,33 +12,34 @@ * * For installation instructions please read the README file. * - * @version 1.0 + * @version 2.0 * @author Thomas Bruederli */ - -function password_save($currpass, $newpass) + +class rcube_sasl_password { - $curdir = realpath(dirname(__FILE__)); - $username = escapeshellcmd($_SESSION['username']); - $args = rcmail::get_instance()->config->get('password_saslpasswd_args', ''); + function save($currpass, $newpass) + { + $curdir = realpath(dirname(__FILE__)); + $username = escapeshellcmd($_SESSION['username']); + $args = rcmail::get_instance()->config->get('password_saslpasswd_args', ''); - if ($fh = popen("$curdir/chgsaslpasswd -p $args $username", 'w')) { - fwrite($fh, $newpass."\n"); - $code = pclose($fh); + if ($fh = popen("$curdir/chgsaslpasswd -p $args $username", 'w')) { + fwrite($fh, $newpass."\n"); + $code = pclose($fh); - if ($code == 0) - return PASSWORD_SUCCESS; - } - else { - raise_error(array( - 'code' => 600, - 'type' => 'php', - 'file' => __FILE__, 'line' => __LINE__, - 'message' => "Password plugin: Unable to execute $curdir/chgsaslpasswd" - ), true, false); - } + if ($code == 0) + return PASSWORD_SUCCESS; + } + else { + raise_error(array( + 'code' => 600, + 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Password plugin: Unable to execute $curdir/chgsaslpasswd" + ), true, false); + } - return PASSWORD_ERROR; + return PASSWORD_ERROR; + } } - -?> |
