summaryrefslogtreecommitdiff
path: root/plugins/password
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-04-16 11:31:49 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2010-04-16 11:31:49 +0000
commit9dd69b8257550c642443026c704feb8e9067910a (patch)
tree70b4550254c889a8a4df186df105cec85ef52c77 /plugins/password
parent39eda9547488b2600bae2a94a779971bc9353381 (diff)
- Password: added virtualmin driver (#1486398)
git-svn-id: https://svn.roundcube.net/trunk@3498 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/password')
-rw-r--r--plugins/password/README27
-rw-r--r--plugins/password/config.inc.php.dist2
-rw-r--r--plugins/password/drivers/chgvirtualminpasswd.c28
-rw-r--r--plugins/password/drivers/virtualmin.php40
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;
+}
+
+?>