summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/password/README16
-rw-r--r--plugins/password/config.inc.php.dist9
-rw-r--r--plugins/password/drivers/ximss.php81
3 files changed, 102 insertions, 4 deletions
diff --git a/plugins/password/README b/plugins/password/README
index ac725f844..c7e8203ad 100644
--- a/plugins/password/README
+++ b/plugins/password/README
@@ -32,6 +32,7 @@
2.4. LDAP (ldap)
2.5. DirectAdmin Control Panel
2.6. cPanel
+ 2.7. XIMSS (Communigate)
3. Driver API
@@ -157,8 +158,8 @@
2.3. Poppassd/Courierpassd (poppassd)
-------------------------------------
- You can specify which host to connect to via `password_pop_host` and
- what port via `password_pop_port`. See config.inc.php file for more info.
+ You can specify which host to connect to via 'password_pop_host' and
+ what port via 'password_pop_port'. See config.inc.php file for more info.
2.4. LDAP (ldap)
@@ -170,8 +171,8 @@
2.5. DirectAdmin Control Panel
-------------------------------------
- You can specify which host to connect to via `password_directadmin_host`
- and what port via `password_direactadmin_port`. See config.inc.php file
+ 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.
@@ -182,6 +183,13 @@
interface. See config.inc.php file for more info.
+ 2.7. XIMSS (Communigate)
+ -------------------------------------
+
+ 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.
+
+
3. Driver API
-------------
diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist
index d3119487a..b9e3b9102 100644
--- a/plugins/password/config.inc.php.dist
+++ b/plugins/password/config.inc.php.dist
@@ -179,4 +179,13 @@ $rcmail_config['password_cpanel_ssl'] = true;
// The cPanel theme in use
$rcmail_config['password_cpanel_theme'] = 'x';
+
+// XIMSS (Communigate server) Driver options
+// -----------------------------------------
+// Host name of the Communigate server
+$rcmail_config['password_ximss_host'] = 'mail.example.com';
+
+// XIMSS port on Communigate server
+$rcmail_config['password_ximss_port'] = 11024;
+
?>
diff --git a/plugins/password/drivers/ximss.php b/plugins/password/drivers/ximss.php
new file mode 100644
index 000000000..94aba1874
--- /dev/null
+++ b/plugins/password/drivers/ximss.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Communigate driver for the Password Plugin for Roundcube
+ *
+ * Tested with Communigate Pro 5.1.2
+ *
+ * Configuration options:
+ * password_ximss_host - Host name of Communigate server
+ * password_ximss_port - XIMSS port on Communigate server
+ *
+ *
+ * References:
+ * http://www.communigate.com/WebGuide/XMLAPI.html
+ *
+ * @version 1
+ * @author Erik Meitner <erik wanderings.us>
+ */
+
+function password_save($pass, $newpass)
+{
+
+ $rcmail = rcmail::get_instance();
+
+ $sock = stream_socket_client("tcp://".$rcmail->config->get('password_ximss_host').":".$rcmail->config->get('password_ximss_port'), $errno, $errstr, 30) ;
+ if( $sock === FALSE )
+ {
+ return PASSWORD_CONNECT_ERROR;
+ }
+
+ // send all requests at once(pipelined)
+ fwrite( $sock, '<login id="A001" authData="'.$_SESSION['username'].'" password="'.$pass.'" />'."\0");
+ fwrite( $sock, '<passwordModify id="A002" oldPassword="'.$pass.'" newPassword="'.$newpass.'" />'."\0");
+ fwrite( $sock, '<bye id="A003" />'."\0");
+
+ //example responses
+ // <session id="A001" urlID="4815-vN2Txjkggy7gjHRD10jw" userName="user@example.com"/>\0
+ // <response id="A001"/>\0
+ // <response id="A002"/>\0
+ // <response id="A003"/>\0
+ // or an error:
+ // <response id="A001" errorText="incorrect password or account name" errorNum="515"/>\0
+
+ $responseblob = '';
+ while (!feof($sock)) {
+ $responseblob .= fgets($sock, 1024);
+ }
+
+ fclose($sock);
+
+ foreach( explode( "\0",$responseblob) as $response )
+ {
+ $resp = simplexml_load_string("<xml>".$response."</xml>");
+
+ if( $resp->response[0]['id'] == 'A001' )
+ {
+ if( isset( $resp->response[0]['errorNum'] ) )
+ {
+ return PASSWORD_CONNECT_ERROR;
+ }
+ }
+ else if( $resp->response[0]['id'] == 'A002' )
+ {
+ if( isset( $resp->response[0]['errorNum'] ))
+ {
+ return PASSWORD_ERROR;
+ }
+ }
+ else if( $resp->response[0]['id'] == 'A003' )
+ {
+ if( isset($resp->response[0]['errorNum'] ))
+ {
+ //There was a problem during logout(This is probably harmless)
+ }
+ }
+ } //foreach
+
+ return PASSWORD_SUCCESS;
+
+}
+
+?> \ No newline at end of file