diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/password/README | 27 | ||||
| -rw-r--r-- | plugins/password/config.inc.php.dist | 2 | ||||
| -rw-r--r-- | plugins/password/drivers/chgvirtualminpasswd.c | 28 | ||||
| -rw-r--r-- | plugins/password/drivers/virtualmin.php | 40 |
4 files changed, 87 insertions, 10 deletions
diff --git a/plugins/password/README b/plugins/password/README index c7e8203ad..853e4b38f 100644 --- a/plugins/password/README +++ b/plugins/password/README @@ -30,9 +30,10 @@ 2.2. Cyrus/SASL (sasl) 2.3. Poppassd/Courierpassd (poppassd) 2.4. LDAP (ldap) - 2.5. DirectAdmin Control Panel - 2.6. cPanel - 2.7. XIMSS (Communigate) + 2.5. DirectAdmin Control Panel (directadmin) + 2.6. cPanel (cpanel) + 2.7. XIMSS/Communigate (ximms) + 2.8. Virtualmin (virtualmin) 3. Driver API @@ -168,28 +169,36 @@ See config.inc.php file. Requires PEAR::Net_LDAP2 package. - 2.5. DirectAdmin Control Panel - ------------------------------------- + 2.5. DirectAdmin Control Panel (directadmin) + -------------------------------------------- You can specify which host to connect to via 'password_directadmin_host' and what port via 'password_direactadmin_port'. See config.inc.php file for more info. - 2.6. cPanel - ----------- + 2.6. cPanel (cpanel) + -------------------- You can specify parameters for HTTP connection to cPanel's admin interface. See config.inc.php file for more info. - 2.7. XIMSS (Communigate) - ------------------------------------- + 2.7. XIMSS/Communigate (ximms) + ------------------------------ You can specify which host and port to connect to via 'password_ximss_host' and 'password_ximss_port'. See config.inc.php file for more info. + 2.8. Virtualmin (virtualmin) + ---------------------------- + + As in sasl driver this one allows to change password using shell + utility called "virtualmin". See drivers/chgvirtualminpasswd.c for + installation instructions. + + 3. Driver API ------------- diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist index d87de0514..78d1c4ddb 100644 --- a/plugins/password/config.inc.php.dist +++ b/plugins/password/config.inc.php.dist @@ -3,7 +3,7 @@ // Password Plugin options // ----------------------- // A driver to use for password change. Default: "sql". -// Current possibilities: 'directadmin', 'ldap', 'poppassd', 'sasl', 'sql', 'vpopmaild', 'cpanel' +// See README file for list of supported driver names. $rcmail_config['password_driver'] = 'sql'; // Determine whether current password is required to change password. diff --git a/plugins/password/drivers/chgvirtualminpasswd.c b/plugins/password/drivers/chgvirtualminpasswd.c new file mode 100644 index 000000000..4e2299c66 --- /dev/null +++ b/plugins/password/drivers/chgvirtualminpasswd.c @@ -0,0 +1,28 @@ +#include <stdio.h> +#include <unistd.h> + +// set the UID this script will run as (root user) +#define UID 0 +#define CMD "/usr/sbin/virtualmin" + +/* INSTALLING: + gcc -o chgvirtualminpasswd chgvirtualminpasswd.c + chown root.apache chgvirtualminpasswd + strip chgvirtualminpasswd + chmod 4550 chgvirtualminpasswd +*/ + +main(int argc, char *argv[]) +{ + int rc,cc; + + cc = setuid(UID); + rc = execvp(CMD, argv); + if ((rc != 0) || (cc != 0)) + { + fprintf(stderr, "__ %s: failed %d %d\n", argv[0], rc, cc); + return 1; + } + + return 0; +} diff --git a/plugins/password/drivers/virtualmin.php b/plugins/password/drivers/virtualmin.php new file mode 100644 index 000000000..9d32e3957 --- /dev/null +++ b/plugins/password/drivers/virtualmin.php @@ -0,0 +1,40 @@ +<?php + +/** + * Virtualmin Password Driver + * + * Driver that adds functionality to change the users Virtualmin password. + * The code is derrived from the Squirrelmail "Change Cyrus/SASL Password" Plugin + * by Thomas Bruederli. + * + * It only works with virtualmin on the same host where RoundCube runs + * and requires shell access and gcc in order to compile the binary. + * + * @version 1.0 + * @author Martijn de Munnik + */ + +function password_save($currpass, $newpass) +{ + $curdir = realpath(dirname(__FILE__)); + $username = escapeshellcmd($_SESSION['username']); + $domain = substr(strrchr($username, "@"), 1); + + exec("$curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue); + + if ($returnvalue == 0) { + return PASSWORD_SUCCESS; + } + else { + raise_error(array( + 'code' => 600, + 'type' => 'php', + 'file' => __FILE__, + 'message' => "Password plugin: Unable to execute $curdir/chgvirtualminpasswd" + ), true, false); + } + + return PASSWORD_ERROR; +} + +?> |
