zeroc-ice 3.8.2 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dist/IceRuby/Communicator.cpp +26 -9
- data/dist/IceRuby/Config.h +0 -12
- data/dist/IceRuby/Connection.cpp +18 -9
- data/dist/IceRuby/DefaultSliceLoader.h +1 -1
- data/dist/IceRuby/Endpoint.cpp +21 -8
- data/dist/IceRuby/Operation.cpp +7 -5
- data/dist/IceRuby/Properties.cpp +3 -4
- data/dist/IceRuby/Proxy.cpp +11 -19
- data/dist/IceRuby/RubySliceLoader.cpp +1 -1
- data/dist/IceRuby/RubySliceLoader.h +6 -0
- data/dist/IceRuby/Types.cpp +162 -138
- data/dist/IceRuby/Types.h +68 -28
- data/dist/IceRuby/Util.cpp +14 -78
- data/dist/IceRuby/Util.h +7 -17
- data/dist/ice/cpp/include/Ice/Communicator.h +31 -8
- data/dist/ice/cpp/include/Ice/Config.h +2 -2
- data/dist/ice/cpp/include/Ice/Connection.h +24 -8
- data/dist/ice/cpp/include/Ice/CtrlCHandler.h +1 -1
- data/dist/ice/cpp/include/Ice/Demangle.h +1 -1
- data/dist/ice/cpp/include/Ice/Endpoint.h +4 -4
- data/dist/ice/cpp/include/Ice/Initialize.h +4 -4
- data/dist/ice/cpp/include/Ice/InputStream.h +5 -5
- data/dist/ice/cpp/include/Ice/Instrumentation.h +13 -7
- data/dist/ice/cpp/include/Ice/LocalExceptions.h +5 -5
- data/dist/ice/cpp/include/Ice/Logger.h +7 -0
- data/dist/ice/cpp/include/Ice/LoggerUtil.h +1 -1
- data/dist/ice/cpp/include/Ice/Object.h +10 -8
- data/dist/ice/cpp/include/Ice/ObjectAdapter.h +1 -1
- data/dist/ice/cpp/include/Ice/OutgoingAsync.h +5 -2
- data/dist/ice/cpp/include/Ice/OutgoingResponse.h +2 -1
- data/dist/ice/cpp/include/Ice/OutputStream.h +7 -6
- data/dist/ice/cpp/include/Ice/PluginFactory.h +1 -1
- data/dist/ice/cpp/include/Ice/Properties.h +3 -3
- data/dist/ice/cpp/include/Ice/Proxy.h +192 -50
- data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +3 -3
- data/dist/ice/cpp/include/Ice/SSL/EndpointInfo.h +1 -1
- data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +5 -5
- data/dist/ice/cpp/include/Ice/ServantLocator.h +1 -1
- data/dist/ice/cpp/include/Ice/Service.h +2 -5
- data/dist/ice/cpp/include/Ice/SliceLoader.h +1 -1
- data/dist/ice/cpp/include/Ice/SlicedData.h +5 -3
- data/dist/ice/cpp/include/Ice/StreamHelpers.h +1 -1
- data/dist/ice/cpp/include/Ice/StreamableTraits.h +2 -2
- data/dist/ice/cpp/include/Ice/StringConverter.h +2 -3
- data/dist/ice/cpp/include/Ice/StringUtil.h +2 -7
- data/dist/ice/cpp/include/Ice/UUID.h +1 -0
- data/dist/ice/cpp/include/Ice/Value.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/BuiltinSequences.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Context.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/EndpointTypes.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Identity.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Locator.h +50 -14
- data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +38 -11
- data/dist/ice/cpp/include/generated/Ice/Metrics.h +94 -39
- data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Process.h +34 -8
- data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +42 -11
- data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +93 -40
- data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Router.h +50 -14
- data/dist/ice/cpp/include/generated/Ice/SliceChecksumDict.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Version.h +2 -2
- data/dist/ice/cpp/include/generated/IceDiscovery/Lookup.h +66 -14
- data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +34 -8
- data/dist/ice/cpp/src/Ice/AddDefaultPluginFactories_all.cpp +1 -1
- data/dist/ice/cpp/src/Ice/Base64.cpp +47 -137
- data/dist/ice/cpp/src/Ice/Base64.h +2 -2
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.cpp +28 -13
- data/dist/ice/cpp/src/Ice/BatchRequestQueue.h +5 -1
- data/dist/ice/cpp/src/Ice/Buffer.cpp +1 -1
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +1 -1
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.h +1 -1
- data/dist/ice/cpp/src/Ice/Communicator.cpp +4 -3
- data/dist/ice/cpp/src/Ice/CommunicatorFlushBatchAsync.cpp +8 -0
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.cpp +5 -15
- data/dist/ice/cpp/src/Ice/ConnectRequestHandler.h +1 -1
- data/dist/ice/cpp/src/Ice/ConnectionFactory.cpp +6 -8
- data/dist/ice/cpp/src/Ice/ConnectionFactory.h +0 -3
- data/dist/ice/cpp/src/Ice/ConnectionI.cpp +94 -99
- data/dist/ice/cpp/src/Ice/ConnectionI.h +11 -8
- data/dist/ice/cpp/src/Ice/ConsoleUtil.cpp +1 -1
- data/dist/ice/cpp/src/Ice/DefaultsAndOverrides.cpp +10 -14
- data/dist/ice/cpp/src/Ice/EndpointI.h +1 -1
- data/dist/ice/cpp/src/Ice/FileUtil.cpp +12 -12
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.cpp +1 -1
- data/dist/ice/cpp/src/Ice/FixedRequestHandler.h +1 -1
- data/dist/ice/cpp/src/Ice/HttpParser.h +0 -2
- data/dist/ice/cpp/src/Ice/IdleTimeoutTransceiverDecorator.cpp +6 -3
- data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +1 -3
- data/dist/ice/cpp/src/Ice/InputStream.cpp +23 -19
- data/dist/ice/cpp/src/Ice/Instance.cpp +73 -50
- data/dist/ice/cpp/src/Ice/Instance.h +1 -6
- data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +1 -1
- data/dist/ice/cpp/src/Ice/LocatorInfo.cpp +2 -2
- data/dist/ice/cpp/src/Ice/LoggerAdminI.cpp +13 -18
- data/dist/ice/cpp/src/Ice/LoggerI.cpp +1 -1
- data/dist/ice/cpp/src/Ice/LoggerI.h +2 -2
- data/dist/ice/cpp/src/Ice/MetricsAdminI.h +6 -1
- data/dist/ice/cpp/src/Ice/MetricsObserverI.h +22 -18
- data/dist/ice/cpp/src/Ice/NativePropertiesAdmin.cpp +5 -2
- data/dist/ice/cpp/src/Ice/Network.cpp +168 -103
- data/dist/ice/cpp/src/Ice/Network.h +12 -7
- data/dist/ice/cpp/src/Ice/NetworkProxy.cpp +17 -6
- data/dist/ice/cpp/src/Ice/NetworkProxy.h +2 -1
- data/dist/ice/cpp/src/Ice/Object.cpp +1 -1
- data/dist/ice/cpp/src/Ice/ObjectAdapterI.cpp +56 -19
- data/dist/ice/cpp/src/Ice/OpaqueEndpointI.cpp +10 -10
- data/dist/ice/cpp/src/Ice/Options.cpp +7 -2
- data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +1 -1
- data/dist/ice/cpp/src/Ice/OutputStream.cpp +4 -4
- data/dist/ice/cpp/src/Ice/PluginManagerI.cpp +7 -1
- data/dist/ice/cpp/src/Ice/Properties.cpp +26 -16
- data/dist/ice/cpp/src/Ice/PropertyUtil.cpp +1 -1
- data/dist/ice/cpp/src/Ice/ProtocolInstance.cpp +0 -11
- data/dist/ice/cpp/src/Ice/ProtocolInstance.h +1 -2
- data/dist/ice/cpp/src/Ice/Proxy.cpp +9 -1
- data/dist/ice/cpp/src/Ice/ProxyAsync.cpp +110 -13
- data/dist/ice/cpp/src/Ice/Random.cpp +68 -7
- data/dist/ice/cpp/src/Ice/Random.h +6 -2
- data/dist/ice/cpp/src/Ice/Reference.cpp +22 -11
- data/dist/ice/cpp/src/Ice/Reference.h +3 -0
- data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +10 -0
- data/dist/ice/cpp/src/Ice/RequestHandler.h +3 -1
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.cpp +1 -1
- data/dist/ice/cpp/src/Ice/RequestHandlerCache.h +1 -1
- data/dist/ice/cpp/src/Ice/ResourceConfig.h +3 -3
- data/dist/ice/cpp/src/Ice/RetryQueue.cpp +8 -12
- data/dist/ice/cpp/src/Ice/SHA1.cpp +11 -11
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.cpp +0 -6
- data/dist/ice/cpp/src/Ice/SSL/DistinguishedName.h +0 -6
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +15 -1
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +77 -27
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.h +2 -1
- data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +2 -2
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +39 -34
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +130 -52
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +64 -33
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.h +0 -1
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +3 -3
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.cpp +9 -3
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +73 -51
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.h +0 -8
- data/dist/ice/cpp/src/Ice/Selector.cpp +13 -11
- data/dist/ice/cpp/src/Ice/ServantManager.cpp +3 -3
- data/dist/ice/cpp/src/Ice/Service.cpp +33 -115
- data/dist/ice/cpp/src/Ice/StreamSocket.cpp +33 -40
- data/dist/ice/cpp/src/Ice/StreamSocket.h +4 -4
- data/dist/ice/cpp/src/Ice/StringConverter.cpp +1 -1
- data/dist/ice/cpp/src/Ice/StringUtil.cpp +12 -21
- data/dist/ice/cpp/src/Ice/SysLoggerI.cpp +136 -100
- data/dist/ice/cpp/src/Ice/SysLoggerI.h +7 -3
- data/dist/ice/cpp/src/Ice/SystemdJournalI.cpp +1 -1
- data/dist/ice/cpp/src/Ice/TcpAcceptor.cpp +7 -7
- data/dist/ice/cpp/src/Ice/TcpAcceptor.h +2 -1
- data/dist/ice/cpp/src/Ice/TcpBufSize.h +40 -0
- data/dist/ice/cpp/src/Ice/TcpConnector.cpp +5 -2
- data/dist/ice/cpp/src/Ice/TcpConnector.h +2 -0
- data/dist/ice/cpp/src/Ice/TcpTransceiver.cpp +6 -2
- data/dist/ice/cpp/src/Ice/ThreadPool.cpp +2 -8
- data/dist/ice/cpp/src/Ice/ThreadPool.h +0 -2
- data/dist/ice/cpp/src/Ice/Timer.cpp +7 -3
- data/dist/ice/cpp/src/Ice/UUID.cpp +1 -2
- data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +4 -1
- data/dist/ice/cpp/src/Ice/UdpTransceiver.cpp +136 -123
- data/dist/ice/cpp/src/Ice/UdpTransceiver.h +3 -4
- data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +96 -27
- data/dist/ice/cpp/src/Ice/WSTransceiver.h +1 -1
- data/dist/ice/cpp/src/Ice/generated/BuiltinSequences.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Context.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/EndpointTypes.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Identity.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Locator.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/LocatorRegistry.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Metrics.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/OperationMode.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Process.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/PropertiesAdmin.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/PropertyDict.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/RemoteLogger.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/ReplyStatus.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Router.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/SliceChecksumDict.cpp +2 -2
- data/dist/ice/cpp/src/Ice/generated/Version.cpp +2 -2
- data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +47 -9
- data/dist/ice/cpp/src/IceDiscovery/LookupI.h +8 -3
- data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
- data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +43 -14
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
- data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +26 -20
- data/dist/ice/cpp/src/Slice/DocCommentParser.h +2 -2
- data/dist/ice/cpp/src/Slice/FileTracker.cpp +3 -11
- data/dist/ice/cpp/src/Slice/FileTracker.h +0 -2
- data/dist/ice/cpp/src/Slice/Grammar.cpp +211 -210
- data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +10 -9
- data/dist/ice/cpp/src/Slice/Parser.cpp +28 -20
- data/dist/ice/cpp/src/Slice/Parser.h +3 -4
- data/dist/ice/cpp/src/Slice/Preprocessor.cpp +3 -11
- data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -2
- data/dist/ice/cpp/src/Slice/Scanner.cpp +3 -3
- data/dist/ice/cpp/src/Slice/SliceUtil.cpp +197 -114
- data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +0 -2
- data/dist/ice/cpp/src/Slice/Util.h +21 -9
- data/dist/ice/cpp/src/slice2rb/Ruby.cpp +7 -3
- data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +16 -12
- data/dist/ice/cpp/src/slice2rb/RubyUtil.h +3 -3
- data/dist/ice/slice/Glacier2/Router.ice +3 -3
- data/dist/ice/slice/Ice/Metrics.ice +6 -5
- data/dist/ice/slice/Ice/RemoteLogger.ice +5 -5
- data/dist/ice/slice/IceGrid/Admin.ice +9 -9
- data/dist/ice/slice/IceGrid/Descriptor.ice +5 -5
- data/dist/ice/slice/IceStorm/Metrics.ice +1 -1
- data/dist/lib/Glacier2/Metrics.rb +1 -1
- data/dist/lib/Glacier2/PermissionsVerifier.rb +1 -1
- data/dist/lib/Glacier2/Router.rb +2 -2
- data/dist/lib/Glacier2/SSLInfo.rb +1 -1
- data/dist/lib/Glacier2/Session.rb +1 -1
- data/dist/lib/Ice/BuiltinSequences.rb +1 -1
- data/dist/lib/Ice/CompressBatch.rb +1 -2
- data/dist/lib/Ice/Context.rb +1 -1
- data/dist/lib/Ice/EndpointSelectionType.rb +1 -2
- data/dist/lib/Ice/EndpointTypes.rb +1 -1
- data/dist/lib/Ice/Identity.rb +1 -1
- data/dist/lib/Ice/IdentitySpaceship.rb +1 -0
- data/dist/lib/Ice/Locator.rb +1 -1
- data/dist/lib/Ice/LocatorRegistry.rb +1 -1
- data/dist/lib/Ice/Metrics.rb +1 -1
- data/dist/lib/Ice/OperationMode.rb +2 -3
- data/dist/lib/Ice/Process.rb +1 -1
- data/dist/lib/Ice/PropertiesAdmin.rb +1 -1
- data/dist/lib/Ice/PropertyDict.rb +1 -1
- data/dist/lib/Ice/RemoteLogger.rb +2 -3
- data/dist/lib/Ice/ReplyStatus.rb +2 -3
- data/dist/lib/Ice/Router.rb +1 -1
- data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
- data/dist/lib/Ice/SliceUtil.rb +2 -2
- data/dist/lib/Ice/Struct.rb +1 -0
- data/dist/lib/Ice/ToStringMode.rb +1 -2
- data/dist/lib/Ice/Value.rb +2 -2
- data/dist/lib/Ice/Version.rb +1 -1
- data/dist/lib/IceBox/ServiceManager.rb +1 -1
- data/dist/lib/IceGrid/Admin.rb +3 -4
- data/dist/lib/IceGrid/Descriptor.rb +1 -1
- data/dist/lib/IceGrid/Exception.rb +1 -1
- data/dist/lib/IceGrid/FileParser.rb +1 -1
- data/dist/lib/IceGrid/Registry.rb +2 -3
- data/dist/lib/IceGrid/Session.rb +2 -2
- data/dist/lib/IceGrid/UserAccountMapper.rb +1 -1
- data/dist/lib/IceStorm/IceStorm.rb +1 -1
- data/dist/lib/IceStorm/Metrics.rb +1 -1
- data/extconf.rb +1 -1
- data/ice.gemspec +3 -3
- metadata +4 -5
- data/dist/ice/cpp/src/Ice/DLLMain.cpp +0 -40
- data/dist/ice/cpp/src/Ice/UndefSysMacros.h +0 -37
|
@@ -1,29 +1,90 @@
|
|
|
1
1
|
// Copyright (c) ZeroC, Inc.
|
|
2
2
|
|
|
3
|
+
#ifdef _WIN32
|
|
4
|
+
# define _CRT_RAND_S
|
|
5
|
+
#endif
|
|
6
|
+
|
|
3
7
|
#include "Random.h"
|
|
4
8
|
|
|
9
|
+
#include <array>
|
|
5
10
|
#include <cassert>
|
|
11
|
+
#include <cstdint>
|
|
12
|
+
#include <cstdlib>
|
|
13
|
+
#include <cstring>
|
|
14
|
+
#include <system_error>
|
|
15
|
+
|
|
16
|
+
#if defined(__linux__)
|
|
17
|
+
# include <cerrno>
|
|
18
|
+
# include <sys/random.h>
|
|
19
|
+
#endif
|
|
6
20
|
|
|
7
21
|
using namespace std;
|
|
8
22
|
|
|
23
|
+
// Generate the random bytes with the operating system's CSPRNG, never with std::random_device: the C++
|
|
24
|
+
// standard gives std::random_device no cryptographic guarantee, and some implementations draw from raw CPU
|
|
25
|
+
// entropy instructions whose output defective hardware can make predictable.
|
|
9
26
|
void
|
|
10
27
|
IceInternal::generateRandom(char* buffer, size_t size)
|
|
11
28
|
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
29
|
+
#if defined(_WIN32)
|
|
30
|
+
// rand_s is backed by the same system CSPRNG as BCryptGenRandom and requires no additional link
|
|
31
|
+
// dependency.
|
|
32
|
+
size_t index = 0;
|
|
33
|
+
while (index < size)
|
|
34
|
+
{
|
|
35
|
+
unsigned int r = 0;
|
|
36
|
+
errno_t err = rand_s(&r);
|
|
37
|
+
if (err != 0)
|
|
38
|
+
{
|
|
39
|
+
throw system_error(err, generic_category(), "rand_s failed");
|
|
40
|
+
}
|
|
41
|
+
size_t n = min(sizeof(r), size - index);
|
|
42
|
+
memcpy(buffer + index, &r, n);
|
|
43
|
+
index += n;
|
|
44
|
+
}
|
|
45
|
+
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
|
46
|
+
arc4random_buf(buffer, size);
|
|
47
|
+
#elif defined(__linux__)
|
|
48
|
+
// getrandom with flags == 0 deliberately blocks until the kernel's entropy pool is initialized; don't
|
|
49
|
+
// "fix" this with GRND_NONBLOCK. There is also deliberately no /dev/urandom fallback here: getrandom is
|
|
50
|
+
// available in every supported glibc (2.25+), so a failure is a real error, not a missing feature.
|
|
51
|
+
size_t index = 0;
|
|
52
|
+
while (index < size)
|
|
16
53
|
{
|
|
17
|
-
|
|
54
|
+
ssize_t n = getrandom(buffer + index, size - index, 0);
|
|
55
|
+
if (n <= 0)
|
|
56
|
+
{
|
|
57
|
+
if (n < 0 && errno == EINTR)
|
|
58
|
+
{
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (n == 0)
|
|
62
|
+
{
|
|
63
|
+
throw system_error(EIO, generic_category(), "getrandom returned no data");
|
|
64
|
+
}
|
|
65
|
+
throw system_error(errno, generic_category(), "getrandom failed");
|
|
66
|
+
}
|
|
67
|
+
index += static_cast<size_t>(n);
|
|
18
68
|
}
|
|
69
|
+
#else
|
|
70
|
+
# error "unsupported platform: no OS CSPRNG binding"
|
|
71
|
+
#endif
|
|
19
72
|
}
|
|
20
73
|
|
|
21
74
|
unsigned int
|
|
22
75
|
IceInternal::random(unsigned int limit)
|
|
23
76
|
{
|
|
24
77
|
assert(limit > 0);
|
|
25
|
-
thread_local static
|
|
26
|
-
thread_local static std::mt19937 rng(rd());
|
|
78
|
+
thread_local static mt19937 rng = createMT19937();
|
|
27
79
|
uniform_int_distribution<unsigned int> distribution(0, limit - 1);
|
|
28
80
|
return distribution(rng);
|
|
29
81
|
}
|
|
82
|
+
|
|
83
|
+
mt19937
|
|
84
|
+
IceInternal::createMT19937()
|
|
85
|
+
{
|
|
86
|
+
array<uint32_t, 8> seedData;
|
|
87
|
+
generateRandom(reinterpret_cast<char*>(seedData.data()), sizeof(seedData));
|
|
88
|
+
seed_seq seq(seedData.begin(), seedData.end());
|
|
89
|
+
return mt19937(seq);
|
|
90
|
+
}
|
|
@@ -9,13 +9,17 @@
|
|
|
9
9
|
|
|
10
10
|
namespace IceInternal
|
|
11
11
|
{
|
|
12
|
+
// Fills the buffer with cryptographically strong random bytes from the operating system's CSPRNG.
|
|
12
13
|
ICE_API void generateRandom(char*, size_t);
|
|
14
|
+
|
|
13
15
|
ICE_API unsigned int random(unsigned int = 0);
|
|
14
16
|
|
|
17
|
+
// Creates a std::mt19937 engine seeded from the operating system's CSPRNG.
|
|
18
|
+
ICE_API std::mt19937 createMT19937();
|
|
19
|
+
|
|
15
20
|
template<class T> void shuffle(T first, T last)
|
|
16
21
|
{
|
|
17
|
-
thread_local static std::
|
|
18
|
-
thread_local static std::mt19937 rng(rd());
|
|
22
|
+
thread_local static std::mt19937 rng = createMT19937();
|
|
19
23
|
std::shuffle(first, last, rng);
|
|
20
24
|
}
|
|
21
25
|
}
|
|
@@ -1013,9 +1013,15 @@ IceInternal::RoutableReference::toProperty(string prefix) const
|
|
|
1013
1013
|
properties[prefix + ".ConnectionCached"] = _cacheConnection ? "1" : "0";
|
|
1014
1014
|
properties[prefix + ".EndpointSelection"] =
|
|
1015
1015
|
_endpointSelection == EndpointSelectionType::Random ? "Random" : "Ordered";
|
|
1016
|
+
// An invocation timeout of zero or any negative timeout means infinite; a negative locator cache timeout also
|
|
1017
|
+
// means infinite. We emit these as -1, the documented value for infinite. A positive timeout that is not a whole
|
|
1018
|
+
// number of the property's unit is rounded up, to the next whole number.
|
|
1019
|
+
// TODO: remove this normalization in 3.9, once the timeouts are always normalized: in 3.8, code compiled
|
|
1020
|
+
// against older headers can still set non-normalized values.
|
|
1016
1021
|
properties[prefix + ".LocatorCacheTimeout"] =
|
|
1017
|
-
to_string(chrono::
|
|
1018
|
-
|
|
1022
|
+
_locatorCacheTimeout < 0ms ? "-1" : to_string(chrono::ceil<chrono::seconds>(_locatorCacheTimeout).count());
|
|
1023
|
+
chrono::milliseconds invocationTimeout = getInvocationTimeout();
|
|
1024
|
+
properties[prefix + ".InvocationTimeout"] = invocationTimeout <= 0ms ? "-1" : to_string(invocationTimeout.count());
|
|
1019
1025
|
|
|
1020
1026
|
if (_routerInfo)
|
|
1021
1027
|
{
|
|
@@ -1200,7 +1206,12 @@ IceInternal::RoutableReference::operator<(const Reference& r) const noexcept
|
|
|
1200
1206
|
{
|
|
1201
1207
|
return true;
|
|
1202
1208
|
}
|
|
1203
|
-
else if (
|
|
1209
|
+
else if (lexicographical_compare(
|
|
1210
|
+
rhs->_endpoints.begin(),
|
|
1211
|
+
rhs->_endpoints.end(),
|
|
1212
|
+
_endpoints.begin(),
|
|
1213
|
+
_endpoints.end(),
|
|
1214
|
+
Ice::TargetCompare<shared_ptr<EndpointI>, std::less>()))
|
|
1204
1215
|
{
|
|
1205
1216
|
return false;
|
|
1206
1217
|
}
|
|
@@ -1398,7 +1409,7 @@ IceInternal::RoutableReference::createConnectionAsync(
|
|
|
1398
1409
|
OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
|
|
1399
1410
|
auto self = static_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
|
|
1400
1411
|
|
|
1401
|
-
auto
|
|
1412
|
+
auto createConnectionSucceeded =
|
|
1402
1413
|
[routerInfo = _routerInfo, response = std::move(response)](Ice::ConnectionIPtr connection, bool compress)
|
|
1403
1414
|
{
|
|
1404
1415
|
// If we have a router, set the object adapter for this router (if any) to the new connection, so that
|
|
@@ -1413,7 +1424,7 @@ IceInternal::RoutableReference::createConnectionAsync(
|
|
|
1413
1424
|
if (getCacheConnection() || endpoints.size() == 1)
|
|
1414
1425
|
{
|
|
1415
1426
|
// Get an existing connection or create one if there's no existing connection to one of the given endpoints.
|
|
1416
|
-
factory->createAsync(std::move(endpoints), false, std::move(
|
|
1427
|
+
factory->createAsync(std::move(endpoints), false, std::move(createConnectionSucceeded), std::move(exception));
|
|
1417
1428
|
}
|
|
1418
1429
|
else
|
|
1419
1430
|
{
|
|
@@ -1427,11 +1438,11 @@ IceInternal::RoutableReference::createConnectionAsync(
|
|
|
1427
1438
|
CreateConnectionState(
|
|
1428
1439
|
vector<EndpointIPtr> endpoints,
|
|
1429
1440
|
OutgoingConnectionFactoryPtr factory,
|
|
1430
|
-
function<void(Ice::ConnectionIPtr, bool)>
|
|
1441
|
+
function<void(Ice::ConnectionIPtr, bool)> createConnectionSucceeded,
|
|
1431
1442
|
function<void(exception_ptr)> exception)
|
|
1432
1443
|
: _endpoints(std::move(endpoints)),
|
|
1433
1444
|
_factory(std::move(factory)),
|
|
1434
|
-
|
|
1445
|
+
_createConnectionSucceeded(std::move(createConnectionSucceeded)),
|
|
1435
1446
|
_createConnectionFailed(std::move(exception))
|
|
1436
1447
|
{
|
|
1437
1448
|
}
|
|
@@ -1441,7 +1452,7 @@ IceInternal::RoutableReference::createConnectionAsync(
|
|
|
1441
1452
|
_factory->createAsync(
|
|
1442
1453
|
{_endpoints[_endpointIndex]},
|
|
1443
1454
|
true,
|
|
1444
|
-
|
|
1455
|
+
_createConnectionSucceeded,
|
|
1445
1456
|
[self = shared_from_this()](exception_ptr e) { self->handleException(e); });
|
|
1446
1457
|
}
|
|
1447
1458
|
|
|
@@ -1462,7 +1473,7 @@ IceInternal::RoutableReference::createConnectionAsync(
|
|
|
1462
1473
|
_factory->createAsync(
|
|
1463
1474
|
{_endpoints[_endpointIndex]},
|
|
1464
1475
|
more,
|
|
1465
|
-
|
|
1476
|
+
_createConnectionSucceeded,
|
|
1466
1477
|
[self = shared_from_this()](exception_ptr e) { self->handleException(e); });
|
|
1467
1478
|
}
|
|
1468
1479
|
|
|
@@ -1471,14 +1482,14 @@ IceInternal::RoutableReference::createConnectionAsync(
|
|
|
1471
1482
|
size_t _endpointIndex = 0;
|
|
1472
1483
|
vector<EndpointIPtr> _endpoints;
|
|
1473
1484
|
OutgoingConnectionFactoryPtr _factory;
|
|
1474
|
-
std::function<void(Ice::ConnectionIPtr, bool)>
|
|
1485
|
+
std::function<void(Ice::ConnectionIPtr, bool)> _createConnectionSucceeded;
|
|
1475
1486
|
std::function<void(exception_ptr)> _createConnectionFailed;
|
|
1476
1487
|
};
|
|
1477
1488
|
|
|
1478
1489
|
auto state = make_shared<CreateConnectionState>(
|
|
1479
1490
|
std::move(endpoints),
|
|
1480
1491
|
std::move(factory),
|
|
1481
|
-
std::move(
|
|
1492
|
+
std::move(createConnectionSucceeded),
|
|
1482
1493
|
std::move(exception));
|
|
1483
1494
|
state->createAsync();
|
|
1484
1495
|
}
|
|
@@ -209,6 +209,9 @@ namespace IceInternal
|
|
|
209
209
|
[[nodiscard]] RequestHandlerPtr getRequestHandler() const final;
|
|
210
210
|
[[nodiscard]] const BatchRequestQueuePtr& getBatchRequestQueue() const noexcept final;
|
|
211
211
|
|
|
212
|
+
// The connection this fixed reference is bound to, whatever its state.
|
|
213
|
+
[[nodiscard]] const Ice::ConnectionIPtr& fixedConnection() const noexcept { return _fixedConnection; }
|
|
214
|
+
|
|
212
215
|
bool operator==(const Reference&) const noexcept final;
|
|
213
216
|
bool operator<(const Reference&) const noexcept final;
|
|
214
217
|
|
|
@@ -795,10 +795,20 @@ IceInternal::ReferenceFactory::create(
|
|
|
795
795
|
property = propertyPrefix + ".LocatorCacheTimeout";
|
|
796
796
|
locatorCacheTimeout = chrono::seconds(
|
|
797
797
|
properties->getPropertyAsIntWithDefault(property, static_cast<int32_t>(locatorCacheTimeout.count())));
|
|
798
|
+
if (locatorCacheTimeout < chrono::seconds::zero())
|
|
799
|
+
{
|
|
800
|
+
// Any negative timeout means infinite and is normalized to -1; 0 means no caching.
|
|
801
|
+
locatorCacheTimeout = chrono::seconds(-1);
|
|
802
|
+
}
|
|
798
803
|
|
|
799
804
|
property = propertyPrefix + ".InvocationTimeout";
|
|
800
805
|
invocationTimeout = chrono::milliseconds(
|
|
801
806
|
properties->getPropertyAsIntWithDefault(property, static_cast<int32_t>(invocationTimeout.count())));
|
|
807
|
+
if (invocationTimeout <= chrono::milliseconds::zero())
|
|
808
|
+
{
|
|
809
|
+
// Zero or any negative timeout means infinite and is normalized to -1.
|
|
810
|
+
invocationTimeout = chrono::milliseconds(-1);
|
|
811
|
+
}
|
|
802
812
|
|
|
803
813
|
property = propertyPrefix + ".Context.";
|
|
804
814
|
PropertyDict contexts = properties->getPropertiesForPrefix(property);
|
|
@@ -42,7 +42,9 @@ namespace IceInternal
|
|
|
42
42
|
|
|
43
43
|
virtual AsyncStatus sendAsyncRequest(const ProxyOutgoingAsyncBasePtr&) = 0;
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
// Returns this request handler's connection, or null if no connection is available. This function never
|
|
46
|
+
// throws.
|
|
47
|
+
virtual Ice::ConnectionIPtr getConnection() noexcept = 0;
|
|
46
48
|
|
|
47
49
|
protected:
|
|
48
50
|
const ReferencePtr _reference;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
#include "winver.h"
|
|
7
7
|
|
|
8
|
-
#define ICE_VERSION 3, 8,
|
|
9
|
-
#define ICE_STRING_VERSION "3.8.
|
|
8
|
+
#define ICE_VERSION 3, 8, 3, 0
|
|
9
|
+
#define ICE_STRING_VERSION "3.8.3\0"
|
|
10
10
|
#define ICE_SO_VERSION "38\0"
|
|
11
11
|
#define ICE_COMPANY_NAME "ZeroC, Inc.\0"
|
|
12
12
|
#define ICE_COPYRIGHT "\251 ZeroC, Inc.\0"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
# define ICE_LIBNAME(NAME) NAME ICE_SO_VERSION ""
|
|
19
19
|
#endif
|
|
20
20
|
|
|
21
|
-
#ifndef
|
|
21
|
+
#ifndef _DEBUG
|
|
22
22
|
# define VER_DEBUG 0
|
|
23
23
|
#else
|
|
24
24
|
# define VER_DEBUG VS_FF_DEBUG
|
|
@@ -26,8 +26,8 @@ IceInternal::RetryTask::runTimerTask()
|
|
|
26
26
|
_outAsync->retry(); // Retry again the invocation.
|
|
27
27
|
|
|
28
28
|
//
|
|
29
|
-
// NOTE: this must be called last, destroy() blocks until all
|
|
30
|
-
// are removed to prevent the client thread pool
|
|
29
|
+
// NOTE: this must be called last, destroy() blocks until all tasks
|
|
30
|
+
// are removed to prevent the client thread pool from being destroyed
|
|
31
31
|
// (we still need the client thread pool at this point to call
|
|
32
32
|
// exception callbacks with CommunicatorDestroyedException).
|
|
33
33
|
//
|
|
@@ -135,17 +135,13 @@ bool
|
|
|
135
135
|
IceInternal::RetryQueue::cancel(const RetryTaskPtr& task)
|
|
136
136
|
{
|
|
137
137
|
lock_guard<mutex> lock(_mutex);
|
|
138
|
-
if
|
|
138
|
+
// Only remove the task if we cancel it in the timer before it runs. If timer()->cancel returns false, the
|
|
139
|
+
// task is already executing and runTimerTask will call remove() to erase it from _requests; erasing it
|
|
140
|
+
// here would make that remove() fail its assertion. When the queue is being destroyed (_instance is null)
|
|
141
|
+
// the timer is gone and every remaining task is running, so it is likewise removed by remove().
|
|
142
|
+
if (_instance && _instance->timer()->cancel(task))
|
|
139
143
|
{
|
|
140
|
-
|
|
141
|
-
{
|
|
142
|
-
return _instance->timer()->cancel(task);
|
|
143
|
-
}
|
|
144
|
-
else if (_requests.empty())
|
|
145
|
-
{
|
|
146
|
-
// If we are destroying the queue, destroy is probably waiting on the queue to be empty.
|
|
147
|
-
_conditionVariable.notify_one();
|
|
148
|
-
}
|
|
144
|
+
return _requests.erase(task) != 0;
|
|
149
145
|
}
|
|
150
146
|
return false;
|
|
151
147
|
}
|
|
@@ -105,16 +105,16 @@ IceInternal::SHA1::Hasher::finalize(vector<unsigned char>& md)
|
|
|
105
105
|
#if defined(_WIN32)
|
|
106
106
|
md.resize(SHA_DIGEST_LENGTH);
|
|
107
107
|
DWORD length = SHA_DIGEST_LENGTH;
|
|
108
|
-
if (!CryptGetHashParam(_hash, HP_HASHVAL,
|
|
108
|
+
if (!CryptGetHashParam(_hash, HP_HASHVAL, md.data(), &length, 0))
|
|
109
109
|
{
|
|
110
110
|
throw Ice::SyscallException{__FILE__, __LINE__, "CryptGetHashParam failed", GetLastError()};
|
|
111
111
|
}
|
|
112
112
|
#elif defined(__APPLE__)
|
|
113
113
|
md.resize(CC_SHA1_DIGEST_LENGTH);
|
|
114
|
-
CC_SHA1_Final(
|
|
114
|
+
CC_SHA1_Final(md.data(), &_ctx);
|
|
115
115
|
#else
|
|
116
116
|
md.resize(SHA_DIGEST_LENGTH);
|
|
117
|
-
SHA1_Final(
|
|
117
|
+
SHA1_Final(md.data(), &_ctx);
|
|
118
118
|
#endif
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -124,16 +124,16 @@ IceInternal::SHA1::Hasher::finalize(vector<byte>& md)
|
|
|
124
124
|
#if defined(_WIN32)
|
|
125
125
|
md.resize(SHA_DIGEST_LENGTH);
|
|
126
126
|
DWORD length = SHA_DIGEST_LENGTH;
|
|
127
|
-
if (!CryptGetHashParam(_hash, HP_HASHVAL, reinterpret_cast<unsigned char*>(
|
|
127
|
+
if (!CryptGetHashParam(_hash, HP_HASHVAL, reinterpret_cast<unsigned char*>(md.data()), &length, 0))
|
|
128
128
|
{
|
|
129
129
|
throw Ice::SyscallException{__FILE__, __LINE__, "CryptGetHashParam failed", GetLastError()};
|
|
130
130
|
}
|
|
131
131
|
#elif defined(__APPLE__)
|
|
132
132
|
md.resize(CC_SHA1_DIGEST_LENGTH);
|
|
133
|
-
CC_SHA1_Final(reinterpret_cast<unsigned char*>(
|
|
133
|
+
CC_SHA1_Final(reinterpret_cast<unsigned char*>(md.data()), &_ctx);
|
|
134
134
|
#else
|
|
135
135
|
md.resize(SHA_DIGEST_LENGTH);
|
|
136
|
-
SHA1_Final(reinterpret_cast<unsigned char*>(
|
|
136
|
+
SHA1_Final(reinterpret_cast<unsigned char*>(md.data()), &_ctx);
|
|
137
137
|
#endif
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -168,10 +168,10 @@ IceInternal::sha1(const unsigned char* data, size_t length, vector<unsigned char
|
|
|
168
168
|
hasher.finalize(md);
|
|
169
169
|
#elif defined(__APPLE__)
|
|
170
170
|
md.resize(CC_SHA1_DIGEST_LENGTH);
|
|
171
|
-
CC_SHA1(
|
|
171
|
+
CC_SHA1(data, static_cast<CC_LONG>(length), md.data());
|
|
172
172
|
#else
|
|
173
173
|
md.resize(SHA_DIGEST_LENGTH);
|
|
174
|
-
::SHA1(
|
|
174
|
+
::SHA1(data, length, md.data());
|
|
175
175
|
#endif
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -185,11 +185,11 @@ IceInternal::sha1(const byte* data, size_t length, vector<byte>& md)
|
|
|
185
185
|
#elif defined(__APPLE__)
|
|
186
186
|
md.resize(CC_SHA1_DIGEST_LENGTH);
|
|
187
187
|
CC_SHA1(
|
|
188
|
-
reinterpret_cast<const unsigned char*>(
|
|
188
|
+
reinterpret_cast<const unsigned char*>(data),
|
|
189
189
|
static_cast<CC_LONG>(length),
|
|
190
|
-
reinterpret_cast<unsigned char*>(
|
|
190
|
+
reinterpret_cast<unsigned char*>(md.data()));
|
|
191
191
|
#else
|
|
192
192
|
md.resize(SHA_DIGEST_LENGTH);
|
|
193
|
-
::SHA1(reinterpret_cast<const unsigned char*>(
|
|
193
|
+
::SHA1(reinterpret_cast<const unsigned char*>(data), length, reinterpret_cast<unsigned char*>(md.data()));
|
|
194
194
|
#endif
|
|
195
195
|
}
|
|
@@ -51,12 +51,6 @@ DistinguishedName::match(const DistinguishedName& other) const
|
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
bool
|
|
55
|
-
DistinguishedName::match(const string& other) const
|
|
56
|
-
{
|
|
57
|
-
return match(DistinguishedName(other));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
54
|
//
|
|
61
55
|
// This always produces the same output as the input DN -- the type of
|
|
62
56
|
// escaping is not changed.
|
|
@@ -47,12 +47,6 @@ namespace Ice::SSL
|
|
|
47
47
|
/// DistinguishedName and they have the same values.
|
|
48
48
|
[[nodiscard]] bool match(const DistinguishedName& dn) const;
|
|
49
49
|
|
|
50
|
-
/// Performs a partial match with another DistinguishedName.
|
|
51
|
-
/// @param dn The name to be matched.
|
|
52
|
-
/// @return `true` if all of the RDNs in the argument are present in this
|
|
53
|
-
/// DistinguishedName and they have the same values.
|
|
54
|
-
[[nodiscard]] bool match(const std::string& dn) const;
|
|
55
|
-
|
|
56
50
|
/// Encodes the DN in RFC2253 format.
|
|
57
51
|
/// @return An encoded string.
|
|
58
52
|
[[nodiscard]] std::string toString() const;
|
|
@@ -107,6 +107,11 @@ OpenSSL::SSLEngine::initialize()
|
|
|
107
107
|
|
|
108
108
|
_password = properties->getIceProperty("IceSSL.Password");
|
|
109
109
|
|
|
110
|
+
// Register the password callback so IceSSL.Password is used when loading an encrypted PEM private key.
|
|
111
|
+
// Without it, OpenSSL falls back to its default tty prompt.
|
|
112
|
+
SSL_CTX_set_default_passwd_cb(_ctx, Ice_SSL_opensslPasswordCallback);
|
|
113
|
+
SSL_CTX_set_default_passwd_cb_userdata(_ctx, this);
|
|
114
|
+
|
|
110
115
|
// Establish the location of CA certificates.
|
|
111
116
|
{
|
|
112
117
|
string path = properties->getIceProperty("IceSSL.CAs");
|
|
@@ -188,9 +193,15 @@ OpenSSL::SSLEngine::initialize()
|
|
|
188
193
|
// First we try to load the certificate using PKCS12 format if that fails we fallback to PEM format.
|
|
189
194
|
vector<char> buffer;
|
|
190
195
|
readFile(*resolved, buffer);
|
|
196
|
+
if (buffer.empty())
|
|
197
|
+
{
|
|
198
|
+
ostringstream os;
|
|
199
|
+
os << "IceSSL: certificate file is empty '" << *resolved << "'";
|
|
200
|
+
throw InitializationException(__FILE__, __LINE__, os.str());
|
|
201
|
+
}
|
|
191
202
|
int success = 0;
|
|
192
203
|
|
|
193
|
-
const unsigned char* b = reinterpret_cast<unsigned char*>(
|
|
204
|
+
const unsigned char* b = reinterpret_cast<unsigned char*>(buffer.data());
|
|
194
205
|
PKCS12* p12 = d2i_PKCS12(nullptr, &b, static_cast<long>(buffer.size()));
|
|
195
206
|
if (p12)
|
|
196
207
|
{
|
|
@@ -252,6 +263,9 @@ OpenSSL::SSLEngine::initialize()
|
|
|
252
263
|
{
|
|
253
264
|
if (!SSL_CTX_add_extra_chain_cert(_ctx, c))
|
|
254
265
|
{
|
|
266
|
+
// On failure ownership of c is not transferred to _ctx, so free it here;
|
|
267
|
+
// the catch below only frees the certs still on the stack.
|
|
268
|
+
X509_free(c);
|
|
255
269
|
ostringstream os;
|
|
256
270
|
os << "IceSSL: unable to add extra SSL certificate:\n" << sslErrors();
|
|
257
271
|
throw InitializationException(__FILE__, __LINE__, os.str());
|