[Libreoffice-commits] core.git: Branch 'feature/cmis' - ucb/source
Cédric Bosdonnat
cedric.bosdonnat.ooo at free.fr
Thu Jul 25 08:52:56 PDT 2013
ucb/source/ucp/cmis/certvalidation_handler.cxx | 26 +++++++++++++++++++++++++
1 file changed, 26 insertions(+)
New commits:
commit 1498cf0d9429f992affbe1ab5701b07e66cf1754
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Thu Jul 25 18:00:18 2013 +0200
Store the decision about the certificate in a container to remember it
Change-Id: I19da6c1aeb7fada97166d37c68fa5ba242bbcaba
diff --git a/ucb/source/ucp/cmis/certvalidation_handler.cxx b/ucb/source/ucp/cmis/certvalidation_handler.cxx
index 7ac8cda..f13c75b 100644
--- a/ucb/source/ucp/cmis/certvalidation_handler.cxx
+++ b/ucb/source/ucp/cmis/certvalidation_handler.cxx
@@ -10,7 +10,9 @@
*
*/
+#include <com/sun/star/security/CertificateContainer.hpp>
#include <com/sun/star/security/XCertificate.hpp>
+#include <com/sun/star/security/XCertificateContainer.hpp>
#include <com/sun/star/security/CertificateValidity.hpp>
#include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
@@ -59,6 +61,26 @@ namespace cmis
xSecurityEnv->createCertificateFromAscii(
sCleanCert ) );
+ uno::Reference< security::XCertificateContainer > xCertificateContainer;
+ try
+ {
+ xCertificateContainer = security::CertificateContainer::create( m_xContext );
+ }
+ catch ( uno::Exception const & )
+ {
+ }
+
+ if ( xCertificateContainer.is( ) )
+ {
+ security::CertificateContainerStatus status(
+ xCertificateContainer->hasCertificate(
+ m_sHostname, xCert->getSubjectName() ) );
+
+ if ( status != security::CertificateContainerStatus_NOCERT )
+ return status == security::CertificateContainerStatus_TRUSTED;
+ }
+
+ // If we had no certificate, ask what to do
std::vector< uno::Reference< security::XCertificate > > vecCerts;
for ( ++pIt; pIt != aCertificates.end(); ++pIt )
@@ -90,6 +112,10 @@ namespace cmis
uno::Reference< task::XInteractionApprove > xApprove(
xSelection.get(), uno::UNO_QUERY );
bValidate = xApprove.is();
+
+ // Store the decision in the container
+ xCertificateContainer->addCertificate(
+ m_sHostname, xCert->getSubjectName(), bValidate );
}
}
}
More information about the Libreoffice-commits
mailing list