summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-06-15 18:06:00 +0200
committerJose <jose@zeroc.com>2016-06-15 18:06:00 +0200
commit99855eefd7419c24e9b204fb851ec95adc581b4e (patch)
tree0d79a68449d770c3c550b43121c0d6d43f602d14 /cpp/src
parentAllow java libraries to override pom scm data (diff)
parentStack trace test expec files for Linux (diff)
downloadice-99855eefd7419c24e9b204fb851ec95adc581b4e.tar.bz2
ice-99855eefd7419c24e9b204fb851ec95adc581b4e.tar.xz
ice-99855eefd7419c24e9b204fb851ec95adc581b4e.zip
Merge branch '3.6-stretch' into 3.6
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp37
-rw-r--r--cpp/src/Ice/Instance.cpp2
-rw-r--r--cpp/src/Ice/InstrumentationI.cpp4
-rw-r--r--cpp/src/Ice/Network.cpp10
-rw-r--r--cpp/src/Ice/Network.h2
-rw-r--r--cpp/src/IceGrid/Activator.cpp2
-rw-r--r--cpp/src/IceGrid/PlatformInfo.cpp6
-rw-r--r--cpp/src/IceSSL/OpenSSLEngine.cpp5
-rw-r--r--cpp/src/IceUtil/Cond.cpp2
-rw-r--r--cpp/src/IceUtil/Time.cpp4
10 files changed, 60 insertions, 14 deletions
diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp
index 9bc1ea38a5c..e3387c4667d 100644
--- a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp
+++ b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp
@@ -18,6 +18,8 @@
#if defined(__GLIBC__) || defined(_AIX)
# include <crypt.h>
+#elif defined(__FreeBSD__)
+# include <unistd.h>
#elif defined(__APPLE__)
# include <CoreFoundation/CoreFoundation.h>
# include <Security/Security.h>
@@ -34,6 +36,34 @@ using namespace Glacier2;
namespace
{
+#if defined(__FreeBSD__) && !defined(__GLIBC__)
+
+//
+// FreeBSD crypt is no reentrat we use this global mutex
+// to serialize access.
+//
+IceUtil::Mutex* _staticMutex = 0;
+
+class Init
+{
+public:
+
+ Init()
+ {
+ _staticMutex = new IceUtil::Mutex;
+ }
+
+ ~Init()
+ {
+ delete _staticMutex;
+ _staticMutex = 0;
+ }
+};
+
+Init init;
+#endif
+
+
class CryptPermissionsVerifierI : public PermissionsVerifier
{
public:
@@ -142,7 +172,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string&
{
return false;
}
-#if defined(__GLIBC__)
+#if defined(__GLIBC__) || defined(__FreeBSD__)
size_t i = p->second.rfind('$');
string salt;
if(i == string::npos)
@@ -164,9 +194,14 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string&
return false;
}
}
+# if defined(__GLIBC__)
struct crypt_data data;
data.initialized = 0;
return p->second == crypt_r(password.c_str(), salt.c_str(), &data);
+# else
+ IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(_staticMutex);
+ return p->second == crypt(password.c_str(), salt.c_str())
+# endif
#elif defined(__APPLE__) || defined(_WIN32)
//
// Pbkdf2 string format:
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 27826fd75f5..be381b67dda 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -61,7 +61,7 @@
# include <sys/types.h>
#endif
-#if defined(__linux) || defined(__sun) || defined(_AIX)
+#if defined(__linux) || defined(__sun) || defined(_AIX) || defined(__GLIBC__)
# include <grp.h> // for initgroups
#endif
diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp
index 86897e44943..b590686df45 100644
--- a/cpp/src/Ice/InstrumentationI.cpp
+++ b/cpp/src/Ice/InstrumentationI.cpp
@@ -25,8 +25,6 @@ using namespace IceMX;
namespace
{
-Context emptyCtx;
-
int ThreadMetrics::*
getThreadStateMetric(ThreadState s)
{
@@ -354,7 +352,7 @@ public:
};
static Attributes attributes;
- InvocationHelper(const ObjectPrx& proxy, const string& op, const Context& ctx = emptyCtx) :
+ InvocationHelper(const ObjectPrx& proxy, const string& op, const Context& ctx) :
_proxy(proxy), _operation(op), _context(ctx)
{
}
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index d7c1c22ba92..7fa9614379c 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -1238,7 +1238,17 @@ IceInternal::closeSocket(SOCKET fd)
WSASetLastError(error);
#else
int error = errno;
+
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ //
+ // FreeBSD returns ECONNRESET if the underlying object was
+ // a stream socket that was shut down by the peer before all
+ // pending data was delivered.
+ //
+ if(close(fd) == SOCKET_ERROR && getSocketErrno() != ECONNRESET)
+# else
if(close(fd) == SOCKET_ERROR)
+# endif
{
SocketException ex(__FILE__, __LINE__);
ex.error = getSocketErrno();
diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h
index 458261512f7..ea7ebd61f19 100644
--- a/cpp/src/Ice/Network.h
+++ b/cpp/src/Ice/Network.h
@@ -45,7 +45,7 @@ typedef int ssize_t;
#if defined(__linux) && !defined(ICE_NO_EPOLL)
# define ICE_USE_EPOLL 1
-#elif (defined(__APPLE__) || defined(__FreeBSD__)) && TARGET_OS_IPHONE == 0 && !defined(ICE_NO_KQUEUE)
+#elif (defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && TARGET_OS_IPHONE == 0 && !defined(ICE_NO_KQUEUE)
# define ICE_USE_KQUEUE 1
#elif defined(__APPLE__) && !defined(ICE_NO_CFSTREAM)
# define ICE_USE_CFSTREAM 1
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp
index b9aafc93d7b..ac7f7c3d349 100644
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -37,7 +37,7 @@
#endif
#endif
-#if defined(__linux) || defined(__sun) || defined(_AIX)
+#if defined(__linux) || defined(__sun) || defined(_AIX) || defined(__GLIBC__)
# include <grp.h> // for initgroups
#endif
diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp
index a227c8a8c55..320181cfaa3 100644
--- a/cpp/src/IceGrid/PlatformInfo.cpp
+++ b/cpp/src/IceGrid/PlatformInfo.cpp
@@ -24,7 +24,7 @@
# include <pdhmsg.h> // For PDH_MORE_DATA
#else
# include <sys/utsname.h>
-# if defined(__APPLE__) || defined(__FreeBSD__)
+# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# include <sys/sysctl.h>
# elif defined(__sun)
# include <sys/loadavg.h>
@@ -222,7 +222,7 @@ PlatformInfo::PlatformInfo(const string& prefix,
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
_nProcessorThreads = sysInfo.dwNumberOfProcessors;
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
static int ncpu[2] = { CTL_HW, HW_NCPU };
size_t sz = sizeof(_nProcessorThreads);
if(sysctl(ncpu, 2, &_nProcessorThreads, &sz, 0, 0) == -1)
@@ -450,7 +450,7 @@ PlatformInfo::getLoadInfo()
info.avg1 = static_cast<float>(_last1Total) / _usages1.size() / 100.0f;
info.avg5 = static_cast<float>(_last5Total) / _usages5.size() / 100.0f;
info.avg15 = static_cast<float>(_last15Total) / _usages15.size() / 100.0f;
-#elif defined(__sun) || defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__sun) || defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
//
// We use the load average divided by the number of
// processors to figure out if the machine is busy or
diff --git a/cpp/src/IceSSL/OpenSSLEngine.cpp b/cpp/src/IceSSL/OpenSSLEngine.cpp
index 76c83464b54..029cf825ffd 100644
--- a/cpp/src/IceSSL/OpenSSLEngine.cpp
+++ b/cpp/src/IceSSL/OpenSSLEngine.cpp
@@ -55,6 +55,9 @@ public:
~Init()
{
+ CRYPTO_set_locking_callback(0);
+ CRYPTO_set_id_callback(0);
+
delete staticMutex;
staticMutex = 0;
@@ -102,7 +105,7 @@ IceSSL_opensslThreadIdCallback()
// On some platforms, pthread_t is a pointer to a per-thread structure.
//
return reinterpret_cast<unsigned long>(pthread_self());
-# elif (defined(__linux) || defined(__sun) || defined(__hpux)) || defined(_AIX)
+# elif defined(__linux) || defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__GLIBC__)
//
// On Linux, Solaris, HP-UX and AIX, pthread_t is an integer.
//
diff --git a/cpp/src/IceUtil/Cond.cpp b/cpp/src/IceUtil/Cond.cpp
index b833036e87b..1ec40216661 100644
--- a/cpp/src/IceUtil/Cond.cpp
+++ b/cpp/src/IceUtil/Cond.cpp
@@ -332,7 +332,7 @@ IceUtil::Cond::Cond()
throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
-#if !defined(__hpux) && !defined(__APPLE__)
+#if !defined(__hppa) && !defined(__APPLE__) && !defined(__FreeBSD__)
rc = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
if(rc != 0)
{
diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp
index a771815ddb6..1dbf23e1d72 100644
--- a/cpp/src/IceUtil/Time.cpp
+++ b/cpp/src/IceUtil/Time.cpp
@@ -63,7 +63,7 @@ InitializeFrequency frequencyInitializer;
}
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__)
namespace
{
@@ -137,7 +137,7 @@ IceUtil::Time::now(Clock clock)
# endif
return Time(static_cast<Int64>(tb.time) * ICE_INT64(1000000) + tb.millitm * 1000);
}
-#elif defined(__hpux)
+#elif defined(__hppa)
//
// HP does not support CLOCK_MONOTONIC
//