Mercurial > hg > rc1
comparison plugins/password/drivers/sasl.php @ 0:1e000243b222
vanilla 1.3.3 distro, I hope
| author | Charlie Root |
|---|---|
| date | Thu, 04 Jan 2018 15:50:29 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1e000243b222 |
|---|---|
| 1 <?php | |
| 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 * Copyright (C) 2005-2013, The Roundcube Dev Team | |
| 19 * | |
| 20 * This program is free software: you can redistribute it and/or modify | |
| 21 * it under the terms of the GNU General Public License as published by | |
| 22 * the Free Software Foundation, either version 3 of the License, or | |
| 23 * (at your option) any later version. | |
| 24 * | |
| 25 * This program is distributed in the hope that it will be useful, | |
| 26 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 28 * GNU General Public License for more details. | |
| 29 * | |
| 30 * You should have received a copy of the GNU General Public License | |
| 31 * along with this program. If not, see http://www.gnu.org/licenses/. | |
| 32 */ | |
| 33 | |
| 34 class rcube_sasl_password | |
| 35 { | |
| 36 function save($currpass, $newpass) | |
| 37 { | |
| 38 $curdir = RCUBE_PLUGINS_DIR . 'password/helpers'; | |
| 39 $username = escapeshellarg($_SESSION['username']); | |
| 40 $args = rcmail::get_instance()->config->get('password_saslpasswd_args', ''); | |
| 41 | |
| 42 if ($fh = popen("$curdir/chgsaslpasswd -p $args $username", 'w')) { | |
| 43 fwrite($fh, $newpass."\n"); | |
| 44 $code = pclose($fh); | |
| 45 | |
| 46 if ($code == 0) | |
| 47 return PASSWORD_SUCCESS; | |
| 48 } | |
| 49 else { | |
| 50 rcube::raise_error(array( | |
| 51 'code' => 600, | |
| 52 'type' => 'php', | |
| 53 'file' => __FILE__, 'line' => __LINE__, | |
| 54 'message' => "Password plugin: Unable to execute $curdir/chgsaslpasswd" | |
| 55 ), true, false); | |
| 56 } | |
| 57 | |
| 58 return PASSWORD_ERROR; | |
| 59 } | |
| 60 } |
