summaryrefslogtreecommitdiff
path: root/xmlsecurity/source
diff options
context:
space:
mode:
authorPatrick Luby <guibmacdev@gmail.com>2024-03-04 19:15:00 -0500
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-03-05 18:35:14 +0100
commitce8d6b6836744045264eda41bcfdc4571c8b1b26 (patch)
tree0187a56f34115f95f90640a3174dfc3307da548f /xmlsecurity/source
parent0ed1cb5457a2106316f9d7fda10685360db4bc30 (diff)
Related: tdf#152524 eliminate UserData struct name collision
The cui module has its own UserData struct and when building with --enable-mergelibs=more, this data collision will cause a crash when deleting a UserData instance in the xmlsecurity module because the cui module already has its own, unrelated UserData struct. Change-Id: I6418b049c72a2e902c9b5076b72fd240f65a593d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164404 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx14
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx26
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx2
3 files changed, 21 insertions, 21 deletions
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index c1768c0e953a..a06fcc81d128 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -103,7 +103,7 @@ private:
DocumentSignatureMode eMode);
css::uno::Sequence<css::uno::Reference<css::security::XCertificate>>
- chooseCertificatesImpl(std::map<OUString, OUString>& rProperties, const UserAction eAction,
+ chooseCertificatesImpl(std::map<OUString, OUString>& rProperties, const CertificateChooserUserAction eAction,
const CertificateKind certificateKind=CertificateKind_NONE);
bool
@@ -696,7 +696,7 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
uno::Sequence<Reference<css::security::XCertificate>>
DocumentDigitalSignatures::chooseCertificatesImpl(std::map<OUString, OUString>& rProperties,
- const UserAction eAction,
+ const CertificateChooserUserAction eAction,
const CertificateKind certificateKind)
{
std::vector< Reference< css::xml::crypto::XXMLSecurityContext > > xSecContexts;
@@ -729,7 +729,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertif
Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseSigningCertificate(OUString& rDescription)
{
std::map<OUString, OUString> aProperties;
- Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, UserAction::Sign )[0];
+ Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::Sign )[0];
rDescription = aProperties["Description"];
return xCert;
}
@@ -737,7 +737,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseSignin
Reference< css::security::XCertificate > DocumentDigitalSignatures::selectSigningCertificate(OUString& rDescription)
{
std::map<OUString, OUString> aProperties;
- Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, UserAction::SelectSign )[0];
+ Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::SelectSign )[0];
rDescription = aProperties["Description"];
return xCert;
}
@@ -748,7 +748,7 @@ DocumentDigitalSignatures::selectSigningCertificateWithType(const CertificateKin
{
std::map<OUString, OUString> aProperties;
Reference<css::security::XCertificate> xCert
- = chooseCertificatesImpl(aProperties, UserAction::SelectSign, certificateKind)[0];
+ = chooseCertificatesImpl(aProperties, CertificateChooserUserAction::SelectSign, certificateKind)[0];
rDescription = aProperties["Description"];
return xCert;
}
@@ -757,7 +757,7 @@ css::uno::Sequence< Reference< css::security::XCertificate > > DocumentDigitalSi
{
std::map<OUString, OUString> aProperties;
uno::Sequence< Reference< css::security::XCertificate > > aCerts=
- chooseCertificatesImpl( aProperties, UserAction::Encrypt );
+ chooseCertificatesImpl( aProperties, CertificateChooserUserAction::Encrypt );
if (aCerts.getLength() == 1 && !aCerts[0].is())
// our error case contract is: empty sequence, so map that!
return uno::Sequence< Reference< css::security::XCertificate > >();
@@ -768,7 +768,7 @@ css::uno::Sequence< Reference< css::security::XCertificate > > DocumentDigitalSi
css::uno::Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertificateWithProps(Sequence<::com::sun::star::beans::PropertyValue>& rProperties)
{
std::map<OUString, OUString> aProperties;
- auto xCert = chooseCertificatesImpl( aProperties, UserAction::Sign )[0];
+ auto xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::Sign )[0];
std::vector<css::beans::PropertyValue> vec;
vec.reserve(aProperties.size());
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index faea635f1be9..e381b38f2933 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -41,7 +41,7 @@ using namespace css;
CertificateChooser::CertificateChooser(weld::Window* _pParent,
std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
- UserAction eAction)
+ CertificateChooserUserAction eAction)
: GenericDialogController(_pParent, "xmlsec/ui/selectcertificatedialog.ui", "SelectCertificateDialog")
, meAction(eAction)
, m_xFTSign(m_xBuilder->weld_label("sign"))
@@ -146,19 +146,19 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
switch (meAction)
{
- case UserAction::Sign:
+ case CertificateChooserUserAction::Sign:
m_xFTSign->show();
m_xOKBtn->set_label(XsResId(STR_SIGN));
msPreferredKey = aUserOpts.GetSigningKey();
break;
- case UserAction::SelectSign:
+ case CertificateChooserUserAction::SelectSign:
m_xFTSign->show();
m_xOKBtn->set_label(XsResId(STR_SELECTSIGN));
msPreferredKey = aUserOpts.GetSigningKey();
break;
- case UserAction::Encrypt:
+ case CertificateChooserUserAction::Encrypt:
m_xFTEncrypt->show();
m_xFTDescription->hide();
m_xDescriptionED->hide();
@@ -187,7 +187,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
}
else
{
- if (meAction == UserAction::Sign || meAction == UserAction::SelectSign)
+ if (meAction == CertificateChooserUserAction::Sign || meAction == CertificateChooserUserAction::SelectSign)
xCerts = secEnvironment->getPersonalCertificates();
else
xCerts = secEnvironment->getAllCertificates();
@@ -213,7 +213,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
// fill list of certificates; the first entry will be selected
for (const auto& xCert : xCerts)
{
- std::shared_ptr<UserData> userData = std::make_shared<UserData>();
+ std::shared_ptr<CertificateChooserUserData> userData = std::make_shared<CertificateChooserUserData>();
userData->xCertificate = xCert;
userData->xSecurityContext = secContext;
userData->xSecurityEnvironment = secEnvironment;
@@ -242,11 +242,11 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
if ( !sIssuer.isEmpty() && !msPreferredKey.isEmpty() ) {
if ( sIssuer == msPreferredKey )
{
- if ( meAction == UserAction::Sign || meAction == UserAction::SelectSign )
+ if ( meAction == CertificateChooserUserAction::Sign || meAction == CertificateChooserUserAction::SelectSign )
{
oSelectRow.emplace(nRow);
}
- else if ( meAction == UserAction::Encrypt &&
+ else if ( meAction == CertificateChooserUserAction::Encrypt &&
aUserOpts.GetEncryptToSelf() )
mxEncryptToSelf = xCert;
}
@@ -271,11 +271,11 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
uno::Sequence<uno::Reference< css::security::XCertificate > > CertificateChooser::GetSelectedCertificates()
{
std::vector< uno::Reference< css::security::XCertificate > > aRet;
- if (meAction == UserAction::Encrypt)
+ if (meAction == CertificateChooserUserAction::Encrypt)
{
// for encryption, multiselection is enabled
m_xCertLB->selected_foreach([this, &aRet](weld::TreeIter& rEntry){
- UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(rEntry));
+ CertificateChooserUserData* userData = weld::fromId<CertificateChooserUserData*>(m_xCertLB->get_id(rEntry));
aRet.push_back( userData->xCertificate );
return false;
});
@@ -286,7 +286,7 @@ uno::Sequence<uno::Reference< css::security::XCertificate > > CertificateChooser
int nSel = m_xCertLB->get_selected_index();
if (nSel != -1)
{
- UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel));
+ CertificateChooserUserData* userData = weld::fromId<CertificateChooserUserData*>(m_xCertLB->get_id(nSel));
xCert = userData->xCertificate;
}
aRet.push_back( xCert );
@@ -306,7 +306,7 @@ uno::Reference<xml::crypto::XXMLSecurityContext> CertificateChooser::GetSelected
if (nSel == -1)
return uno::Reference<xml::crypto::XXMLSecurityContext>();
- UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel));
+ CertificateChooserUserData* userData = weld::fromId<CertificateChooserUserData*>(m_xCertLB->get_id(nSel));
uno::Reference<xml::crypto::XXMLSecurityContext> xCert = userData->xSecurityContext;
return xCert;
}
@@ -366,7 +366,7 @@ void CertificateChooser::ImplShowCertificateDetails()
if (nSel == -1)
return;
- UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel));
+ CertificateChooserUserData* userData = weld::fromId<CertificateChooserUserData*>(m_xCertLB->get_id(nSel));
if (!userData->xSecurityEnvironment.is() || !userData->xCertificate.is())
return;
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 8349a58a31ce..ba16a3618e7f 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -509,7 +509,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, weld::Button&, void)
if (DocumentSignatureHelper::CanSignWithGPG(maSignatureManager.getStore(), m_sODFVersion))
xSecContexts.push_back(maSignatureManager.getGpgSecurityContext());
- std::unique_ptr<CertificateChooser> aChooser = CertificateChooser::getInstance(m_xDialog.get(), std::move(xSecContexts), UserAction::Sign);
+ std::unique_ptr<CertificateChooser> aChooser = CertificateChooser::getInstance(m_xDialog.get(), std::move(xSecContexts), CertificateChooserUserAction::Sign);
if (aChooser->run() == RET_OK)
{
sal_Int32 nSecurityId;