summaryrefslogtreecommitdiff
path: root/cpp/src/IceSSL/Util.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-01-13 14:32:35 +0100
committerJose <jose@zeroc.com>2017-01-13 14:32:35 +0100
commit7bbb87fbd60c8c8f7c86e6890b5b1d7931b4d9b4 (patch)
tree5e2d1457cc8306f228ec5aa87f50d0a7882dc9a2 /cpp/src/IceSSL/Util.cpp
parentFixed (ICE-7480) - Use UniqueRef to manage CoreFoundation types. (diff)
downloadice-7bbb87fbd60c8c8f7c86e6890b5b1d7931b4d9b4.tar.bz2
ice-7bbb87fbd60c8c8f7c86e6890b5b1d7931b4d9b4.tar.xz
ice-7bbb87fbd60c8c8f7c86e6890b5b1d7931b4d9b4.zip
Extra fixes for UniqueRef usage
Diffstat (limited to 'cpp/src/IceSSL/Util.cpp')
-rwxr-xr-xcpp/src/IceSSL/Util.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp
index f47d1e32753..eb6719ee21d 100755
--- a/cpp/src/IceSSL/Util.cpp
+++ b/cpp/src/IceSSL/Util.cpp
@@ -1323,28 +1323,27 @@ IceSSL::findCertificateChain(const std::string& keychainPath, const std::string&
// Retrieve the certificate chain
//
UniqueRef<SecPolicyRef> policy(SecPolicyCreateSSL(true, 0));
- SecTrustRef trust = 0;
- err = SecTrustCreateWithCertificates(reinterpret_cast<CFArrayRef>(cert.get()), policy.get(), &trust);
+ UniqueRef<SecTrustRef> trust;
+ err = SecTrustCreateWithCertificates(reinterpret_cast<CFArrayRef>(cert.get()), policy.get(), &trust.get());
if(err || !trust)
{
throw PluginInitializationException(__FILE__, __LINE__,
"IceSSL: error creating trust object" +
(err ? ":\n" + errorToString(err) : ""));
}
- UniqueRef<SecTrustRef> v(trust);
SecTrustResultType trustResult;
- if((err = SecTrustEvaluate(trust, &trustResult)))
+ if((err = SecTrustEvaluate(trust.get(), &trustResult)))
{
throw PluginInitializationException(__FILE__, __LINE__,
"IceSSL: error evaluating trust:\n" + errorToString(err));
}
- int chainLength = SecTrustGetCertificateCount(trust);
+ int chainLength = SecTrustGetCertificateCount(trust.get());
UniqueRef<CFArrayRef> items(CFArrayCreateMutable(kCFAllocatorDefault, chainLength, &kCFTypeArrayCallBacks));
for(int i = 0; i < chainLength; ++i)
{
- CFArrayAppendValue(const_cast<CFMutableArrayRef>(items.get()), SecTrustGetCertificateAtIndex(trust, i));
+ CFArrayAppendValue(const_cast<CFMutableArrayRef>(items.get()), SecTrustGetCertificateAtIndex(trust.get(), i));
}
//