zeroc-ice 3.8.0 → 3.8.2
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/Operation.cpp +22 -6
- data/dist/IceRuby/Slice.cpp +1 -1
- data/dist/ice/cpp/include/Ice/Communicator.h +4 -4
- data/dist/ice/cpp/include/Ice/Config.h +2 -2
- data/dist/ice/cpp/include/Ice/Connection.h +3 -3
- data/dist/ice/cpp/include/Ice/Endpoint.h +2 -2
- data/dist/ice/cpp/include/Ice/Exception.h +1 -1
- data/dist/ice/cpp/include/Ice/Initialize.h +1 -1
- data/dist/ice/cpp/include/Ice/LocalExceptions.h +22 -1
- data/dist/ice/cpp/include/Ice/Logger.h +3 -3
- data/dist/ice/cpp/include/Ice/NativePropertiesAdmin.h +2 -0
- data/dist/ice/cpp/include/Ice/ObjectAdapter.h +3 -3
- data/dist/ice/cpp/include/Ice/ObserverHelper.h +1 -0
- data/dist/ice/cpp/include/Ice/OutputStream.h +27 -5
- data/dist/ice/cpp/include/Ice/Properties.h +3 -3
- data/dist/ice/cpp/include/Ice/Proxy.h +1 -1
- data/dist/ice/cpp/include/Ice/SSL/ClientAuthenticationOptions.h +10 -2
- data/dist/ice/cpp/include/Ice/SSL/ServerAuthenticationOptions.h +10 -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 +9 -11
- data/dist/ice/cpp/include/generated/Ice/LocatorRegistry.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Metrics.h +7 -7
- data/dist/ice/cpp/include/generated/Ice/OperationMode.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/Process.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/PropertiesAdmin.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/PropertyDict.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/RemoteLogger.h +2 -2
- data/dist/ice/cpp/include/generated/Ice/ReplyStatus.h +8 -4
- data/dist/ice/cpp/include/generated/Ice/Router.h +7 -7
- 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 +2 -2
- data/dist/ice/cpp/include/generated/IceLocatorDiscovery/Lookup.h +2 -2
- data/dist/ice/cpp/src/Ice/CollocatedRequestHandler.cpp +5 -3
- data/dist/ice/cpp/src/Ice/ConnectionFactory.h +8 -8
- data/dist/ice/cpp/src/Ice/ConnectionI.cpp +28 -11
- data/dist/ice/cpp/src/Ice/ConnectionI.h +1 -1
- data/dist/ice/cpp/src/Ice/Demangle.cpp +1 -0
- data/dist/ice/cpp/src/Ice/FileUtil.cpp +3 -67
- data/dist/ice/cpp/src/Ice/FileUtil.h +0 -3
- data/dist/ice/cpp/src/Ice/IPEndpointI.cpp +4 -0
- data/dist/ice/cpp/src/Ice/IncomingRequest.cpp +1 -1
- data/dist/ice/cpp/src/Ice/InputStream.cpp +28 -17
- data/dist/ice/cpp/src/Ice/LocalException.cpp +1 -1
- data/dist/ice/cpp/src/Ice/LocalExceptions.cpp +6 -0
- data/dist/ice/cpp/src/Ice/OutgoingAsync.cpp +1 -1
- data/dist/ice/cpp/src/Ice/OutgoingResponse.cpp +127 -127
- data/dist/ice/cpp/src/Ice/OutgoingResponseInternal.h +21 -0
- data/dist/ice/cpp/src/Ice/OutputStream.cpp +80 -115
- data/dist/ice/cpp/src/Ice/PropertyNames.cpp +3 -2
- data/dist/ice/cpp/src/Ice/ProxyFunctions.cpp +4 -4
- data/dist/ice/cpp/src/Ice/Reference.cpp +15 -15
- data/dist/ice/cpp/src/Ice/ReferenceFactory.cpp +16 -13
- data/dist/ice/cpp/src/Ice/ResourceConfig.h +2 -2
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.cpp +29 -20
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLEngine.h +1 -2
- data/dist/ice/cpp/src/Ice/SSL/OpenSSLTransceiverI.cpp +14 -3
- data/dist/ice/cpp/src/Ice/SSL/RFC2253.cpp +3 -3
- data/dist/ice/cpp/src/Ice/SSL/SSLEndpointI.cpp +1 -1
- data/dist/ice/cpp/src/Ice/SSL/SSLEngine.h +4 -10
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.cpp +21 -2
- data/dist/ice/cpp/src/Ice/SSL/SSLUtil.h +15 -1
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.cpp +67 -48
- data/dist/ice/cpp/src/Ice/SSL/SchannelEngine.h +1 -5
- data/dist/ice/cpp/src/Ice/SSL/SchannelTransceiverI.cpp +14 -2
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.cpp +111 -15
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportEngine.h +7 -2
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportTransceiverI.h +1 -1
- data/dist/ice/cpp/src/Ice/SSL/SecureTransportUtil.cpp +3 -16
- data/dist/ice/cpp/src/Ice/SSL/TrustManager.cpp +12 -1
- data/dist/ice/cpp/src/Ice/ServantManager.h +1 -1
- data/dist/ice/cpp/src/Ice/StringConverter.cpp +4 -0
- data/dist/ice/cpp/src/Ice/TcpEndpointI.cpp +2 -2
- data/dist/ice/cpp/src/Ice/UdpEndpointI.cpp +2 -2
- data/dist/ice/cpp/src/Ice/WSAcceptor.cpp +8 -3
- data/dist/ice/cpp/src/Ice/WSAcceptor.h +5 -1
- data/dist/ice/cpp/src/Ice/WSEndpoint.cpp +45 -2
- data/dist/ice/cpp/src/Ice/WSTransceiver.cpp +118 -7
- data/dist/ice/cpp/src/Ice/WSTransceiver.h +12 -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 +4 -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/LocatorI.cpp +2 -2
- data/dist/ice/cpp/src/IceDiscovery/LookupI.cpp +4 -3
- data/dist/ice/cpp/src/IceDiscovery/LookupI.h +2 -1
- data/dist/ice/cpp/src/IceDiscovery/generated/Lookup.cpp +2 -2
- data/dist/ice/cpp/src/IceLocatorDiscovery/PluginI.cpp +6 -18
- data/dist/ice/cpp/src/IceLocatorDiscovery/generated/Lookup.cpp +2 -2
- data/dist/ice/cpp/src/Slice/DocCommentParser.cpp +6 -6
- data/dist/ice/cpp/src/Slice/DocCommentParser.h +4 -2
- data/dist/ice/cpp/src/Slice/FileTracker.h +1 -0
- data/dist/ice/cpp/src/Slice/Grammar.cpp +261 -264
- data/dist/ice/cpp/src/Slice/MetadataValidation.cpp +39 -7
- data/dist/ice/cpp/src/Slice/MetadataValidation.h +3 -2
- data/dist/ice/cpp/src/Slice/Parser.cpp +192 -155
- data/dist/ice/cpp/src/Slice/Parser.h +44 -9
- data/dist/ice/cpp/src/Slice/Preprocessor.cpp +76 -20
- data/dist/ice/cpp/src/Slice/Preprocessor.h +0 -1
- data/dist/ice/cpp/src/Slice/Scanner.cpp +1 -1
- data/dist/ice/cpp/src/Slice/SliceUtil.cpp +44 -58
- data/dist/ice/cpp/src/Slice/StringLiteralUtil.cpp +3 -10
- data/dist/ice/cpp/src/Slice/Util.h +7 -3
- data/dist/ice/cpp/src/slice2rb/Main.cpp +2 -2
- data/dist/ice/cpp/src/slice2rb/Ruby.cpp +1 -1
- data/dist/ice/cpp/src/slice2rb/RubyUtil.cpp +10 -8
- data/dist/ice/cpp/src/slice2rb/RubyUtil.h +10 -13
- data/dist/ice/mcpp/directive.c +5 -2
- data/dist/ice/mcpp/mcpp_main.c +1 -1
- data/dist/ice/mcpp/support.c +6 -6
- data/dist/ice/mcpp/system.c +5 -5
- data/dist/ice/slice/Ice/Identity.ice +3 -0
- data/dist/ice/slice/Ice/Locator.ice +6 -5
- data/dist/ice/slice/Ice/LocatorRegistry.ice +3 -0
- data/dist/ice/slice/Ice/Metrics.ice +1 -1
- data/dist/ice/slice/Ice/OperationMode.ice +8 -0
- data/dist/ice/slice/Ice/Process.ice +3 -0
- data/dist/ice/slice/Ice/ReplyStatus.ice +13 -0
- data/dist/lib/Glacier2/Metrics.rb +1 -1
- data/dist/lib/Glacier2/PermissionsVerifier.rb +3 -3
- data/dist/lib/Glacier2/Router.rb +8 -8
- data/dist/lib/Glacier2/SSLInfo.rb +1 -1
- data/dist/lib/Glacier2/Session.rb +15 -15
- data/dist/lib/Ice/BuiltinSequences.rb +1 -1
- data/dist/lib/Ice/Context.rb +1 -1
- data/dist/lib/Ice/EndpointTypes.rb +1 -1
- data/dist/lib/Ice/Identity.rb +1 -1
- data/dist/lib/Ice/LocalExceptions.rb +3 -0
- data/dist/lib/Ice/Locator.rb +5 -5
- data/dist/lib/Ice/LocatorRegistry.rb +4 -4
- data/dist/lib/Ice/Metrics.rb +7 -7
- data/dist/lib/Ice/OperationMode.rb +1 -1
- data/dist/lib/Ice/Process.rb +3 -3
- data/dist/lib/Ice/PropertiesAdmin.rb +4 -4
- data/dist/lib/Ice/PropertyDict.rb +1 -1
- data/dist/lib/Ice/ProxyFunctions.rb +8 -4
- data/dist/lib/Ice/RemoteLogger.rb +6 -6
- data/dist/lib/Ice/ReplyStatus.rb +3 -2
- data/dist/lib/Ice/Router.rb +5 -5
- data/dist/lib/Ice/SliceChecksumDict.rb +1 -1
- data/dist/lib/Ice/Version.rb +1 -1
- data/dist/lib/IceBox/ServiceManager.rb +8 -8
- data/dist/lib/IceGrid/Admin.rb +83 -83
- data/dist/lib/IceGrid/Descriptor.rb +1 -1
- data/dist/lib/IceGrid/Exception.rb +1 -1
- data/dist/lib/IceGrid/FileParser.rb +2 -2
- data/dist/lib/IceGrid/Registry.rb +13 -13
- data/dist/lib/IceGrid/Session.rb +6 -6
- data/dist/lib/IceGrid/UserAccountMapper.rb +2 -2
- data/dist/lib/IceStorm/IceStorm.rb +16 -16
- data/dist/lib/IceStorm/Metrics.rb +1 -1
- data/ice.gemspec +1 -1
- metadata +2 -1
|
@@ -68,6 +68,10 @@ Ice::OutputStream::OutputStream(
|
|
|
68
68
|
_format(format),
|
|
69
69
|
_currentEncaps(nullptr)
|
|
70
70
|
{
|
|
71
|
+
if (!_wstringConverter)
|
|
72
|
+
{
|
|
73
|
+
_wstringConverter = getProcessWstringConverter();
|
|
74
|
+
}
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
Ice::OutputStream::OutputStream(
|
|
@@ -85,6 +89,11 @@ Ice::OutputStream::OutputStream(
|
|
|
85
89
|
_currentEncaps(nullptr)
|
|
86
90
|
{
|
|
87
91
|
b.reset();
|
|
92
|
+
|
|
93
|
+
if (!_wstringConverter)
|
|
94
|
+
{
|
|
95
|
+
_wstringConverter = getProcessWstringConverter();
|
|
96
|
+
}
|
|
88
97
|
}
|
|
89
98
|
|
|
90
99
|
Ice::OutputStream::OutputStream(const CommunicatorPtr& communicator, EncodingVersion encoding)
|
|
@@ -104,6 +113,7 @@ Ice::OutputStream::OutputStream(Instance* instance, EncodingVersion encoding)
|
|
|
104
113
|
instance->getStringConverter(),
|
|
105
114
|
instance->getWstringConverter())
|
|
106
115
|
{
|
|
116
|
+
assert(_wstringConverter);
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
Ice::OutputStream::OutputStream(OutputStream&& other) noexcept
|
|
@@ -116,6 +126,7 @@ Ice::OutputStream::OutputStream(OutputStream&& other) noexcept
|
|
|
116
126
|
_currentEncaps(other._currentEncaps)
|
|
117
127
|
{
|
|
118
128
|
// Reset other to its default state.
|
|
129
|
+
other._wstringConverter = getProcessWstringConverter();
|
|
119
130
|
other._closure = nullptr;
|
|
120
131
|
other._encoding = Encoding_1_1;
|
|
121
132
|
other._format = FormatType::CompactFormat;
|
|
@@ -140,6 +151,7 @@ Ice::OutputStream::operator=(OutputStream&& other) noexcept
|
|
|
140
151
|
_currentEncaps = other._currentEncaps;
|
|
141
152
|
|
|
142
153
|
// Reset other to its default state.
|
|
154
|
+
other._wstringConverter = getProcessWstringConverter();
|
|
143
155
|
other._closure = nullptr;
|
|
144
156
|
other._encoding = Encoding_1_1;
|
|
145
157
|
other._format = FormatType::CompactFormat;
|
|
@@ -703,80 +715,54 @@ Ice::OutputStream::write(const char*)
|
|
|
703
715
|
void
|
|
704
716
|
Ice::OutputStream::writeConverted(const char* vdata, size_t vsize)
|
|
705
717
|
{
|
|
718
|
+
if (!_stringConverter)
|
|
719
|
+
{
|
|
720
|
+
// No converter installed; write the string as-is (assumed to be UTF-8 already).
|
|
721
|
+
writeSize(static_cast<int32_t>(vsize));
|
|
722
|
+
Container::size_type position = b.size();
|
|
723
|
+
resize(position + vsize);
|
|
724
|
+
memcpy(&b[position], vdata, vsize);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
|
|
706
728
|
//
|
|
707
|
-
//
|
|
708
|
-
//
|
|
709
|
-
//
|
|
729
|
+
// Convert the narrow string to UTF-8 using the string converter and write the result to the stream.
|
|
730
|
+
//
|
|
731
|
+
// The worst-case expansion for converting a narrow string to UTF-8 is 3x (e.g., a single byte in Shift_JIS can
|
|
732
|
+
// expand to 3 bytes in UTF-8). We use this upper bound to decide the size encoding:
|
|
733
|
+
// - If vsize <= 254 / 3 (84), the converted string is at most 252 bytes, which always fits in a 1-byte size.
|
|
734
|
+
// - Otherwise, we use the 5-byte size encoding to avoid guessing and memmove fixups.
|
|
710
735
|
//
|
|
711
736
|
try
|
|
712
737
|
{
|
|
713
|
-
|
|
714
|
-
writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
|
|
715
|
-
|
|
716
|
-
size_t firstIndex = b.size();
|
|
717
|
-
StreamUTF8BufferI buffer(*this);
|
|
718
|
-
|
|
719
|
-
byte* lastByte = nullptr;
|
|
720
|
-
bool converted = false;
|
|
721
|
-
|
|
722
|
-
StringConverterPtr stringConverter = _stringConverter;
|
|
723
|
-
if (!stringConverter)
|
|
738
|
+
if (vsize <= 254 / 3)
|
|
724
739
|
{
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
if (stringConverter)
|
|
728
|
-
{
|
|
729
|
-
lastByte = stringConverter->toUTF8(vdata, vdata + vsize, buffer);
|
|
730
|
-
converted = true;
|
|
731
|
-
}
|
|
740
|
+
// The maximum UTF-8 size is vsize * 3 <= 252, which fits in a 1-byte size encoding.
|
|
741
|
+
auto sizePos = startOneByteSize();
|
|
732
742
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
}
|
|
743
|
+
StreamUTF8BufferI buffer(*this);
|
|
744
|
+
byte* lastByte = _stringConverter->toUTF8(vdata, vdata + vsize, buffer);
|
|
745
|
+
if (lastByte != b.end())
|
|
746
|
+
{
|
|
747
|
+
resize(static_cast<size_t>(lastByte - b.begin()));
|
|
748
|
+
}
|
|
740
749
|
|
|
741
|
-
|
|
742
|
-
{
|
|
743
|
-
resize(static_cast<size_t>(lastByte - b.begin()));
|
|
750
|
+
endOneByteSize(sizePos);
|
|
744
751
|
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
auto actualSize = static_cast<int32_t>(lastIndex - firstIndex);
|
|
748
|
-
|
|
749
|
-
//
|
|
750
|
-
// Check against the guess
|
|
751
|
-
//
|
|
752
|
-
if (guessedSize != actualSize)
|
|
752
|
+
else
|
|
753
753
|
{
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
// Move the UTF-8 sequence 4 bytes further
|
|
758
|
-
// Use memmove instead of memcpy since the source and destination typically overlap.
|
|
759
|
-
//
|
|
760
|
-
resize(b.size() + 4);
|
|
761
|
-
memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, static_cast<size_t>(actualSize));
|
|
762
|
-
}
|
|
763
|
-
else if (guessedSize > 254 && actualSize <= 254)
|
|
764
|
-
{
|
|
765
|
-
//
|
|
766
|
-
// Move the UTF-8 sequence 4 bytes back
|
|
767
|
-
//
|
|
768
|
-
memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, static_cast<size_t>(actualSize));
|
|
769
|
-
resize(b.size() - 4);
|
|
770
|
-
}
|
|
754
|
+
// Write the first byte of the 5-byte size encoding, followed by a 4-byte size placeholder.
|
|
755
|
+
write(uint8_t(255));
|
|
756
|
+
auto sizePos = startSize();
|
|
771
757
|
|
|
772
|
-
|
|
758
|
+
StreamUTF8BufferI buffer(*this);
|
|
759
|
+
byte* lastByte = _stringConverter->toUTF8(vdata, vdata + vsize, buffer);
|
|
760
|
+
if (lastByte != b.end())
|
|
773
761
|
{
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
else
|
|
777
|
-
{
|
|
778
|
-
rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
|
|
762
|
+
resize(static_cast<size_t>(lastByte - b.begin()));
|
|
779
763
|
}
|
|
764
|
+
|
|
765
|
+
endSize(sizePos);
|
|
780
766
|
}
|
|
781
767
|
}
|
|
782
768
|
catch (const Ice::IllegalConversionException& ex)
|
|
@@ -808,68 +794,47 @@ Ice::OutputStream::write(wstring_view v)
|
|
|
808
794
|
return;
|
|
809
795
|
}
|
|
810
796
|
|
|
811
|
-
|
|
812
|
-
// What is the size of the resulting UTF-8 encoded string?
|
|
813
|
-
// Impossible to tell, so we guess. If we don't guess correctly,
|
|
814
|
-
// we'll have to fix the mistake afterwards
|
|
815
|
-
//
|
|
816
|
-
try
|
|
817
|
-
{
|
|
818
|
-
auto guessedSize = static_cast<int32_t>(v.size());
|
|
819
|
-
writeSize(guessedSize); // writeSize() only writes the size; it does not reserve any buffer space.
|
|
797
|
+
assert(_wstringConverter);
|
|
820
798
|
|
|
821
|
-
|
|
822
|
-
|
|
799
|
+
// The worst-case expansion for converting a wide string to UTF-8 is 3x or 4x depending on the platform.
|
|
800
|
+
const size_t factor = sizeof(wchar_t) == 2 ? 3 : 4;
|
|
823
801
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
if (
|
|
802
|
+
try
|
|
803
|
+
{
|
|
804
|
+
// (252 / 3 = 84, 252 / 4 = 63)
|
|
805
|
+
if (v.size() <= 252 / factor)
|
|
828
806
|
{
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
807
|
+
// The maximum UTF-8 size is v.size() * factor <= 252, which fits in a 1-byte size encoding.
|
|
808
|
+
// We use this upper bound to decide the size encoding:
|
|
809
|
+
// - If v.size() <= 252 / factor, the converted string is at most 252 bytes, which always fits in a 1-byte
|
|
810
|
+
// size.
|
|
811
|
+
// - Otherwise, we use the 5-byte size encoding to avoid guessing and memmove fixups.
|
|
812
|
+
auto sizePos = startOneByteSize();
|
|
813
|
+
|
|
814
|
+
StreamUTF8BufferI buffer(*this);
|
|
815
|
+
byte* lastByte = _wstringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
|
|
816
|
+
if (lastByte != b.end())
|
|
817
|
+
{
|
|
818
|
+
resize(static_cast<size_t>(lastByte - b.begin()));
|
|
819
|
+
}
|
|
833
820
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
resize(static_cast<size_t>(lastByte - b.begin()));
|
|
821
|
+
endOneByteSize(sizePos);
|
|
822
|
+
return;
|
|
837
823
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
auto actualSize = static_cast<int32_t>(lastIndex - firstIndex);
|
|
841
|
-
|
|
842
|
-
//
|
|
843
|
-
// Check against the guess
|
|
844
|
-
//
|
|
845
|
-
if (guessedSize != actualSize)
|
|
824
|
+
else
|
|
846
825
|
{
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
// Move the UTF-8 sequence 4 bytes further
|
|
851
|
-
// Use memmove instead of memcpy since the source and destination typically overlap.
|
|
852
|
-
//
|
|
853
|
-
resize(b.size() + 4);
|
|
854
|
-
memmove(b.begin() + firstIndex + 4, b.begin() + firstIndex, static_cast<size_t>(actualSize));
|
|
855
|
-
}
|
|
856
|
-
else if (guessedSize > 254 && actualSize <= 254)
|
|
857
|
-
{
|
|
858
|
-
//
|
|
859
|
-
// Move the UTF-8 sequence 4 bytes back
|
|
860
|
-
//
|
|
861
|
-
memmove(b.begin() + firstIndex - 4, b.begin() + firstIndex, static_cast<size_t>(actualSize));
|
|
862
|
-
resize(b.size() - 4);
|
|
863
|
-
}
|
|
826
|
+
// Write the first byte of the 5-byte size encoding, followed by a 4-byte size placeholder.
|
|
827
|
+
write(uint8_t(255));
|
|
828
|
+
auto sizePos = startSize();
|
|
864
829
|
|
|
865
|
-
|
|
830
|
+
StreamUTF8BufferI buffer(*this);
|
|
831
|
+
byte* lastByte = _wstringConverter->toUTF8(v.data(), v.data() + v.size(), buffer);
|
|
832
|
+
if (lastByte != b.end())
|
|
866
833
|
{
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
else
|
|
870
|
-
{
|
|
871
|
-
rewriteSize(actualSize, b.begin() + firstIndex - 1 - 4);
|
|
834
|
+
resize(static_cast<size_t>(lastByte - b.begin()));
|
|
872
835
|
}
|
|
836
|
+
|
|
837
|
+
endSize(sizePos);
|
|
873
838
|
}
|
|
874
839
|
}
|
|
875
840
|
catch (const Ice::IllegalConversionException& ex)
|
|
@@ -70,6 +70,7 @@ const PropertyArray PropertyNames::ThreadPoolProps
|
|
|
70
70
|
const Property ObjectAdapterPropsData[] =
|
|
71
71
|
{
|
|
72
72
|
Property{"AdapterId", "", false, false, nullptr},
|
|
73
|
+
Property{"AllowedOrigins", "", false, false, nullptr},
|
|
73
74
|
Property{"Connection", "", false, false, &PropertyNames::ConnectionProps},
|
|
74
75
|
Property{"Endpoints", "", false, false, nullptr},
|
|
75
76
|
Property{"Locator", "", false, false, &PropertyNames::ProxyProps},
|
|
@@ -89,7 +90,7 @@ const PropertyArray PropertyNames::ObjectAdapterProps
|
|
|
89
90
|
.prefixOnly=true,
|
|
90
91
|
.isOptIn=false,
|
|
91
92
|
.properties=ObjectAdapterPropsData,
|
|
92
|
-
.length=
|
|
93
|
+
.length=13
|
|
93
94
|
};
|
|
94
95
|
|
|
95
96
|
const Property IcePropsData[] =
|
|
@@ -428,7 +429,7 @@ const Property IceSSLPropsData[] =
|
|
|
428
429
|
Property{"KeyFile", "", false, false, nullptr},
|
|
429
430
|
Property{"Password", "", false, false, nullptr},
|
|
430
431
|
Property{"RevocationCheck", "0", false, false, nullptr},
|
|
431
|
-
Property{"RevocationCheckCacheOnly", "
|
|
432
|
+
Property{"RevocationCheckCacheOnly", "1", false, false, nullptr},
|
|
432
433
|
Property{"Trace.Security", "0", false, false, nullptr},
|
|
433
434
|
Property{"TrustOnly", "", false, false, nullptr},
|
|
434
435
|
Property{"TrustOnly.Client", "", false, false, nullptr},
|
|
@@ -53,8 +53,8 @@ Ice::proxyIdentityAndFacetLess(const optional<ObjectPrx>& lhs, const optional<Ob
|
|
|
53
53
|
{
|
|
54
54
|
if (lhs && rhs)
|
|
55
55
|
{
|
|
56
|
-
Identity lhsIdentity = lhs->ice_getIdentity();
|
|
57
|
-
Identity rhsIdentity = rhs->ice_getIdentity();
|
|
56
|
+
const Identity& lhsIdentity = lhs->ice_getIdentity();
|
|
57
|
+
const Identity& rhsIdentity = rhs->ice_getIdentity();
|
|
58
58
|
|
|
59
59
|
if (lhsIdentity < rhsIdentity)
|
|
60
60
|
{
|
|
@@ -65,8 +65,8 @@ Ice::proxyIdentityAndFacetLess(const optional<ObjectPrx>& lhs, const optional<Ob
|
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
string lhsFacet = lhs->ice_getFacet();
|
|
69
|
-
string rhsFacet = rhs->ice_getFacet();
|
|
68
|
+
const string& lhsFacet = lhs->ice_getFacet();
|
|
69
|
+
const string& rhsFacet = rhs->ice_getFacet();
|
|
70
70
|
|
|
71
71
|
return lhsFacet < rhsFacet;
|
|
72
72
|
}
|
|
@@ -549,7 +549,7 @@ IceInternal::FixedReference::changeConnectionId(string) const
|
|
|
549
549
|
ReferencePtr
|
|
550
550
|
IceInternal::FixedReference::changeConnection(Ice::ConnectionIPtr newConnection) const
|
|
551
551
|
{
|
|
552
|
-
FixedReferencePtr r =
|
|
552
|
+
FixedReferencePtr r = static_pointer_cast<FixedReference>(clone());
|
|
553
553
|
r->_fixedConnection = std::move(newConnection);
|
|
554
554
|
return r;
|
|
555
555
|
}
|
|
@@ -787,7 +787,7 @@ IceInternal::RoutableReference::changeEncoding(Ice::EncodingVersion encoding) co
|
|
|
787
787
|
ReferencePtr r = Reference::changeEncoding(encoding);
|
|
788
788
|
if (r.get() != const_cast<RoutableReference*>(this))
|
|
789
789
|
{
|
|
790
|
-
LocatorInfoPtr& locInfo =
|
|
790
|
+
LocatorInfoPtr& locInfo = static_pointer_cast<RoutableReference>(r)->_locatorInfo;
|
|
791
791
|
if (locInfo && locInfo->getLocator()->ice_getEncodingVersion() != encoding)
|
|
792
792
|
{
|
|
793
793
|
locInfo = getInstance()->locatorManager()->get(locInfo->getLocator()->ice_encodingVersion(encoding));
|
|
@@ -809,7 +809,7 @@ IceInternal::RoutableReference::changeCompress(bool newCompress) const
|
|
|
809
809
|
{
|
|
810
810
|
newEndpoints.push_back(endpoint->compress(newCompress));
|
|
811
811
|
}
|
|
812
|
-
|
|
812
|
+
static_pointer_cast<RoutableReference>(r)->_endpoints = std::move(newEndpoints);
|
|
813
813
|
}
|
|
814
814
|
return r;
|
|
815
815
|
}
|
|
@@ -817,7 +817,7 @@ IceInternal::RoutableReference::changeCompress(bool newCompress) const
|
|
|
817
817
|
ReferencePtr
|
|
818
818
|
IceInternal::RoutableReference::changeEndpoints(vector<EndpointIPtr> newEndpoints) const
|
|
819
819
|
{
|
|
820
|
-
RoutableReferencePtr r =
|
|
820
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
821
821
|
r->_endpoints = std::move(newEndpoints);
|
|
822
822
|
r->applyOverrides(r->_endpoints);
|
|
823
823
|
r->_adapterId.clear();
|
|
@@ -827,7 +827,7 @@ IceInternal::RoutableReference::changeEndpoints(vector<EndpointIPtr> newEndpoint
|
|
|
827
827
|
ReferencePtr
|
|
828
828
|
IceInternal::RoutableReference::changeAdapterId(string newAdapterId) const
|
|
829
829
|
{
|
|
830
|
-
RoutableReferencePtr r =
|
|
830
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
831
831
|
r->_adapterId = std::move(newAdapterId);
|
|
832
832
|
r->_endpoints.clear();
|
|
833
833
|
return r;
|
|
@@ -837,7 +837,7 @@ ReferencePtr
|
|
|
837
837
|
IceInternal::RoutableReference::changeLocator(optional<LocatorPrx> newLocator) const
|
|
838
838
|
{
|
|
839
839
|
LocatorInfoPtr newLocatorInfo = newLocator ? getInstance()->locatorManager()->get(newLocator.value()) : nullptr;
|
|
840
|
-
RoutableReferencePtr r =
|
|
840
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
841
841
|
r->_locatorInfo = std::move(newLocatorInfo);
|
|
842
842
|
return r;
|
|
843
843
|
}
|
|
@@ -846,7 +846,7 @@ ReferencePtr
|
|
|
846
846
|
IceInternal::RoutableReference::changeRouter(optional<RouterPrx> newRouter) const
|
|
847
847
|
{
|
|
848
848
|
RouterInfoPtr newRouterInfo = newRouter ? getInstance()->routerManager()->get(newRouter.value()) : nullptr;
|
|
849
|
-
RoutableReferencePtr r =
|
|
849
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
850
850
|
r->_routerInfo = std::move(newRouterInfo);
|
|
851
851
|
return r;
|
|
852
852
|
}
|
|
@@ -854,7 +854,7 @@ IceInternal::RoutableReference::changeRouter(optional<RouterPrx> newRouter) cons
|
|
|
854
854
|
ReferencePtr
|
|
855
855
|
IceInternal::RoutableReference::changeCollocationOptimized(bool newCollocationOptimized) const
|
|
856
856
|
{
|
|
857
|
-
RoutableReferencePtr r =
|
|
857
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
858
858
|
r->_collocationOptimized = newCollocationOptimized;
|
|
859
859
|
return r;
|
|
860
860
|
}
|
|
@@ -862,7 +862,7 @@ IceInternal::RoutableReference::changeCollocationOptimized(bool newCollocationOp
|
|
|
862
862
|
ReferencePtr
|
|
863
863
|
IceInternal::RoutableReference::changeCacheConnection(bool newCache) const
|
|
864
864
|
{
|
|
865
|
-
RoutableReferencePtr r =
|
|
865
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
866
866
|
r->_cacheConnection = newCache;
|
|
867
867
|
return r;
|
|
868
868
|
}
|
|
@@ -870,7 +870,7 @@ IceInternal::RoutableReference::changeCacheConnection(bool newCache) const
|
|
|
870
870
|
ReferencePtr
|
|
871
871
|
IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType newType) const
|
|
872
872
|
{
|
|
873
|
-
RoutableReferencePtr r =
|
|
873
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
874
874
|
r->_endpointSelection = newType;
|
|
875
875
|
return r;
|
|
876
876
|
}
|
|
@@ -878,7 +878,7 @@ IceInternal::RoutableReference::changeEndpointSelection(EndpointSelectionType ne
|
|
|
878
878
|
ReferencePtr
|
|
879
879
|
IceInternal::RoutableReference::changeLocatorCacheTimeout(chrono::milliseconds timeout) const
|
|
880
880
|
{
|
|
881
|
-
RoutableReferencePtr r =
|
|
881
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
882
882
|
r->_locatorCacheTimeout = timeout;
|
|
883
883
|
return r;
|
|
884
884
|
}
|
|
@@ -886,7 +886,7 @@ IceInternal::RoutableReference::changeLocatorCacheTimeout(chrono::milliseconds t
|
|
|
886
886
|
ReferencePtr
|
|
887
887
|
IceInternal::RoutableReference::changeConnectionId(string id) const
|
|
888
888
|
{
|
|
889
|
-
RoutableReferencePtr r =
|
|
889
|
+
RoutableReferencePtr r = static_pointer_cast<RoutableReference>(clone());
|
|
890
890
|
r->_connectionId = id;
|
|
891
891
|
if (!_endpoints.empty()) // Also override the connection id on the endpoints.
|
|
892
892
|
{
|
|
@@ -896,7 +896,7 @@ IceInternal::RoutableReference::changeConnectionId(string id) const
|
|
|
896
896
|
{
|
|
897
897
|
newEndpoints.push_back(endpoint->connectionId(id));
|
|
898
898
|
}
|
|
899
|
-
r->_endpoints = newEndpoints;
|
|
899
|
+
r->_endpoints = std::move(newEndpoints);
|
|
900
900
|
}
|
|
901
901
|
return r;
|
|
902
902
|
}
|
|
@@ -1259,7 +1259,7 @@ IceInternal::RoutableReference::getConnectionAsync(
|
|
|
1259
1259
|
if (_routerInfo)
|
|
1260
1260
|
{
|
|
1261
1261
|
// If we route, we send everything to the router's client proxy endpoints.
|
|
1262
|
-
auto self =
|
|
1262
|
+
auto self = static_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
|
|
1263
1263
|
|
|
1264
1264
|
_routerInfo->getClientEndpointsAsync(
|
|
1265
1265
|
[self = std::move(self), response = std::move(response), exception](vector<EndpointIPtr> endpoints) mutable
|
|
@@ -1364,7 +1364,7 @@ IceInternal::RoutableReference::getConnectionNoRouterInfoAsync(
|
|
|
1364
1364
|
if (_locatorInfo)
|
|
1365
1365
|
{
|
|
1366
1366
|
RoutableReferencePtr self =
|
|
1367
|
-
|
|
1367
|
+
static_pointer_cast<RoutableReference>(const_cast<RoutableReference*>(this)->shared_from_this());
|
|
1368
1368
|
_locatorInfo->getEndpoints(
|
|
1369
1369
|
self,
|
|
1370
1370
|
_locatorCacheTimeout,
|
|
@@ -93,13 +93,14 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
93
93
|
return nullptr;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const
|
|
96
|
+
static constexpr const char* whitespace = " \t\r\n";
|
|
97
|
+
static constexpr const char* whitespaceOrSeparator = " \t\r\n:@";
|
|
97
98
|
|
|
98
|
-
string s
|
|
99
|
+
string s{str};
|
|
99
100
|
string::size_type beg;
|
|
100
101
|
string::size_type end = 0;
|
|
101
102
|
|
|
102
|
-
beg = s.find_first_not_of(
|
|
103
|
+
beg = s.find_first_not_of(whitespace, end);
|
|
103
104
|
if (beg == string::npos)
|
|
104
105
|
{
|
|
105
106
|
throw ParseException(__FILE__, __LINE__, "no non-whitespace characters found in proxy string '" + s + "'");
|
|
@@ -117,7 +118,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
117
118
|
}
|
|
118
119
|
else if (end == 0)
|
|
119
120
|
{
|
|
120
|
-
end = s.find_first_of(
|
|
121
|
+
end = s.find_first_of(whitespaceOrSeparator, beg);
|
|
121
122
|
if (end == string::npos)
|
|
122
123
|
{
|
|
123
124
|
end = s.size();
|
|
@@ -144,7 +145,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
144
145
|
// a null proxy, but only if nothing follows the
|
|
145
146
|
// quotes.
|
|
146
147
|
//
|
|
147
|
-
if (s.find_first_not_of(
|
|
148
|
+
if (s.find_first_not_of(whitespace, end) != string::npos)
|
|
148
149
|
{
|
|
149
150
|
throw ParseException(__FILE__, __LINE__, "invalid characters after identity in proxy string '" + s + "'");
|
|
150
151
|
}
|
|
@@ -167,7 +168,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
167
168
|
|
|
168
169
|
while (true)
|
|
169
170
|
{
|
|
170
|
-
beg = s.find_first_not_of(
|
|
171
|
+
beg = s.find_first_not_of(whitespace, end);
|
|
171
172
|
if (beg == string::npos)
|
|
172
173
|
{
|
|
173
174
|
break;
|
|
@@ -178,7 +179,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
178
179
|
break;
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
end = s.find_first_of(
|
|
182
|
+
end = s.find_first_of(whitespaceOrSeparator, beg);
|
|
182
183
|
if (end == string::npos)
|
|
183
184
|
{
|
|
184
185
|
end = s.length();
|
|
@@ -204,7 +205,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
204
205
|
// quotation marks.
|
|
205
206
|
//
|
|
206
207
|
string argument;
|
|
207
|
-
string::size_type argumentBeg = s.find_first_not_of(
|
|
208
|
+
string::size_type argumentBeg = s.find_first_not_of(whitespace, end);
|
|
208
209
|
if (argumentBeg != string::npos)
|
|
209
210
|
{
|
|
210
211
|
if (s[argumentBeg] != '@' && s[argumentBeg] != ':' && s[argumentBeg] != '-')
|
|
@@ -220,7 +221,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
220
221
|
}
|
|
221
222
|
else if (end == 0)
|
|
222
223
|
{
|
|
223
|
-
end = s.find_first_of(
|
|
224
|
+
end = s.find_first_of(whitespaceOrSeparator, beg);
|
|
224
225
|
if (end == string::npos)
|
|
225
226
|
{
|
|
226
227
|
end = s.size();
|
|
@@ -493,7 +494,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
493
494
|
}
|
|
494
495
|
case '@':
|
|
495
496
|
{
|
|
496
|
-
beg = s.find_first_not_of(
|
|
497
|
+
beg = s.find_first_not_of(whitespace, beg + 1);
|
|
497
498
|
if (beg == string::npos)
|
|
498
499
|
{
|
|
499
500
|
throw ParseException(__FILE__, __LINE__, "missing adapter id in proxy string '" + s + "'");
|
|
@@ -510,7 +511,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
510
511
|
}
|
|
511
512
|
else if (end == 0)
|
|
512
513
|
{
|
|
513
|
-
end = s.find_first_of(
|
|
514
|
+
end = s.find_first_of(whitespace, beg);
|
|
514
515
|
if (end == string::npos)
|
|
515
516
|
{
|
|
516
517
|
end = s.size();
|
|
@@ -525,7 +526,7 @@ IceInternal::ReferenceFactory::create(string_view str, const string& propertyPre
|
|
|
525
526
|
}
|
|
526
527
|
|
|
527
528
|
// Check for trailing whitespace.
|
|
528
|
-
if (end != string::npos && s.find_first_not_of(
|
|
529
|
+
if (end != string::npos && s.find_first_not_of(whitespace, end) != string::npos)
|
|
529
530
|
{
|
|
530
531
|
throw ParseException(
|
|
531
532
|
__FILE__,
|
|
@@ -610,7 +611,9 @@ IceInternal::ReferenceFactory::create(Identity ident, InputStream* s)
|
|
|
610
611
|
vector<EndpointIPtr> endpoints;
|
|
611
612
|
string adapterId;
|
|
612
613
|
|
|
613
|
-
|
|
614
|
+
// Each endpoint occupies at least 8 bytes on the wire (a 2-byte type plus a 6-byte minimum
|
|
615
|
+
// encapsulation), so readAndCheckSeqSize rejects an oversized count before we allocate.
|
|
616
|
+
int32_t sz = s->readAndCheckSeqSize(8);
|
|
614
617
|
|
|
615
618
|
if (sz > 0)
|
|
616
619
|
{
|
|
@@ -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, 2, 0
|
|
9
|
+
#define ICE_STRING_VERSION "3.8.2\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"
|
|
@@ -44,20 +44,18 @@ extern "C"
|
|
|
44
44
|
auto* p = reinterpret_cast<OpenSSL::SSLEngine*>(userData);
|
|
45
45
|
assert(p);
|
|
46
46
|
string passwd = p->password();
|
|
47
|
-
|
|
48
|
-
if
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
strncpy(buf, passwd.c_str(), sz);
|
|
53
|
-
buf[sz] = '\0';
|
|
47
|
+
|
|
48
|
+
// Follow the OpenSSL documentation example: copy the password into the buffer, truncating if necessary, and
|
|
49
|
+
// null-terminate. See https://docs.openssl.org/3.0/man3/SSL_CTX_set_default_passwd_cb/#examples
|
|
50
|
+
strncpy(buf, passwd.c_str(), static_cast<size_t>(size));
|
|
51
|
+
buf[size - 1] = '\0';
|
|
54
52
|
|
|
55
53
|
for (auto& character : passwd)
|
|
56
54
|
{
|
|
57
55
|
character = '\0';
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
return
|
|
58
|
+
return static_cast<int>(strlen(buf));
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
|
|
@@ -74,7 +72,14 @@ namespace
|
|
|
74
72
|
|
|
75
73
|
OpenSSL::SSLEngine::SSLEngine(const IceInternal::InstancePtr& instance) : Ice::SSL::SSLEngine(instance) {}
|
|
76
74
|
|
|
77
|
-
OpenSSL::SSLEngine::~SSLEngine()
|
|
75
|
+
OpenSSL::SSLEngine::~SSLEngine()
|
|
76
|
+
{
|
|
77
|
+
if (_ctx)
|
|
78
|
+
{
|
|
79
|
+
SSL_CTX_free(_ctx);
|
|
80
|
+
_ctx = nullptr;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
78
83
|
|
|
79
84
|
void
|
|
80
85
|
OpenSSL::SSLEngine::initialize()
|
|
@@ -93,6 +98,10 @@ OpenSSL::SSLEngine::initialize()
|
|
|
93
98
|
throw InitializationException(__FILE__, __LINE__, "IceSSL: unable to create SSL context:\n" + sslErrors());
|
|
94
99
|
}
|
|
95
100
|
|
|
101
|
+
// Reject peer-initiated TLS renegotiation: it is a CPU-asymmetric denial-of-service primitive
|
|
102
|
+
// on TLS 1.2 and is removed entirely in TLS 1.3.
|
|
103
|
+
SSL_CTX_set_options(_ctx, SSL_OP_NO_RENEGOTIATION);
|
|
104
|
+
|
|
96
105
|
// Check for a default directory. We look in this directory for files mentioned in the configuration.
|
|
97
106
|
const string defaultDir = properties->getIceProperty("IceSSL.DefaultDir");
|
|
98
107
|
|
|
@@ -154,7 +163,10 @@ OpenSSL::SSLEngine::initialize()
|
|
|
154
163
|
}
|
|
155
164
|
else if (properties->getIcePropertyAsInt("IceSSL.UsePlatformCAs") > 0)
|
|
156
165
|
{
|
|
157
|
-
SSL_CTX_set_default_verify_paths(_ctx)
|
|
166
|
+
if (!SSL_CTX_set_default_verify_paths(_ctx))
|
|
167
|
+
{
|
|
168
|
+
throw InitializationException(__FILE__, __LINE__, "IceSSL: unable to set default verify paths");
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
172
|
|
|
@@ -395,9 +407,16 @@ OpenSSL::SSLEngine::initialize()
|
|
|
395
407
|
_ctx,
|
|
396
408
|
reinterpret_cast<unsigned char*>(this),
|
|
397
409
|
static_cast<unsigned int>(sizeof(this)));
|
|
410
|
+
|
|
411
|
+
// Scrub the password from memory now that initialization is complete.
|
|
412
|
+
OPENSSL_cleanse(_password.data(), _password.size());
|
|
413
|
+
_password.clear();
|
|
398
414
|
}
|
|
399
415
|
catch (...)
|
|
400
416
|
{
|
|
417
|
+
// Scrub the password from memory even if initialization fails.
|
|
418
|
+
OPENSSL_cleanse(_password.data(), _password.size());
|
|
419
|
+
_password.clear();
|
|
401
420
|
SSL_CTX_free(_ctx);
|
|
402
421
|
_ctx = nullptr;
|
|
403
422
|
throw;
|
|
@@ -501,13 +520,3 @@ OpenSSL::SSLEngine::sslErrors() const
|
|
|
501
520
|
{
|
|
502
521
|
return getErrors();
|
|
503
522
|
}
|
|
504
|
-
|
|
505
|
-
void
|
|
506
|
-
OpenSSL::SSLEngine::destroy()
|
|
507
|
-
{
|
|
508
|
-
if (_ctx)
|
|
509
|
-
{
|
|
510
|
-
SSL_CTX_free(_ctx);
|
|
511
|
-
_ctx = nullptr;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
@@ -17,10 +17,9 @@ namespace Ice::SSL::OpenSSL
|
|
|
17
17
|
{
|
|
18
18
|
public:
|
|
19
19
|
SSLEngine(const IceInternal::InstancePtr&);
|
|
20
|
-
~SSLEngine();
|
|
20
|
+
~SSLEngine() override;
|
|
21
21
|
|
|
22
22
|
void initialize() final;
|
|
23
|
-
void destroy() final;
|
|
24
23
|
[[nodiscard]] std::string sslErrors() const;
|
|
25
24
|
[[nodiscard]] std::string password() const { return _password; }
|
|
26
25
|
[[nodiscard]] Ice::SSL::ClientAuthenticationOptions
|