You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dbmail.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * DBMail Password Driver
  4. *
  5. * Driver that adds functionality to change the users DBMail password.
  6. * The code is derrived from the Squirrelmail "Change SASL Password" Plugin
  7. * by Galen Johnson.
  8. *
  9. * It only works with dbmail-users on the same host where Roundcube runs
  10. * and requires shell access and gcc in order to compile the binary.
  11. *
  12. * For installation instructions please read the README file.
  13. *
  14. * @version 1.0
  15. *
  16. * Copyright (C) 2005-2013, The Roundcube Dev Team
  17. *
  18. * This program is free software: you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License as published by
  20. * the Free Software Foundation, either version 3 of the License, or
  21. * (at your option) any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program. If not, see http://www.gnu.org/licenses/.
  30. */
  31. class rcube_dbmail_password
  32. {
  33. function save($currpass, $newpass)
  34. {
  35. $curdir = RCUBE_PLUGINS_DIR . 'password/helpers';
  36. $username = escapeshellarg($_SESSION['username']);
  37. $password = escapeshellarg($newpass);
  38. $args = rcmail::get_instance()->config->get('password_dbmail_args', '');
  39. $command = "$curdir/chgdbmailusers -c $username -w $password $args";
  40. exec($command, $output, $return_value);
  41. if ($return_value == 0) {
  42. return PASSWORD_SUCCESS;
  43. }
  44. else {
  45. rcube::raise_error(array(
  46. 'code' => 600,
  47. 'type' => 'php',
  48. 'file' => __FILE__, 'line' => __LINE__,
  49. 'message' => "Password plugin: Unable to execute $curdir/chgdbmailusers"
  50. ), true, false);
  51. }
  52. return PASSWORD_ERROR;
  53. }
  54. }