Skip to content

Commit

Permalink
Merge branch 'master' into activesync_2_9_0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Oct 17, 2013
2 parents e2ce88c + 0790dbf commit cfbbd68
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 47 deletions.
3 changes: 2 additions & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/State/Sql.php
Expand Up @@ -1154,7 +1154,8 @@ protected function _getPIMChangeTS(array $changes)
$values[] = $d;
}
}
$sql .= 'AND (' . explode('OR ', $conditions) . ') GROUP BY message_uid';

$sql .= 'AND (' . implode('OR ', $conditions) . ') GROUP BY message_uid';
try {
return $this->_db->selectAssoc($sql, $values);
} catch (Horde_Db_Exception $e) {
Expand Down
13 changes: 8 additions & 5 deletions framework/Imap_Client/lib/Horde/Imap/Client/Socket.php
Expand Up @@ -398,6 +398,7 @@ protected function _login()
$this->_debug->info('Successfully completed TLS negotiation.');

$this->setParam('secure', 'tls');
$secure = 'tls';

if ($first_login) {
// Expire cached CAPABILITY information (RFC 3501 [6.2.1])
Expand All @@ -413,6 +414,12 @@ protected function _login()
}
}

/* If we reached this point and don't have a secure connection, then
* a secure connections is not available. */
if (($secure === true) && !$this->isSecureConnection()) {
$this->setParam('secure', false);
}

if ($first_login) {
// Add authentication methods.
$auth_mech = array();
Expand Down Expand Up @@ -543,20 +550,16 @@ protected function _connect()
}

try {
$secure = $this->getParam('secure');
$this->_connection = new Horde_Imap_Client_Socket_Connection_Socket(
$this->getParam('hostspec'),
$this->getParam('port'),
$this->getParam('timeout'),
$secure,
$this->getParam('secure'),
array(
'debug' => $this->_debug,
'debugliteral' => $this->getParam('debug_literal')
)
);
if ($secure && !$this->_connection->secure) {
$this->setParam('secure', false);
}
} catch (Horde\Socket\Client\Exception $e) {
$e2 = new Horde_Imap_Client_Exception(
Horde_Imap_Client_Translation::t("Error connecting to mail server."),
Expand Down
27 changes: 19 additions & 8 deletions framework/Ldap/lib/Horde/Ldap.php
Expand Up @@ -491,29 +491,36 @@ public function disconnect()
*/
public function startTLS()
{
/* Test to see if the server supports TLS first.
/* First try STARTTLS blindly, some servers don't even allow to receive
* the rootDSE without TLS. */
if (@ldap_start_tls($this->_link)) {
return;
}

/* Keep original error. */
$error = 'TLS not started: ' . @ldap_error($this->_link);
$errno = @ldap_errno($this->_link);

/* Test to see if the server supports TLS at all.
* This is done via testing the extensions offered by the server.
* The OID 1.3.6.1.4.1.1466.20037 tells whether TLS is supported. */
try {
$rootDSE = $this->rootDSE();
} catch (Exception $e) {
throw new Horde_Ldap_Exception('Unable to fetch rootDSE entry to see if TLS is supported: ' . $e->getMessage(), $e->getCode());
throw new Horde_Ldap_Exception('Unable to start TLS and unable to fetch rootDSE entry to see if TLS is supported: ' . $e->getMessage(), $e->getCode());
}

try {
$supported_extensions = $rootDSE->getValue('supportedExtension');
} catch (Exception $e) {
throw new Horde_Ldap_Exception('Unable to fetch rootDSE attribute "supportedExtension" to see if TLS is supoported: ' . $e->getMessage(), $e->getCode());
throw new Horde_Ldap_Exception('Unable to start TLS and unable to fetch rootDSE attribute "supportedExtension" to see if TLS is supoported: ' . $e->getMessage(), $e->getCode());
}

if (!in_array('1.3.6.1.4.1.1466.20037', $supported_extensions)) {
throw new Horde_Ldap_Exception('Server reports that it does not support TLS');
}

if (!@ldap_start_tls($this->_link)) {
throw new Horde_Ldap_Exception('TLS not started: ' . @ldap_error($this->_link),
@ldap_errno($this->_link));
}
throw new Horde_Ldap_Exception($error, $errno);
}

/**
Expand Down Expand Up @@ -685,10 +692,14 @@ public function modify($entry, $parms = array())
throw new Horde_Ldap_Exception('Parameter is not a string nor an entry object!');
}

if ($unknown = array_diff(array_keys($parms), array('add', 'delete', 'replace', 'changes'))) {
throw new Horde_Ldap_Exception('Unknown modify action(s): ' . implode(', ', $unknown));
}

/* Perform changes mentioned separately. */
foreach (array('add', 'delete', 'replace') as $action) {
if (!isset($parms[$action])) {
throw new Horde_Ldap_Exception('Unknown modify action: ' . $action);
continue;
}
$entry->$action($parms[$action]);
$entry->setLDAP($this);
Expand Down
6 changes: 4 additions & 2 deletions framework/Ldap/package.xml
Expand Up @@ -29,7 +29,8 @@
</stability>
<license uri="http://opensource.org/licenses/lgpl-3.0.html">LGPL-3.0</license>
<notes>
*
* [jan] Fix modifying entries with modify().
* [jan] Try starting TLS without querying the rootDSE (Bug #12157).
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -389,7 +390,8 @@
<date>2013-01-29</date>
<license uri="http://opensource.org/licenses/lgpl-3.0.html">LGPL-3.0</license>
<notes>
*
* [jan] Fix modifying entries with modify().
* [jan] Try starting TLS without querying the rootDSE (Bug #12157).
</notes>
</release>
</changelog>
Expand Down
7 changes: 7 additions & 0 deletions framework/Ldap/test/Horde/Ldap/LdapTest.php
Expand Up @@ -217,6 +217,13 @@ public function testModify()
$ldap->add($local_entry);
$this->assertTrue($ldap->exists($local_entry->dn()));

// Test invalid actions.
try {
$ldap->modify($local_entry, array('foo' => 'bar'));
$this->fail('Expected exception when passing invalid actions to modify().');
} catch (Horde_Ldap_Exception $e) {
}

// Prepare some changes.
$changes = array(
'add' => array(
Expand Down
13 changes: 8 additions & 5 deletions framework/Smtp/lib/Horde/Smtp.php
Expand Up @@ -332,19 +332,15 @@ public function login()

if (!$this->_connection) {
try {
$secure = $this->getParam('secure');
$this->_connection = new Horde_Smtp_Connection(
$this->getParam('host'),
$this->getParam('port'),
$this->getParam('timeout'),
$secure,
$this->getParam('secure'),
array(
'debug' => $this->_debug
)
);
if ($secure && !$this->_connection->secure) {
$this->setParam('secure', false);
}
} catch (Horde\Socket\Client\Exception $e) {
$e2 = new Horde_Smtp_Exception(
Horde_Smtp_Translation::t("Error connecting to SMTP server."),
Expand Down Expand Up @@ -394,6 +390,13 @@ public function login()
return;
}

/* If we reached this point and don't have a secure connection, then
* a secure connections is not available. */
if (!$this->isSecureConnection() &&
($this->getParam('secure') === true)) {
$this->setParam('secure', false);
}

if (!strlen($this->getParam('username')) ||
!($auth = $this->queryExtension('AUTH'))) {
return;
Expand Down
9 changes: 1 addition & 8 deletions framework/Vfs/lib/Horde/Vfs/Ssh2.php
Expand Up @@ -355,14 +355,7 @@ public function changePermissions($path, $name, $permission)
{
$this->_connect();
$full = $this->_getPath($path, $name);

/* ssh2_sftp_chmod() has been added with ssh2 0.12. */
if (function_exists('ssh2_sftp_chmod')) {
$result = @ssh2_sftp_chmod($this->_sftp, $full, $permission);
} else {
$result = @ssh2_exec($this->_stream, 'chmod ' . escapeshellarg($permission) . ' ' . escapeshellarg($full));
}
if (!$result) {
if (!@ssh2_sftp_chmod($this->_sftp, $full, $permission)) {
throw new Horde_Vfs_Exception(sprintf('Unable to change permission for VFS file "%s".', $full));
}
}
Expand Down
6 changes: 3 additions & 3 deletions framework/Vfs/package.xml
Expand Up @@ -39,7 +39,7 @@ Reading, writing and listing of files are all supported.</description>
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [jan] Bump minimum version of SSH2 extension to 0.12.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
Expand Down Expand Up @@ -475,7 +475,7 @@ Reading, writing and listing of files are all supported.</description>
<package>
<name>ssh2</name>
<channel>pecl.php.net</channel>
<min>0.10</min>
<min>0.12</min>
<providesextension>ssh2</providesextension>
</package>
<extension>
Expand Down Expand Up @@ -1179,7 +1179,7 @@ Added a class for providing garbage collection; removed all Horde dependancies.
<date>2013-07-16</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
*
* [jan] Bump minimum version of SSH2 extension to 0.12.
</notes>
</release>
</changelog>
Expand Down
24 changes: 12 additions & 12 deletions horde/docs/INSTALL
Expand Up @@ -277,12 +277,12 @@ The following prerequisites are **REQUIRED** for Horde to function properly.
This extension can be enabled by adding the ``--enable-intl`` option
when compiling PHP.

h. _curl ``--with-curl``
h. _`curl` ``--with-curl``

The curl extension, if installed, will be used instead of PHP's fopen()
when retrieving data from external HTTP servers (remote calendars, web
APIs, etc.). This is much more reliable and flexible, so it is
recommended to either enable it or install the http_ extension.
The `curl extension`_, if installed, will be used instead of PHP's
fopen() when retrieving data from external HTTP servers (remote
calendars, web APIs, etc.). This is much more reliable and flexible, so
it is recommended to either enable it or install the http_ extension.

This extension can be enabled by adding the ``--with-curl`` option when
compiling PHP.
Expand Down Expand Up @@ -416,12 +416,12 @@ The following prerequisites are **REQUIRED** for Horde to function properly.

pecl install memcache

d. _http
d. _`http`

The http extension, if installed, will be used instead of PHP's fopen()
when retrieving data from external HTTP servers (remote calendars, web
APIs, etc.). This is much more reliable and flexible, so it recommended
to either install this or enable the curl_ extension.
The `http extension`_, if installed, will be used instead of PHP's
fopen() when retrieving data from external HTTP servers (remote
calendars, web APIs, etc.). This is much more reliable and flexible, so
it recommended to either install this or enable the curl_ extension.

To install, enter the following at the command prompt::

Expand Down Expand Up @@ -854,8 +854,8 @@ The Horde Team
.. _README: README
.. _docs/SECURITY: SECURITY
.. _docs/TRANSLATIONS: TRANSLATIONS
.. _curl: http://php.net/curl
.. _http: http://php.net/http
.. _`curl extension`: http://php.net/curl
.. _`http extension`: http://php.net/http
.. _`File Uploads`: http://wiki.horde.org/FAQ/Admin/FileUploads
.. _`Firebug`: http://www.getfirebug.com/
.. _`session.gc_probability`: http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability
Expand Down
2 changes: 1 addition & 1 deletion horde/services/twitter/index.php
Expand Up @@ -188,7 +188,7 @@ function _outputError($e)

/* These are all referencing the *original* tweet */
$view->profileLink = Horde::externalUrl('http://twitter.com/' . htmlspecialchars($tweetObj->user->screen_name), true);
$view->profileImg = $tweetObj->user->profile_image_url;
$view->profileImg = $GLOBALS['browser']->usingSSLConnection() ? $tweetObj->user->profile_image_url_https : $tweetObj->user->profile_image_url;
$view->authorName = '@' . htmlspecialchars($tweetObj->user->screen_name);
$view->authorFullname = htmlspecialchars($tweetObj->user->name);
$view->createdAt = $tweetObj->created_at;
Expand Down
6 changes: 4 additions & 2 deletions imp/lib/Basic/Message.php
Expand Up @@ -1019,7 +1019,7 @@ protected function _parseListHeaders($id, $data)
$output .= '&nbsp;(' . $val2 . ')';
}
break;
} elseif ($url = $text_filter->filter($val, 'linkurls')) {
} elseif ($url = $text_filter->filter($val->url, 'linkurls')) {
$output = $url;
foreach ($val->comments as $val2) {
$output .= '&nbsp;(' . $val2 . ')';
Expand All @@ -1028,7 +1028,9 @@ protected function _parseListHeaders($id, $data)
}
}

return $output;
return strlen($output)
? $output
: htmlspecialchars($data);
}

}

0 comments on commit cfbbd68

Please sign in to comment.