Hi Everyone! First port here. Hopefuly this will benefit alot of people. And by the way, thank you so much for this Roundcube project. I just love the interface.
Here is what needs to be changed and modified to get the change password patch from IQPlay to work with courierpassd on port 106 for those of us that does not use cPanel or MySql with IMAP. This works with Qmail and vpopmail. Perhaps IQPlay can add it to his patch? I just did what was suggested and use the Squirrelmail plugin and modify it to work with RoundCube.
Here is the modified code for db.inc.php. There are basically two lines that were added, the last two; the first was the IP address of your IMAP/POP server and the other is the port your server is listening on, this is usually 106. Then you'll see another option to add, which is 'change_pwd_for_poppass'.
// The 'change_pwd_proc' can be 'change_pwd_for_db' or 'change_pwd_for_cpanel' or 'change_pwd_for_poppass' now,
// If 'change_pwd_for_cpanel' is selected, the value of 'db_imap_xxxxxx' is omitted
$rcmail_config['change_pwd_proc'] = 'change_pwd_for_poppass';
$rcmail_config['db_imap_dsn'] = 'mysql://ic_webmail:roundcube@localhost/roundcube';
$rcmail_config['db_imap_users_table'] = 'accountuser';
$rcmail_config['db_imap_user_field'] = 'username';
$rcmail_config['db_imap_passwd_field'] = 'password';
$rcmail_config['db_imap_passwd_type'] = ''; // '' (Plaintext), 'PASSWORD', 'MD5CRYPT', or 'ENCRYPT'
$rcmail_config['poppass_server'] = 'xxx.xxx.xxx.xxx';
$rcmail_config['poppass_port'] = '106';
Next you'll need to add three functions to the passwd.inc file. The first section is the actual code to change the password. You'll want to add it just after the function change_pwd_for_db section but before 'you may not change the code below' lines
function change_pwd_for_poppass($curpasswd, $newpasswd)
{
global $username, $CONFIG;
$poppass_server = $CONFIG['poppass_server'];
$poppass_port = $CONFIG['poppass_port'];
$pop_socket = fsockopen($poppass_server, $poppass_port);
if (!$pop_socket) {
return FALSE;
}
change_pass_readfb($pop_socket, $result);
if(!preg_match('/^2\d\d/', $result) ) {
change_pass_closeport($pop_socket);
return FALSE;
}
fputs($pop_socket, "user $username\r\n");
change_pass_readfb($pop_socket, $result);
if(!preg_match('/^[23]\d\d/', $result) ) {
change_pass_closeport($pop_socket);
return FASLSE;
}
fputs($pop_socket, "pass $curpasswd\r\n");
change_pass_readfb($pop_socket, $result);
if(!preg_match('/^[23]\d\d/', $result) ) {
change_pass_closeport($pop_socket);
return FALSE;
}
fputs($pop_socket, "newpass $newpasswd\r\n");
change_pass_readfb($pop_socket, $result);
change_pass_closeport($pop_socket);
if(!preg_match('/^2\d\d/', $result) ) {
return FALSE;
}
return TRUE;
}
Then add the following two function code to the end of the file just above //add some labels to client
function change_pass_closeport($pop_socket, &$messages) {
if ($debug) {
array_push($messages, _("Closing Connection"));
}
fputs($pop_socket, "quit\r\n");
fclose($pop_socket);
}
function change_pass_readfb($pop_socket, &$result, &$messages) {
$strResp = '';
$result = '';
if (!feof($pop_socket)) {
$strResp = fgets($pop_socket, 1024);
$result = substr(trim($strResp), 0, 3); // 200, 500
if(!preg_match('/^[23]\d\d/', $result) || $debug) {
$messages[] = "--> $strResp";
}
}
}
That's it. Simple as that.
Bryan