Added 'kpasswd' driver by Peter Allgeyer

pull/229/merge
Aleksander Machniak 10 years ago
parent b59b72cc30
commit 1d09ee0ce6

@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================
- Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization)
- Password plugin: Added 'kpasswd' driver by Peter Allgeyer
- Add possibility to print contact information (of a single contact)
- Add possibility to configure max_allowed_packet value for all database engines (#1490283)
- Improved handling of storage errors after message is sent

@ -44,6 +44,7 @@
2.18. Samba (smb)
2.19. Vpopmail daemon (vpopmaild)
2.20. Plesk (Plesk RPC-API)
2.21. Kpasswd
3. Driver API
@ -301,6 +302,7 @@
Driver to change Samba user password via the 'smbpasswd' command.
See config.inc.php.dist file for configuration description.
2.19. Vpopmail daemon (vpopmaild)
-----------------------------------
@ -330,6 +332,13 @@
Set the RPC-Path in $config['password_plesk_rpc_path']. Normally this is: enterprise/control/agent.php.
2.21. Kpasswd
-----------------------------------
Driver to change the password in Kerberos environments via the 'kpasswd' command.
See config.inc.php.dist file for configuration description.
3. Driver API
-------------

@ -399,3 +399,9 @@ $config['password_plesk_rpc_port'] = '8443';
// Plesk RPC Path
$config['password_plesk_rpc_path'] = 'enterprise/control/agent.php';
// kasswd Driver options
// ---------------------
// Command to use
$config['password_kpasswd_cmd'] = '/usr/bin/kpasswd';

@ -0,0 +1,45 @@
<?php
/**
* kpasswd Driver
*
* Driver that adds functionality to change the systems user password via
* the 'kpasswd' command.
*
* For installation instructions please read the README file.
*
* @version 1.0
* @author Peter Allgeyer <peter.allgeyer@salzburgresearch.at>
*
* Based on chpasswd roundcubemail password driver by
* @author Alex Cartwright <acartwright@mutinydesign.co.uk>
*/
class rcube_kpasswd_password
{
public function save($currpass, $newpass)
{
$bin = rcmail::get_instance()->config->get('password_kpasswd_cmd', '/usr/bin/kpasswd');
$username = $_SESSION['username'];
$cmd = $bin . ' "' . $username . '" 2>&1';
$handle = popen($cmd, "w");
fwrite($handle, $currpass."\n");
fwrite($handle, $newpass."\n");
fwrite($handle, $newpass."\n");
if (pclose($handle) == 0) {
return PASSWORD_SUCCESS;
}
else {
rcube::raise_error(array(
'code' => 600,
'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Password plugin: Unable to execute $cmd"
), true, false);
}
return PASSWORD_ERROR;
}
}
Loading…
Cancel
Save