diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/TcpConnector.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/TcpEndpoint.cpp | 32 | ||||
-rw-r--r-- | cpp/src/Ice/UdpEndpoint.cpp | 32 | ||||
-rw-r--r-- | cpp/src/IceSSL/SslConnector.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceSSL/SslEndpoint.cpp | 32 |
7 files changed, 86 insertions, 19 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 443f725f3c4..9ad8cfe1110 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,8 @@ Changes since version 1.2.0 --------------------------- +- A DNSException could cause a deadlock. This has been fixed. + - Changed FD_SETSIZE under Windows to 1024. (The default permits only 64 concurrent connections, which is too small for some applications.) diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 306af207e6d..c3a418457f2 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -403,8 +403,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, int& argc, if(_globalStateCounter == 1) // Only on first call { - unsigned int seed = - static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); + unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); srand(seed); if(_properties->getPropertyAsInt("Ice.NullHandleAbort") > 0) diff --git a/cpp/src/Ice/TcpConnector.cpp b/cpp/src/Ice/TcpConnector.cpp index ae98cda6a09..573619fd09d 100644 --- a/cpp/src/Ice/TcpConnector.cpp +++ b/cpp/src/Ice/TcpConnector.cpp @@ -57,7 +57,7 @@ IceInternal::TcpConnector::TcpConnector(const InstancePtr& instance, const strin _traceLevels(instance->traceLevels()), _logger(instance->logger()) { - getAddress(host.c_str(), port, _addr); + getAddress(host, port, _addr); } IceInternal::TcpConnector::~TcpConnector() diff --git a/cpp/src/Ice/TcpEndpoint.cpp b/cpp/src/Ice/TcpEndpoint.cpp index 6e76d8b5293..6712ae08213 100644 --- a/cpp/src/Ice/TcpEndpoint.cpp +++ b/cpp/src/Ice/TcpEndpoint.cpp @@ -330,9 +330,17 @@ IceInternal::TcpEndpoint::operator==(const Endpoint& r) const // struct sockaddr_in laddr; struct sockaddr_in raddr; - getAddress(_host, _port, laddr); - getAddress(p->_host, p->_port, raddr); - return compareAddress(laddr, raddr); + try + { + getAddress(_host, _port, laddr); + getAddress(p->_host, p->_port, raddr); + } + catch(const DNSException&) + { + return false; + } + + return compareAddress(laddr, raddr); } return true; @@ -391,9 +399,23 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const // We do the most time-consuming part of the comparison last. // struct sockaddr_in laddr; + try + { + getAddress(_host, _port, laddr); + } + catch(const DNSException&) + { + } + struct sockaddr_in raddr; - getAddress(_host, _port, laddr); - getAddress(p->_host, p->_port, raddr); + try + { + getAddress(p->_host, p->_port, raddr); + } + catch(const DNSException&) + { + } + if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr) { return true; diff --git a/cpp/src/Ice/UdpEndpoint.cpp b/cpp/src/Ice/UdpEndpoint.cpp index 8354ffc9434..ae7e635df53 100644 --- a/cpp/src/Ice/UdpEndpoint.cpp +++ b/cpp/src/Ice/UdpEndpoint.cpp @@ -502,9 +502,17 @@ IceInternal::UdpEndpoint::operator==(const Endpoint& r) const // struct sockaddr_in laddr; struct sockaddr_in raddr; - getAddress(_host, _port, laddr); - getAddress(p->_host, p->_port, raddr); - return compareAddress(laddr, raddr); + try + { + getAddress(_host, _port, laddr); + getAddress(p->_host, p->_port, raddr); + } + catch(const DNSException&) + { + return false; + } + + return compareAddress(laddr, raddr); } return true; @@ -599,9 +607,23 @@ IceInternal::UdpEndpoint::operator<(const Endpoint& r) const // We do the most time-consuming part of the comparison last. // struct sockaddr_in laddr; + try + { + getAddress(_host, _port, laddr); + } + catch(const DNSException&) + { + } + struct sockaddr_in raddr; - getAddress(_host, _port, laddr); - getAddress(p->_host, p->_port, raddr); + try + { + getAddress(p->_host, p->_port, raddr); + } + catch(const DNSException&) + { + } + if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr) { return true; diff --git a/cpp/src/IceSSL/SslConnector.cpp b/cpp/src/IceSSL/SslConnector.cpp index a51b66cc8da..06973f8682c 100644 --- a/cpp/src/IceSSL/SslConnector.cpp +++ b/cpp/src/IceSSL/SslConnector.cpp @@ -64,7 +64,7 @@ IceSSL::SslConnector::toString() const IceSSL::SslConnector::SslConnector(const OpenSSLPluginIPtr& plugin, const string& host, int port) : _plugin(plugin) { - getAddress(host.c_str(), port, _addr); + getAddress(host, port, _addr); } IceSSL::SslConnector::~SslConnector() diff --git a/cpp/src/IceSSL/SslEndpoint.cpp b/cpp/src/IceSSL/SslEndpoint.cpp index 14ad554b23d..13c0049aa23 100644 --- a/cpp/src/IceSSL/SslEndpoint.cpp +++ b/cpp/src/IceSSL/SslEndpoint.cpp @@ -330,9 +330,17 @@ IceSSL::SslEndpoint::operator==(const Endpoint& r) const // struct sockaddr_in laddr; struct sockaddr_in raddr; - getAddress(_host, _port, laddr); - getAddress(p->_host, p->_port, raddr); - return compareAddress(laddr, raddr); + try + { + getAddress(_host, _port, laddr); + getAddress(p->_host, p->_port, raddr); + } + catch(const DNSException&) + { + return false; + } + + return compareAddress(laddr, raddr); } return true; @@ -391,9 +399,23 @@ IceSSL::SslEndpoint::operator<(const Endpoint& r) const // We do the most time-consuming part of the comparison last. // struct sockaddr_in laddr; + try + { + getAddress(_host, _port, laddr); + } + catch(const DNSException&) + { + } + struct sockaddr_in raddr; - getAddress(_host, _port, laddr); - getAddress(p->_host, p->_port, raddr); + try + { + getAddress(p->_host, p->_port, raddr); + } + catch(const DNSException&) + { + } + if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr) { return true; |