summaryrefslogtreecommitdiff
path: root/cpp/src/IceSSL
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-01-02 18:06:44 +0100
committerJose <jose@zeroc.com>2017-01-02 18:06:44 +0100
commit2df05d130ae51a65f51c593800ad722d533f5df3 (patch)
tree1c4c0c03245a69cdefb949a0060e5642e00aaeed /cpp/src/IceSSL
parentUpdate VisualStdio Ice project filters (diff)
downloadice-2df05d130ae51a65f51c593800ad722d533f5df3.tar.bz2
ice-2df05d130ae51a65f51c593800ad722d533f5df3.tar.xz
ice-2df05d130ae51a65f51c593800ad722d533f5df3.zip
Fixed (ICE-7477) - Use native Base64 encode/decode
Diffstat (limited to 'cpp/src/IceSSL')
-rw-r--r--cpp/src/IceSSL/SSLEngine.h5
-rwxr-xr-xcpp/src/IceSSL/Util.cpp2
-rw-r--r--cpp/src/IceSSL/Util.h57
3 files changed, 5 insertions, 59 deletions
diff --git a/cpp/src/IceSSL/SSLEngine.h b/cpp/src/IceSSL/SSLEngine.h
index d9f1a87ca81..9a48cd7f707 100644
--- a/cpp/src/IceSSL/SSLEngine.h
+++ b/cpp/src/IceSSL/SSLEngine.h
@@ -17,6 +17,7 @@
#include <IceUtil/Shared.h>
#include <IceUtil/Mutex.h>
+#include <IceUtil/UniqueRef.h>
#include <Ice/CommunicatorF.h>
#include <Ice/Network.h>
@@ -126,8 +127,8 @@ private:
void parseCiphers(const std::string&);
bool _initialized;
- UniqueRef<CFArrayRef> _certificateAuthorities;
- UniqueRef<CFArrayRef> _chain;
+ IceUtil::UniqueRef<CFArrayRef> _certificateAuthorities;
+ IceUtil::UniqueRef<CFArrayRef> _chain;
SSLProtocol _protocolVersionMax;
SSLProtocol _protocolVersionMin;
diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp
index f262d09979f..af02062389b 100755
--- a/cpp/src/IceSSL/Util.cpp
+++ b/cpp/src/IceSSL/Util.cpp
@@ -14,6 +14,7 @@
#include <IceSSL/Util.h>
#include <IceUtil/FileUtil.h>
+#include <IceUtil/UniqueRef.h>
#include <IceUtil/StringUtil.h>
#include <Ice/Base64.h>
@@ -634,6 +635,7 @@ IceSSL::getCertificateProperty(SecCertificateRef cert, CFTypeRef key)
{
ostringstream os;
os << "IceSSL: error getting property for certificate:\n" << errorToString(err);
+ CFRelease(err);
throw CertificateReadException(__FILE__, __LINE__, os.str());
}
diff --git a/cpp/src/IceSSL/Util.h b/cpp/src/IceSSL/Util.h
index fc6af1020cc..ed706a6973e 100644
--- a/cpp/src/IceSSL/Util.h
+++ b/cpp/src/IceSSL/Util.h
@@ -109,63 +109,6 @@ std::string getSslErrors(bool);
#elif defined(ICE_USE_SECURE_TRANSPORT)
-template<typename T>
-class UniqueRef
-{
-public:
-
- explicit UniqueRef(CFTypeRef ptr = 0) : _ptr((T)ptr)
- {
- }
-
- ~UniqueRef()
- {
- if(_ptr != 0)
- {
- CFRelease(_ptr);
- }
- }
-
- T release()
- {
- T r = _ptr;
- _ptr = 0;
- return r;
- }
-
- void reset(CFTypeRef ptr = 0)
- {
- if(_ptr == ptr)
- {
- return;
- }
- if(_ptr != 0)
- {
- CFRelease(_ptr);
- }
- _ptr = (T)ptr;
- }
-
- void retain(CFTypeRef ptr)
- {
- reset(ptr ? CFRetain(ptr) : ptr);
- }
-
- T get() const
- {
- return _ptr;
- }
-
- operator bool() const
- {
- return _ptr != 0;
- }
-
-private:
-
- T _ptr;
-};
-
//
// Helper functions to use by Secure Transport.
//