Mercurial > hg > rc1
comparison plugins/password/drivers/chpasswd.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 * chpasswd driver | |
| 5 * | |
| 6 * Driver that adds functionality to change the systems user password via | |
| 7 * the 'chpasswd' command. | |
| 8 * | |
| 9 * For installation instructions please read the README file. | |
| 10 * | |
| 11 * @version 2.0 | |
| 12 * @author Alex Cartwright <acartwright@mutinydesign.co.uk> | |
| 13 * | |
| 14 * Copyright (C) 2005-2013, The Roundcube Dev Team | |
| 15 * | |
| 16 * This program is free software: you can redistribute it and/or modify | |
| 17 * it under the terms of the GNU General Public License as published by | |
| 18 * the Free Software Foundation, either version 3 of the License, or | |
| 19 * (at your option) any later version. | |
| 20 * | |
| 21 * This program is distributed in the hope that it will be useful, | |
| 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 24 * GNU General Public License for more details. | |
| 25 * | |
| 26 * You should have received a copy of the GNU General Public License | |
| 27 * along with this program. If not, see http://www.gnu.org/licenses/. | |
| 28 */ | |
| 29 | |
| 30 class rcube_chpasswd_password | |
| 31 { | |
| 32 public function save($currpass, $newpass) | |
| 33 { | |
| 34 $cmd = rcmail::get_instance()->config->get('password_chpasswd_cmd'); | |
| 35 $username = $_SESSION['username']; | |
| 36 | |
| 37 $handle = popen($cmd, "w"); | |
| 38 fwrite($handle, "$username:$newpass\n"); | |
| 39 | |
| 40 if (pclose($handle) == 0) { | |
| 41 return PASSWORD_SUCCESS; | |
| 42 } | |
| 43 else { | |
| 44 rcube::raise_error(array( | |
| 45 'code' => 600, | |
| 46 'type' => 'php', | |
| 47 'file' => __FILE__, 'line' => __LINE__, | |
| 48 'message' => "Password plugin: Unable to execute $cmd" | |
| 49 ), true, false); | |
| 50 } | |
| 51 | |
| 52 return PASSWORD_ERROR; | |
| 53 } | |
| 54 } |
