diff options
author | Aleksander Machniak <alec@alec.pl> | 2015-02-26 18:19:44 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2015-02-26 18:19:44 +0100 |
commit | 1d09ee0ce6d50d122352bfde66828d70cd7ed57b (patch) | |
tree | f4d87d00424813190784ccd111a7451849bc0a7e /plugins | |
parent | b59b72cc3028cc0514e951f135d8bfe7efcaaa6f (diff) |
Added 'kpasswd' driver by Peter Allgeyer
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/password/README | 9 | ||||
-rw-r--r-- | plugins/password/config.inc.php.dist | 6 | ||||
-rw-r--r-- | plugins/password/drivers/kpasswd.php | 45 |
3 files changed, 60 insertions, 0 deletions
diff --git a/plugins/password/README b/plugins/password/README index 8c3a2afbd..b883211bb 100644 --- a/plugins/password/README +++ b/plugins/password/README @@ -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 ------------- diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist index cf021020f..18144996f 100644 --- a/plugins/password/config.inc.php.dist +++ b/plugins/password/config.inc.php.dist @@ -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'; diff --git a/plugins/password/drivers/kpasswd.php b/plugins/password/drivers/kpasswd.php new file mode 100644 index 000000000..ce245b315 --- /dev/null +++ b/plugins/password/drivers/kpasswd.php @@ -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; + } +} |