From 1904fa71046fd1782b9a3b61bd408cf779824500 Mon Sep 17 00:00:00 2001 From: alecpl Date: Fri, 9 Oct 2009 16:04:01 +0000 Subject: - Added XIMSS (Communigate) driver for Password plugin --- CHANGELOG | 1 + plugins/password/README | 16 +++++-- plugins/password/config.inc.php.dist | 9 ++++ plugins/password/drivers/ximss.php | 81 ++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 plugins/password/drivers/ximss.php diff --git a/CHANGELOG b/CHANGELOG index 2d0930c6b..05ca7b064 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG RoundCube Webmail =========================== +- Added XIMSS (Communigate) driver for Password plugin - Fix newly attached files are not saved in drafts w/o editing any text (#1486202) - Added attachment upload indicator with parallel upload (#1486058) - Use default_charset for bodies of messages without charset definition (#1486187) 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 @@ + + */ + +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, ''."\0"); + fwrite( $sock, ''."\0"); + fwrite( $sock, ''."\0"); + + //example responses + // \0 + // \0 + // \0 + // \0 + // or an error: + // \0 + + $responseblob = ''; + while (!feof($sock)) { + $responseblob .= fgets($sock, 1024); + } + + fclose($sock); + + foreach( explode( "\0",$responseblob) as $response ) + { + $resp = simplexml_load_string("".$response.""); + + 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 -- cgit v1.2.3