Merge branch 'NETLINK-master'

pull/5193/merge
Aleksander Machniak 8 years ago
commit c614381e9e

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Password/cPanel: Add support for hash authentication and reseller accounts (#5252)
- Support host-specific imap_conn_options/smtp_conn_options/managesieve_conn_options (#5136) - Support host-specific imap_conn_options/smtp_conn_options/managesieve_conn_options (#5136)
- Center and scale images in attachment preview frame (#5421) - Center and scale images in attachment preview frame (#5421)
- Added max_message_size option enforced when attaching files to a composed message (#4993) - Added max_message_size option enforced when attaching files to a composed message (#4993)

@ -25,9 +25,10 @@ $config['password_log'] = false;
// will be not available (no Password tab in Settings) // will be not available (no Password tab in Settings)
$config['password_login_exceptions'] = null; $config['password_login_exceptions'] = null;
// Array of hosts that support password changing. Default is NULL. // Array of hosts that support password changing.
// Listed hosts will feature a Password option in Settings; others will not. // Listed hosts will feature a Password option in Settings; others will not.
// Example: array('mail.example.com', 'mail2.example.org'); // Example: array('mail.example.com', 'mail2.example.org');
// Default is NULL (all hosts supported).
$config['password_hosts'] = null; $config['password_hosts'] = null;
// Enables saving the new password even if it matches the old password. Useful // Enables saving the new password even if it matches the old password. Useful
@ -307,6 +308,12 @@ $config['password_cpanel_username'] = 'username';
// The cPanel admin password // The cPanel admin password
$config['password_cpanel_password'] = 'password'; $config['password_cpanel_password'] = 'password';
// The cPanel admin hash
// If you prefer to use a hash (Remote Access Key) instead of plain password, enter it below.
// Hash takes precedence over password auth.
// You can generate a Remote Access Key in WHM -> Clusters -> Remote Access Key
$config['password_cpanel_hash'] = '';
// The cPanel port to use // The cPanel port to use
$config['password_cpanel_port'] = 2087; $config['password_cpanel_port'] = 2087;

@ -13,10 +13,10 @@
* *
* This driver has been tested with o2switch hosting and seems to work fine. * This driver has been tested with o2switch hosting and seems to work fine.
* *
* @version 3.0 * @version 3.1
* @author Christian Chech <christian@chech.fr> * @author Christian Chech <christian@chech.fr>
* *
* Copyright (C) 2005-2013, The Roundcube Dev Team * Copyright (C) 2005-2016, The Roundcube Dev Team
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -41,11 +41,27 @@ class rcube_cpanel_password
$rcmail = rcmail::get_instance(); $rcmail = rcmail::get_instance();
$this->cuser = $rcmail->config->get('password_cpanel_username'); $this->cuser = $rcmail->config->get('password_cpanel_username');
$cpanel_host = $rcmail->config->get('password_cpanel_host');
$cpanel_port = $rcmail->config->get('password_cpanel_port');
$cpanel_hash = $rcmail->config->get('password_cpanel_hash');
$cpanel_pass = $rcmail->config->get('password_cpanel_password');
// Setup the xmlapi connection // Setup the xmlapi connection
$this->xmlapi = new xmlapi($rcmail->config->get('password_cpanel_host')); $this->xmlapi = new xmlapi($cpanel_host);
$this->xmlapi->set_port($rcmail->config->get('password_cpanel_port')); $this->xmlapi->set_port($cpanel_port);
$this->xmlapi->password_auth($this->cuser, $rcmail->config->get('password_cpanel_password'));
// Hash auth
if (!empty($cpanel_hash)) {
$this->xmlapi->hash_auth($this->cuser, $cpanel_hash);
}
// Pass auth
else if (!empty($cpanel_pass)) {
$this->xmlapi->password_auth($this->cuser, $cpanel_pass);
}
else {
return PASSWORD_ERROR;
}
$this->xmlapi->set_output('json'); $this->xmlapi->set_output('json');
$this->xmlapi->set_debug(0); $this->xmlapi->set_debug(0);
@ -71,7 +87,15 @@ class rcube_cpanel_password
$data['password'] = $password; $data['password'] = $password;
$query = $this->xmlapi->api2_query($this->cuser, 'Email', 'passwdpop', $data); // Get the cPanel user
$query = $this->xmlapi->listaccts('domain', $data['domain']);
$query = json_decode($query, true);
if ( $query['status'] != 1) {
return false;
}
$cpanel_user = $query['acct'][0]['user'];
$query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data);
$query = json_decode($query, true); $query = json_decode($query, true);
$result = $query['cpanelresult']['data'][0]; $result = $query['cpanelresult']['data'][0];

Loading…
Cancel
Save