Mercurial > hg > rc1
comparison plugins/password/drivers/vpopmaild.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 * vpopmail Password Driver | |
| 5 * | |
| 6 * Driver to change passwords via vpopmaild | |
| 7 * | |
| 8 * @version 2.0 | |
| 9 * @author Johannes Hessellund | |
| 10 * | |
| 11 * Copyright (C) 2005-2013, The Roundcube Dev Team | |
| 12 * | |
| 13 * This program is free software: you can redistribute it and/or modify | |
| 14 * it under the terms of the GNU General Public License as published by | |
| 15 * the Free Software Foundation, either version 3 of the License, or | |
| 16 * (at your option) any later version. | |
| 17 * | |
| 18 * This program is distributed in the hope that it will be useful, | |
| 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 21 * GNU General Public License for more details. | |
| 22 * | |
| 23 * You should have received a copy of the GNU General Public License | |
| 24 * along with this program. If not, see http://www.gnu.org/licenses/. | |
| 25 */ | |
| 26 | |
| 27 class rcube_vpopmaild_password | |
| 28 { | |
| 29 function save($curpass, $passwd) | |
| 30 { | |
| 31 $rcmail = rcmail::get_instance(); | |
| 32 $vpopmaild = new Net_Socket(); | |
| 33 $host = $rcmail->config->get('password_vpopmaild_host'); | |
| 34 $port = $rcmail->config->get('password_vpopmaild_port'); | |
| 35 | |
| 36 $result = $vpopmaild->connect($host, $port, null); | |
| 37 if (is_a($result, 'PEAR_Error')) { | |
| 38 return PASSWORD_CONNECT_ERROR; | |
| 39 } | |
| 40 | |
| 41 $vpopmaild->setTimeout($rcmail->config->get('password_vpopmaild_timeout'),0); | |
| 42 | |
| 43 $result = $vpopmaild->readLine(); | |
| 44 if(!preg_match('/^\+OK/', $result)) { | |
| 45 $vpopmaild->disconnect(); | |
| 46 return PASSWORD_CONNECT_ERROR; | |
| 47 } | |
| 48 | |
| 49 $vpopmaild->writeLine("slogin ". $_SESSION['username'] . " " . $curpass); | |
| 50 $result = $vpopmaild->readLine(); | |
| 51 | |
| 52 if(!preg_match('/^\+OK/', $result) ) { | |
| 53 $vpopmaild->writeLine("quit"); | |
| 54 $vpopmaild->disconnect(); | |
| 55 return PASSWORD_ERROR; | |
| 56 } | |
| 57 | |
| 58 $vpopmaild->writeLine("mod_user ". $_SESSION['username']); | |
| 59 $vpopmaild->writeLine("clear_text_password ". $passwd); | |
| 60 $vpopmaild->writeLine("."); | |
| 61 $result = $vpopmaild->readLine(); | |
| 62 $vpopmaild->writeLine("quit"); | |
| 63 $vpopmaild->disconnect(); | |
| 64 | |
| 65 if (!preg_match('/^\+OK/', $result)) { | |
| 66 return PASSWORD_ERROR; | |
| 67 } | |
| 68 | |
| 69 return PASSWORD_SUCCESS; | |
| 70 } | |
| 71 } |
