summaryrefslogtreecommitdiff
path: root/plugins/password/drivers/xmail.php
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-03-31 12:25:48 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2012-03-31 12:25:48 +0000
commite6d8f97bf2e0bbb4d95df0c4e030eb7ec6ef75a5 (patch)
tree4f6fdadb51cbe1a2bb3b2b06c9bcabb0429d1a84 /plugins/password/drivers/xmail.php
parent868c169e2a64c1d19a9b6bbcd98f268808dfd173 (diff)
Move plugins repository into roundcubemail root folder; svn:externals are not defined anymore
git-svn-id: https://svn.roundcube.net/trunk@6034 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/password/drivers/xmail.php')
-rw-r--r--plugins/password/drivers/xmail.php106
1 files changed, 0 insertions, 106 deletions
diff --git a/plugins/password/drivers/xmail.php b/plugins/password/drivers/xmail.php
deleted file mode 100644
index 33a49ffe3..000000000
--- a/plugins/password/drivers/xmail.php
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-/**
- * XMail Password Driver
- *
- * Driver for XMail password
- *
- * @version 2.0
- * @author Helio Cavichiolo Jr <helio@hcsistemas.com.br>
- *
- * Setup xmail_host, xmail_user, xmail_pass and xmail_port into
- * config.inc.php of password plugin as follows:
- *
- * $rcmail_config['xmail_host'] = 'localhost';
- * $rcmail_config['xmail_user'] = 'YourXmailControlUser';
- * $rcmail_config['xmail_pass'] = 'YourXmailControlPass';
- * $rcmail_config['xmail_port'] = 6017;
- *
- */
-
-class rcube_xmail_password
-{
- function save($currpass, $newpass)
- {
- $rcmail = rcmail::get_instance();
- list($user,$domain) = explode('@', $_SESSION['username']);
-
- $xmail = new XMail;
-
- $xmail->hostname = $rcmail->config->get('xmail_host');
- $xmail->username = $rcmail->config->get('xmail_user');
- $xmail->password = $rcmail->config->get('xmail_pass');
- $xmail->port = $rcmail->config->get('xmail_port');
-
- if (!$xmail->connect()) {
- raise_error(array(
- 'code' => 600,
- 'type' => 'php',
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Password plugin: Unable to connect to mail server"
- ), true, false);
- return PASSWORD_CONNECT_ERROR;
- }
- else if (!$xmail->send("userpasswd\t".$domain."\t".$user."\t".$newpass."\n")) {
- $xmail->close();
- raise_error(array(
- 'code' => 600,
- 'type' => 'php',
- 'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Password plugin: Unable to change password"
- ), true, false);
- return PASSWORD_ERROR;
- }
- else {
- $xmail->close();
- return PASSWORD_SUCCESS;
- }
- }
-}
-
-class XMail {
- var $socket;
- var $hostname = 'localhost';
- var $username = 'xmail';
- var $password = '';
- var $port = 6017;
-
- function send($msg)
- {
- socket_write($this->socket,$msg);
- if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") {
- return false;
- }
- return true;
- }
-
- function connect()
- {
- $this->socket = socket_create(AF_INET, SOCK_STREAM, 0);
- if ($this->socket < 0)
- return false;
-
- $result = socket_connect($this->socket, $this->hostname, $this->port);
- if ($result < 0) {
- socket_close($this->socket);
- return false;
- }
-
- if (substr($in = socket_read($this->socket, 512, PHP_BINARY_READ),0,1) != "+") {
- socket_close($this->socket);
- return false;
- }
-
- if (!$this->send("$this->username\t$this->password\n")) {
- socket_close($this->socket);
- return false;
- }
- return true;
- }
-
- function close()
- {
- $this->send("quit\n");
- socket_close($this->socket);
- }
-}
-