diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-10-08 12:44:23 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-10-08 12:44:23 +0000 |
commit | 73981ac5dcf9fc3fb54f392b3fb5206d30bbb5c3 (patch) | |
tree | e976f93f4581c17f1af0cff262fdabde3526c129 | |
parent | d15751b149bf4004a212e23b0523394909043876 (diff) | |
download | forums-73981ac5dcf9fc3fb54f392b3fb5206d30bbb5c3.tar forums-73981ac5dcf9fc3fb54f392b3fb5206d30bbb5c3.tar.gz forums-73981ac5dcf9fc3fb54f392b3fb5206d30bbb5c3.tar.bz2 forums-73981ac5dcf9fc3fb54f392b3fb5206d30bbb5c3.tar.xz forums-73981ac5dcf9fc3fb54f392b3fb5206d30bbb5c3.zip |
[Feature] Allow specific connection to different server for jabber functionality by providing a valid JID as username. This also allows the use of talk.google.com as jabber server with gmail.com JIDs. (Bug #14989)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8979 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
-rw-r--r-- | phpBB/includes/functions_jabber.php | 32 | ||||
-rw-r--r-- | phpBB/language/en/acp/board.php | 4 |
3 files changed, 23 insertions, 14 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 96acab6651..67d353de98 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -158,6 +158,7 @@ <li>[Feature] Added the possibility to force user posts put in queue if post count is lower than an admin defined value. Guest posting is not affected by this setting.</li> <li>[Feature] Added 'max_recipients' setting for private messages. This setting allows admins to define the maximum number of recipients per private message with a board-wide setting and a group-specific setting.</li> <li>[Feature] Added new permission setting for sending private messages to groups. Now there are two permissions to define sending private messages to multiple recipients and private messages to groups.</li> + <li>[Feature] Allow specific connection to different server for jabber functionality by providing a valid JID as username. This also allows the use of talk.google.com as jabber server with gmail.com JIDs. (Bug #14989)</li> <li>[Sec] Stricter validation of the HTTP_HOST header (Thanks to Micheal Cottingham et al for pointing out possible issues in derived code)</li> </ul> diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index 773da4c6eb..6d5021b9aa 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -20,7 +20,7 @@ if (!defined('IN_PHPBB')) * * Jabber class from Flyspray project * -* @version class.jabber2.php 1488 2007-11-25 +* @version class.jabber2.php 1595 2008-09-19 (0.9.9) * @copyright 2006 Flyspray.org * @author Florian Schmitz (floele) * @@ -35,6 +35,7 @@ class jabber var $timeout = 10; var $server; + var $connect_server; var $port; var $username; var $password; @@ -50,9 +51,23 @@ class jabber */ function jabber($server, $port, $username, $password, $use_ssl = false) { - $this->server = ($server) ? $server : 'localhost'; + $this->connect_server = ($server) ? $server : 'localhost'; $this->port = ($port) ? $port : 5222; - $this->username = $username; + + // Get the server and the username + if (strpos($username, '@') === false) + { + $this->server = $this->connect_server; + $this->username = $username; + } + else + { + $jid = explode('@', $username, 2); + + $this->username = $jid[0]; + $this->server = $jid[1]; + } + $this->password = $password; $this->use_ssl = ($use_ssl && $this->can_use_ssl()) ? true : false; @@ -123,7 +138,7 @@ class jabber $this->session['ssl'] = $this->use_ssl; - if ($this->open_socket($this->server, $this->port, $this->use_ssl)) + if ($this->open_socket($this->connect_server, $this->port, $this->use_ssl)) { $this->send("<?xml version='1.0' encoding='UTF-8' ?" . ">\n"); $this->send("<stream:stream to='{$this->server}' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>\n"); @@ -499,14 +514,7 @@ class jabber } // better generate a cnonce, maybe it's needed - $str = ''; - mt_srand((double)microtime()*10000000); - - for ($i = 0; $i < 32; $i++) - { - $str .= chr(mt_rand(0, 255)); - } - $decoded['cnonce'] = base64_encode($str); + $decoded['cnonce'] = base64_encode(md5(uniqid(mt_rand(), true))); // second challenge? if (isset($decoded['rspauth'])) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 76de3487fd..f6bbe175bd 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -459,8 +459,8 @@ $lang = array_merge($lang, array( 'JAB_SETTINGS_CHANGED' => 'Jabber settings changed successfully.', 'JAB_USE_SSL' => 'Use SSL to connect', 'JAB_USE_SSL_EXPLAIN' => 'If enabled a secure connection is tried to be established. The Jabber port will be modified to 5223 if port 5222 is specified.', - 'JAB_USERNAME' => 'Jabber username', - 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username. The username will not be checked for validity.', + 'JAB_USERNAME' => 'Jabber username or JID', + 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', )); ?>
\ No newline at end of file |