Hello all,
I had the same problem here. I want to setup chpasswd to change linux system password with the 'chpasswd' driver.
Now after my own changes to the chpasswd.php file, I got it working !!
Here is the solution. The lines of php code UNDER the comment '// REMOVED' are the original, I have outcomment the to keep the original in the php file just in case.
The codeline under the line with comment '// FIX...' is the replacement for the original line.
What I did was in the first place, reconstruct what should be happening when executing the change password command on the system. As root:
#echo "test:111" | chpasswd
where test is my mail user and 111 is the new password for this mail user.
In the driver php file ('chpasswd.php' in the plugins/password/driver folder) the change password function is opening a pipe and then the user's name and new password are written to this opened pipe. Unfortunately this is not working the way it should, and I can not figure out why yet. But my fix make the password plugin with chpasswd as driver working.
In this scenario, you also have to config the /etc/sudoers file, so the user your webserver runs under (and therefore roundcube), can execute the chpasswd binary on your system as root. I use Debian lenny over here, and my /etc/sudoers line looks like this:
www-data ALL=NOPASSWD: /usr/sbin/chpasswd
HERE IS THE SOLUTION
for chpasswd.php file (in the plugins/password/drivers folder):
------------------------------------------------------------------
function password_save($currpass, $newpass)
{
$username = $_SESSION['username'];
// REMOVED (ORIGINAL LINE):
// $cmd = rcmail::get_instance()->config->get('password_chpasswd_cmd');
// FIX:
$cmd = "echo '".$username.":".$newpass."' |" . rcmail::get_instance()->config->get('password_chpasswd_cmd');
$handle = popen($cmd, "w");
// REMOVED (ORIGINAL LINE):
// fwrite($handle, "$username:$newpass");
// FIX:
fwrite($handle, "");[/SIZE]
-----------------------------------------------------
Other lines of code do not have to be altered.
Any feedback if it helped will be appreciated !
Cheers,
Erik de Keijzer
The Netherlands