summaryrefslogtreecommitdiffstats
path: root/third_party/libjingle
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 01:20:05 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 01:20:05 +0000
commitba89742ced6463b6d555b8caf3806ad45d48e39b (patch)
treecc251f846f127e93264f92e69914d79a34e867af /third_party/libjingle
parentf3a30a9cd0456fdc6c4969dfc7e42b82f98c117b (diff)
downloadchromium_src-ba89742ced6463b6d555b8caf3806ad45d48e39b.zip
chromium_src-ba89742ced6463b6d555b8caf3806ad45d48e39b.tar.gz
chromium_src-ba89742ced6463b6d555b8caf3806ad45d48e39b.tar.bz2
Use the right SSL adapter on Linux/OS X. This is a partial fix for the crash in 30721.
Added method for creating ssl socket adapters to libjingle socket factories and made callers use it. Added SSLSocketAdapterFactory class, which uses the right SSL socket adapter for Linux/OS X. Fixed bug in asynchttprequest.cc where ignore_bad_cert_ was being left uninitialized. BUG=30721 TEST=trybots, manual testing Review URL: http://codereview.chromium.org/503087 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libjingle')
-rw-r--r--third_party/libjingle/README.chromium3
-rw-r--r--third_party/libjingle/files/talk/base/asynchttprequest.cc10
-rw-r--r--third_party/libjingle/files/talk/base/asynchttprequest.h10
-rw-r--r--third_party/libjingle/files/talk/base/socketfactory.h6
-rw-r--r--third_party/libjingle/files/talk/base/socketpool.cc2
-rw-r--r--third_party/libjingle/mods-since-v0_4_0.diff80
6 files changed, 92 insertions, 19 deletions
diff --git a/third_party/libjingle/README.chromium b/third_party/libjingle/README.chromium
index a4d124e..5b177c8 100644
--- a/third_party/libjingle/README.chromium
+++ b/third_party/libjingle/README.chromium
@@ -40,3 +40,6 @@ Local Modifications:
library. The #define guard is SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS.
* Updated signalthread.* and dependencies to add threadcounting and
improve multithread safety.
+ * Added a CreateSSLAdapter() function to SocketFactory to allow SSL
+ adapter creation behavior to be overridden.
+ * Improved handling and error-checking of SSL adapters.
diff --git a/third_party/libjingle/files/talk/base/asynchttprequest.cc b/third_party/libjingle/files/talk/base/asynchttprequest.cc
index bf7bc85..9b3d414 100644
--- a/third_party/libjingle/files/talk/base/asynchttprequest.cc
+++ b/third_party/libjingle/files/talk/base/asynchttprequest.cc
@@ -70,9 +70,15 @@ talk_base::AsyncSocket * SslSocketFactory::CreateAsyncSocket(int type) {
}
if (!hostname_.empty()) {
- talk_base::SSLAdapter * ssl_adapter = talk_base::SSLAdapter::Create(socket);
+ talk_base::SSLAdapter * ssl_adapter = factory_->CreateSSLAdapter(socket);
ssl_adapter->set_ignore_bad_cert(ignore_bad_cert_);
- ssl_adapter->StartSSL(hostname_.c_str(), true);
+ int error = ssl_adapter->StartSSL(hostname_.c_str(),
+ use_restartable_ssl_sockets_);
+ if (error != 0) {
+ LOG(LS_WARNING) << "Could not start SSL; error = " << error;
+ delete ssl_adapter;
+ return 0;
+ }
socket = ssl_adapter;
}
diff --git a/third_party/libjingle/files/talk/base/asynchttprequest.h b/third_party/libjingle/files/talk/base/asynchttprequest.h
index 7f2f348..543210d 100644
--- a/third_party/libjingle/files/talk/base/asynchttprequest.h
+++ b/third_party/libjingle/files/talk/base/asynchttprequest.h
@@ -102,7 +102,8 @@ class SslSocketFactory : public talk_base::SocketFactory {
public:
SslSocketFactory(talk_base::SocketFactory * factory, const std::string &user_agent)
: factory_(factory), logging_level_(talk_base::LS_VERBOSE),
- binary_mode_(false), agent_(user_agent) { }
+ binary_mode_(false), agent_(user_agent),
+ ignore_bad_cert_(false), use_restartable_ssl_sockets_(false) { }
void UseSSL(const char * hostname) { hostname_ = hostname; }
void DisableSSL() { hostname_.clear(); }
@@ -111,6 +112,12 @@ class SslSocketFactory : public talk_base::SocketFactory {
const talk_base::ProxyInfo& proxy() const { return proxy_; }
bool ignore_bad_cert() {return ignore_bad_cert_;}
void SetIgnoreBadCert(bool ignore) { ignore_bad_cert_ = ignore; }
+ bool use_restartable_ssl_sockets() const {
+ return use_restartable_ssl_sockets_;
+ }
+ void SetUseRestartableSSLSockets(bool use_restartable_ssl_sockets) {
+ use_restartable_ssl_sockets_ = use_restartable_ssl_sockets;
+ }
void SetLogging(talk_base::LoggingSeverity level, const std::string& label,
bool binary_mode = false) {
@@ -130,6 +137,7 @@ private:
bool binary_mode_;
std::string agent_;
bool ignore_bad_cert_;
+ bool use_restartable_ssl_sockets_;
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/third_party/libjingle/files/talk/base/socketfactory.h b/third_party/libjingle/files/talk/base/socketfactory.h
index 2a4aee2..fd12375 100644
--- a/third_party/libjingle/files/talk/base/socketfactory.h
+++ b/third_party/libjingle/files/talk/base/socketfactory.h
@@ -30,6 +30,7 @@
#include "talk/base/socket.h"
#include "talk/base/asyncsocket.h"
+#include "talk/base/ssladapter.h"
namespace talk_base {
@@ -44,6 +45,11 @@ public:
// Returns a new socket for nonblocking communication. The type can be
// SOCK_DGRAM and SOCK_STREAM.
virtual AsyncSocket* CreateAsyncSocket(int type) = 0;
+
+ // Wraps the given socket in an SSL adapter.
+ virtual SSLAdapter* CreateSSLAdapter(AsyncSocket* socket) {
+ return SSLAdapter::Create(socket);
+ }
};
} // namespace talk_base
diff --git a/third_party/libjingle/files/talk/base/socketpool.cc b/third_party/libjingle/files/talk/base/socketpool.cc
index 614ce89..b90b2c9 100644
--- a/third_party/libjingle/files/talk/base/socketpool.cc
+++ b/third_party/libjingle/files/talk/base/socketpool.cc
@@ -139,7 +139,6 @@ StreamInterface*
NewSocketPool::RequestConnectedStream(const SocketAddress& remote, int* err) {
AsyncSocket* socket = factory_->CreateAsyncSocket(SOCK_STREAM);
if (!socket) {
- ASSERT(false);
if (err)
*err = -1;
return NULL;
@@ -186,7 +185,6 @@ ReuseSocketPool::RequestConnectedStream(const SocketAddress& remote, int* err) {
LOG(LS_INFO) << "ReuseSocketPool - Creating new socket";
AsyncSocket* socket = factory_->CreateAsyncSocket(SOCK_STREAM);
if (!socket) {
- ASSERT(false);
if (err)
*err = -1;
return NULL;
diff --git a/third_party/libjingle/mods-since-v0_4_0.diff b/third_party/libjingle/mods-since-v0_4_0.diff
index b36cf65..afddbc2 100644
--- a/third_party/libjingle/mods-since-v0_4_0.diff
+++ b/third_party/libjingle/mods-since-v0_4_0.diff
@@ -1,4 +1,3 @@
-Only in libjingle/files: .svn
Only in libjingle-0.4.0: Makefile.in
diff -r libjingle-0.4.0/README libjingle/files/README
1,39c1,39
@@ -206,16 +205,43 @@ Only in libjingle-0.4.0: depcomp
Only in libjingle-0.4.0: install-sh
Only in libjingle-0.4.0: ltmain.sh
Only in libjingle-0.4.0: missing
-Only in libjingle/files/talk: .svn
Only in libjingle-0.4.0/talk: Makefile.in
-Only in libjingle/files/talk/base: .svn
Only in libjingle-0.4.0/talk/base: Makefile.in
+diff -r libjingle-0.4.0/talk/base/asynchttprequest.cc libjingle/files/talk/base/asynchttprequest.cc
+73c73
+< talk_base::SSLAdapter * ssl_adapter = talk_base::SSLAdapter::Create(socket);
+---
+> talk_base::SSLAdapter * ssl_adapter = factory_->CreateSSLAdapter(socket);
+75c75,81
+< ssl_adapter->StartSSL(hostname_.c_str(), true);
+---
+> int error = ssl_adapter->StartSSL(hostname_.c_str(),
+> use_restartable_ssl_sockets_);
+> if (error != 0) {
+> LOG(LS_WARNING) << "Could not start SSL; error = " << error;
+> delete ssl_adapter;
+> return 0;
+> }
diff -r libjingle-0.4.0/talk/base/asynchttprequest.h libjingle/files/talk/base/asynchttprequest.h
23,24c23
< public SignalThread,
< public sigslot::has_slots<> {
---
> public SignalThread {
+106c105,106
+< binary_mode_(false), agent_(user_agent) { }
+---
+> binary_mode_(false), agent_(user_agent),
+> ignore_bad_cert_(false), use_restartable_ssl_sockets_(false) { }
+114a115,120
+> bool use_restartable_ssl_sockets() const {
+> return use_restartable_ssl_sockets_;
+> }
+> void SetUseRestartableSSLSockets(bool use_restartable_ssl_sockets) {
+> use_restartable_ssl_sockets_ = use_restartable_ssl_sockets;
+> }
+133a140
+> bool use_restartable_ssl_sockets_;
diff -r libjingle-0.4.0/talk/base/asynctcpsocket.cc libjingle/files/talk/base/asynctcpsocket.cc
31a32,33
> #include <cstring>
@@ -305,6 +331,18 @@ diff -r libjingle-0.4.0/talk/base/httpclient.cc libjingle/files/talk/base/httpcl
diff -r libjingle-0.4.0/talk/base/logging.cc libjingle/files/talk/base/logging.cc
27a28
> #include <stdio.h>
+76c77
+< #if _DEBUG
+---
+> #if LOGGING
+78c79
+< #else // !_DEBUG
+---
+> #else
+80c81
+< #endif // !_DEBUG
+---
+> #endif
diff -r libjingle-0.4.0/talk/base/logging.h libjingle/files/talk/base/logging.h
67a68,69
>
@@ -313,6 +351,10 @@ diff -r libjingle-0.4.0/talk/base/logging.h libjingle/files/talk/base/logging.h
> #endif // defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
195a199
> #if defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
+197c201
+< #if defined(_DEBUG) && !defined(NDEBUG)
+---
+> #if !defined(NDEBUG)
290a295
> #endif // defined(SAFE_TO_DEFINE_TALK_BASE_LOGGING_MACROS)
diff -r libjingle-0.4.0/talk/base/messagequeue.cc libjingle/files/talk/base/messagequeue.cc
@@ -802,7 +844,6 @@ diff -r libjingle-0.4.0/talk/base/signalthread.h libjingle/files/talk/base/signa
> kComplete, // Work is done
> kStopping, // Work is being interrupted
> } state_;
-Only in libjingle/files/talk/base: signalthread_unittest.cc
diff -r libjingle-0.4.0/talk/base/socket.h libjingle/files/talk/base/socket.h
77a78
> #undef ETIMEDOUT // remove pthread.h's definition
@@ -810,6 +851,20 @@ diff -r libjingle-0.4.0/talk/base/socketadapters.cc libjingle/files/talk/base/so
43a44,45
> #include <cstring>
>
+diff -r libjingle-0.4.0/talk/base/socketfactory.h libjingle/files/talk/base/socketfactory.h
+32a33
+> #include "talk/base/ssladapter.h"
+46a48,52
+>
+> // Wraps the given socket in an SSL adapter.
+> virtual SSLAdapter* CreateSSLAdapter(AsyncSocket* socket) {
+> return SSLAdapter::Create(socket);
+> }
+diff -r libjingle-0.4.0/talk/base/socketpool.cc libjingle/files/talk/base/socketpool.cc
+142d141
+< ASSERT(false);
+189d187
+< ASSERT(false);
diff -r libjingle-0.4.0/talk/base/ssladapter.cc libjingle/files/talk/base/ssladapter.cc
34c34,35
< #define SSL_USE_OPENSSL 1
@@ -906,23 +961,25 @@ diff -r libjingle-0.4.0/talk/base/thread.cc libjingle/files/talk/base/thread.cc
128a139,140
> CritScope cs(&started_crit_);
> stopped_ = true;
-168a181,184
+131a144
+> started_ = false;
+168a182,185
> CritScope cs(&started_crit_);
> // Make sure Join() hasn't been called yet.
> if (stopped_)
> return;
-181a198,199
+181a199,200
> CritScope cs(&started_crit_);
> stopped_ = true;
-191a210,212
+191a211,213
> // Make sure the thread hasn't been deleted.
> if (!g_thmgr.ThreadActive(thread))
> return NULL;
-207c228
+207c229
< MessageQueue::Stop();
---
> MessageQueue::Quit();
-329c350
+329c351
< return false;
---
> return !IsQuitting();
@@ -957,9 +1014,7 @@ Only in libjingle/files/talk/base: winsock_initializer.h
Only in libjingle-0.4.0/talk: examples
Only in libjingle-0.4.0/talk: libjingle.sln
Only in libjingle-0.4.0/talk: libjingle.vcproj
-Only in libjingle/files/talk/p2p: .svn
Only in libjingle-0.4.0/talk/p2p: Makefile.in
-Only in libjingle/files/talk/p2p/base: .svn
Only in libjingle-0.4.0/talk/p2p/base: Makefile.in
diff -r libjingle-0.4.0/talk/p2p/base/p2ptransport.cc libjingle/files/talk/p2p/base/p2ptransport.cc
37c37
@@ -1009,7 +1064,6 @@ diff -r libjingle-0.4.0/talk/p2p/base/transport.cc libjingle/files/talk/p2p/base
< #include "talk/xmpp/constants.h"
---
> #include "talk/xmpp/xmppconstants.h"
-Only in libjingle/files/talk/p2p/client: .svn
Only in libjingle-0.4.0/talk/p2p/client: Makefile.in
diff -r libjingle-0.4.0/talk/p2p/client/httpportallocator.cc libjingle/files/talk/p2p/client/httpportallocator.cc
82c82
@@ -1018,7 +1072,6 @@ diff -r libjingle-0.4.0/talk/p2p/client/httpportallocator.cc libjingle/files/tal
> relay_hosts_.push_back("relay.google.com");
Only in libjingle-0.4.0/talk: session
Only in libjingle-0.4.0/talk: third_party
-Only in libjingle/files/talk/xmllite: .svn
Only in libjingle-0.4.0/talk/xmllite: Makefile.in
diff -r libjingle-0.4.0/talk/xmllite/qname.cc libjingle/files/talk/xmllite/qname.cc
39c39
@@ -1170,7 +1223,6 @@ diff -r libjingle-0.4.0/talk/xmllite/xmlprinter.cc libjingle/files/talk/xmllite/
> XmlPrinterImpl::PrintCDATAText(const std::string & text) {
> *pout_ << "<![CDATA[" << text << "]]>";
> }
-Only in libjingle/files/talk/xmpp: .svn
Only in libjingle-0.4.0/talk/xmpp: Makefile.in
Only in libjingle-0.4.0/talk/xmpp: constants.cc
Only in libjingle-0.4.0/talk/xmpp: constants.h