summaryrefslogtreecommitdiff
path: root/extensions/source/config
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/source/config')
-rw-r--r--extensions/source/config/WinUserInfo/WinUserInfoBe.cxx275
-rw-r--r--extensions/source/config/WinUserInfo/WinUserInfoBe.hxx7
-rw-r--r--extensions/source/config/ldap/ldapaccess.hxx5
-rw-r--r--extensions/source/config/ldap/ldapuserprofilebe.cxx18
-rw-r--r--extensions/source/config/ldap/ldapuserprofilebe.hxx9
5 files changed, 130 insertions, 184 deletions
diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
index f9f5f9545439..3e76f6faa9ce 100644
--- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
+++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx
@@ -11,14 +11,12 @@
#include <com/sun/star/beans/Optional.hpp>
#include <comphelper/base64.hxx>
-#include <comphelper/configurationhelper.hxx>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/configuration.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <map>
#include <o3tl/char16_t2wchar_t.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <officecfg/UserProfile.hxx>
#include <Iads.h>
#include <Adshlp.h>
@@ -26,6 +24,9 @@
#define SECURITY_WIN32
#include <Security.h>
+#include <systools/win32/comtools.hxx>
+#include <systools/win32/oleauto.hxx>
+
namespace extensions
{
namespace config
@@ -60,23 +61,23 @@ public:
namespace
{
-constexpr OUStringLiteral givenname(u"givenname");
-constexpr OUStringLiteral sn(u"sn");
-constexpr char fathersname[]("fathersname");
-constexpr OUStringLiteral initials(u"initials");
-constexpr OUStringLiteral street(u"street");
-constexpr OUStringLiteral l(u"l");
-constexpr OUStringLiteral st(u"st");
-constexpr char apartment[]("apartment");
-constexpr OUStringLiteral postalcode(u"postalcode");
-constexpr OUStringLiteral c(u"c");
-constexpr OUStringLiteral o(u"o");
-constexpr char position[]("position");
-constexpr OUStringLiteral title(u"title");
-constexpr OUStringLiteral homephone(u"homephone");
-constexpr OUStringLiteral telephonenumber(u"telephonenumber");
-constexpr OUStringLiteral facsimiletelephonenumber(u"facsimiletelephonenumber");
-constexpr OUStringLiteral mail(u"mail");
+constexpr OUString _givenname(u"givenname"_ustr);
+constexpr OUString _sn(u"sn"_ustr);
+constexpr char _fathersname[]("fathersname");
+constexpr OUString _initials(u"initials"_ustr);
+constexpr OUString _street(u"street"_ustr);
+constexpr OUString _l(u"l"_ustr);
+constexpr OUString _st(u"st"_ustr);
+constexpr char _apartment[]("apartment");
+constexpr OUString _postalcode(u"postalcode"_ustr);
+constexpr OUString _c(u"c"_ustr);
+constexpr OUString _o(u"o"_ustr);
+constexpr char _position[]("position");
+constexpr OUString _title(u"title"_ustr);
+constexpr OUString _homephone(u"homephone"_ustr);
+constexpr OUString _telephonenumber(u"telephonenumber"_ustr);
+constexpr OUString _facsimiletelephonenumber(u"facsimiletelephonenumber"_ustr);
+constexpr OUString _mail(u"mail"_ustr);
// Backend class implementing access to Active Directory user data. It caches its encoded data
// in a configuration entry, to allow reusing it when user later doesn't have access to AD DC
@@ -84,118 +85,85 @@ constexpr OUStringLiteral mail(u"mail");
class ADsUserAccess : public extensions::config::WinUserInfo::WinUserInfoBe_Impl
{
public:
- ADsUserAccess(const css::uno::Reference<css::uno::XComponentContext>& xContext)
+ ADsUserAccess()
{
try
{
- struct CoInitializeGuard
- {
- CoInitializeGuard()
- {
- if (FAILED(CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED)))
- throw css::uno::RuntimeException();
- }
- ~CoInitializeGuard() { CoUninitialize(); }
- } aCoInitializeGuard;
-
- IADsADSystemInfo* pADsys;
- HRESULT hr = CoCreateInstance(CLSID_ADSystemInfo, nullptr, CLSCTX_INPROC_SERVER,
- IID_IADsADSystemInfo, reinterpret_cast<void**>(&pADsys));
- if (FAILED(hr))
- throw css::uno::RuntimeException();
- CoIfPtr<IADsADSystemInfo> aADsysGuard(pADsys);
+ sal::systools::CoInitializeGuard aCoInitializeGuard(COINIT_APARTMENTTHREADED);
- BSTR sUserDN;
- hr = pADsys->get_UserName(&sUserDN);
- if (FAILED(hr))
- throw css::uno::RuntimeException();
- BSTRGuard aUserNameGuard(sUserDN, SysFreeString);
+ sal::systools::COMReference<IADsADSystemInfo> pADsys(CLSID_ADSystemInfo, nullptr,
+ CLSCTX_INPROC_SERVER);
+
+ sal::systools::BStr sUserDN;
+ sal::systools::ThrowIfFailed(pADsys->get_UserName(&sUserDN), "get_UserName failed");
// If this user is an AD user, then without an active connection to the domain, all the
// above will succeed, and m_sUserDN will be correctly initialized, but the following
// call to ADsGetObject will fail, and we will attempt reading cached values.
- m_sUserDN = o3tl::toU(sUserDN);
+ m_sUserDN = sUserDN;
OUString sLdapUserDN = "LDAP://" + m_sUserDN;
- IADsUser* pUser;
- hr = ADsGetObject(o3tl::toW(sLdapUserDN.getStr()), IID_IADsUser,
- reinterpret_cast<void**>(&pUser));
- if (FAILED(hr))
- throw css::uno::RuntimeException();
- CoIfPtr<IADsUser> pUserGuard(pUser);
+ sal::systools::COMReference<IADsUser> pUser;
+ sal::systools::ThrowIfFailed(ADsGetObject(o3tl::toW(sLdapUserDN.getStr()), IID_IADsUser,
+ reinterpret_cast<void**>(&pUser)),
+ "ADsGetObject failed");
// Fetch all the required information right now, when we know to have access to AD
// (later the connection may already be lost)
- m_aMap[givenname] = Str(pUser, &IADsUser::get_FirstName);
- m_aMap[sn] = Str(pUser, &IADsUser::get_LastName);
- m_aMap[initials] = Str(pUser, L"initials");
- m_aMap[street] = Str(pUser, L"streetAddress");
- m_aMap[l] = Str(pUser, L"l");
- m_aMap[st] = Str(pUser, L"st");
- m_aMap[postalcode] = Str(pUser, L"postalCode");
- m_aMap[c] = Str(pUser, L"co");
- m_aMap[o] = Str(pUser, L"company");
- m_aMap[title] = Str(pUser, &IADsUser::get_Title);
- m_aMap[homephone] = Str(pUser, L"homePhone");
- m_aMap[telephonenumber] = Str(pUser, L"TelephoneNumber");
- m_aMap[facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber");
- m_aMap[mail] = Str(pUser, &IADsUser::get_EmailAddress);
-
- CacheData(xContext);
+ m_aMap[_givenname] = Str(pUser, &IADsUser::get_FirstName);
+ m_aMap[_sn] = Str(pUser, &IADsUser::get_LastName);
+ m_aMap[_initials] = Str(pUser, L"initials");
+ m_aMap[_street] = Str(pUser, L"streetAddress");
+ m_aMap[_l] = Str(pUser, L"l");
+ m_aMap[_st] = Str(pUser, L"st");
+ m_aMap[_postalcode] = Str(pUser, L"postalCode");
+ m_aMap[_c] = Str(pUser, L"co");
+ m_aMap[_o] = Str(pUser, L"company");
+ m_aMap[_title] = Str(pUser, &IADsUser::get_Title);
+ m_aMap[_homephone] = Str(pUser, L"homePhone");
+ m_aMap[_telephonenumber] = Str(pUser, L"TelephoneNumber");
+ m_aMap[_facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber");
+ m_aMap[_mail] = Str(pUser, &IADsUser::get_EmailAddress);
+
+ CacheData();
}
- catch (css::uno::Exception&)
+ catch (sal::systools::ComError&)
{
// Maybe we temporarily lost connection to AD; try to get cached data
- GetCachedData(xContext);
+ GetCachedData();
}
}
- virtual OUString GetGivenName() override { return m_aMap[givenname]; }
- virtual OUString GetSn() override { return m_aMap[sn]; }
- virtual OUString GetInitials() override { return m_aMap[initials]; }
- virtual OUString GetStreet() override { return m_aMap[street]; }
- virtual OUString GetCity() override { return m_aMap[l]; }
- virtual OUString GetState() override { return m_aMap[st]; }
- virtual OUString GetPostalCode() override { return m_aMap[postalcode]; }
- virtual OUString GetCountry() override { return m_aMap[c]; }
- virtual OUString GetOrganization() override { return m_aMap[o]; }
- virtual OUString GetTitle() override { return m_aMap[title]; }
- virtual OUString GetHomePhone() override { return m_aMap[homephone]; }
- virtual OUString GetTelephoneNumber() override { return m_aMap[telephonenumber]; }
- virtual OUString GetFaxNumber() override { return m_aMap[facsimiletelephonenumber]; }
- virtual OUString GetMail() override { return m_aMap[mail]; }
+ virtual OUString GetGivenName() override { return m_aMap[_givenname]; }
+ virtual OUString GetSn() override { return m_aMap[_sn]; }
+ virtual OUString GetInitials() override { return m_aMap[_initials]; }
+ virtual OUString GetStreet() override { return m_aMap[_street]; }
+ virtual OUString GetCity() override { return m_aMap[_l]; }
+ virtual OUString GetState() override { return m_aMap[_st]; }
+ virtual OUString GetPostalCode() override { return m_aMap[_postalcode]; }
+ virtual OUString GetCountry() override { return m_aMap[_c]; }
+ virtual OUString GetOrganization() override { return m_aMap[_o]; }
+ virtual OUString GetTitle() override { return m_aMap[_title]; }
+ virtual OUString GetHomePhone() override { return m_aMap[_homephone]; }
+ virtual OUString GetTelephoneNumber() override { return m_aMap[_telephonenumber]; }
+ virtual OUString GetFaxNumber() override { return m_aMap[_facsimiletelephonenumber]; }
+ virtual OUString GetMail() override { return m_aMap[_mail]; }
private:
- static void ReleaseIUnknown(IUnknown* p)
- {
- if (p)
- p->Release();
- }
- template <class If> class CoIfPtr : public std::unique_ptr<If, decltype(&ReleaseIUnknown)>
- {
- public:
- CoIfPtr(If* p = nullptr)
- : std::unique_ptr<If, decltype(&ReleaseIUnknown)>(p, ReleaseIUnknown)
- {
- }
- };
- typedef std::unique_ptr<OLECHAR, decltype(&SysFreeString)> BSTRGuard;
-
typedef HRESULT (__stdcall IADsUser::*getstrfunc)(BSTR*);
static OUString Str(IADsUser* pUser, getstrfunc func)
{
- BSTR sBstr;
+ sal::systools::BStr sBstr;
if (FAILED((pUser->*func)(&sBstr)))
return "";
- BSTRGuard aBstrGuard(sBstr, SysFreeString);
- return OUString(o3tl::toU(sBstr));
+ return OUString(sBstr);
}
static OUString Str(IADsUser* pUser, const wchar_t* property)
{
- BSTRGuard sBstrProp(SysAllocString(property), SysFreeString);
+ sal::systools::BStr sBstrProp{ o3tl::toU(property) };
struct AutoVariant : public VARIANT
{
AutoVariant() { VariantInit(this); }
~AutoVariant() { VariantClear(this); }
} varArr;
- if (FAILED(pUser->GetEx(sBstrProp.get(), &varArr)))
+ if (FAILED(pUser->GetEx(sBstrProp, &varArr)))
return "";
SAFEARRAY* sa = V_ARRAY(&varArr);
LONG nStart, nEnd;
@@ -213,41 +181,35 @@ private:
return "";
}
- void CacheData(const css::uno::Reference<css::uno::XComponentContext>& xContext)
+ void CacheData()
{
try
{
OUString sCachedData = "user=" + m_sUserDN // user DN
- + "\0" + givenname + "=" + GetGivenName() // 1st name
- + "\0" + sn + "=" + GetSn() // sn
- + "\0" + initials + "=" + GetInitials() // initials
- + "\0" + street + "=" + GetStreet() // street
- + "\0" + l + "=" + GetCity() // l
- + "\0" + st + "=" + GetState() // st
- + "\0" + postalcode + "=" + GetPostalCode() // p.code
- + "\0" + c + "=" + GetCountry() // c
- + "\0" + o + "=" + GetOrganization() // o
- + "\0" + title + "=" + GetTitle() // title
- + "\0" + homephone + "=" + GetHomePhone() // h.phone
- + "\0" + telephonenumber + "=" + GetTelephoneNumber() // tel
- + "\0" + facsimiletelephonenumber + "=" + GetFaxNumber() // fax
- + "\0" + mail + "=" + GetMail(); // mail
+ + "\0" + _givenname + "=" + GetGivenName() // 1st name
+ + "\0" + _sn + "=" + GetSn() // sn
+ + "\0" + _initials + "=" + GetInitials() // initials
+ + "\0" + _street + "=" + GetStreet() // street
+ + "\0" + _l + "=" + GetCity() // l
+ + "\0" + _st + "=" + GetState() // st
+ + "\0" + _postalcode + "=" + GetPostalCode() // p.code
+ + "\0" + _c + "=" + GetCountry() // c
+ + "\0" + _o + "=" + GetOrganization() // o
+ + "\0" + _title + "=" + GetTitle() // title
+ + "\0" + _homephone + "=" + GetHomePhone() // h.phone
+ + "\0" + _telephonenumber + "=" + GetTelephoneNumber() // tel
+ + "\0" + _facsimiletelephonenumber + "=" + GetFaxNumber() // fax
+ + "\0" + _mail + "=" + GetMail(); // mail
const css::uno::Sequence<sal_Int8> seqCachedData(
reinterpret_cast<const sal_Int8*>(sCachedData.getStr()),
sCachedData.getLength() * sizeof(sal_Unicode));
OUStringBuffer sOutBuf;
comphelper::Base64::encode(sOutBuf, seqCachedData);
- auto xIface = comphelper::ConfigurationHelper::openConfig(
- xContext, "org.openoffice.UserProfile/WinUserInfo",
- comphelper::EConfigurationModes::Standard);
- css::uno::Reference<css::container::XNameReplace> xNameReplace(
- xIface, css::uno::UNO_QUERY_THROW);
- xNameReplace->replaceByName("Cache", css::uno::makeAny(sOutBuf.makeStringAndClear()));
-
- css::uno::Reference<css::util::XChangesBatch> xChangesBatch(xIface,
- css::uno::UNO_QUERY_THROW);
- xChangesBatch->commitChanges();
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::UserProfile::WinUserInfo::Cache::set(sOutBuf.makeStringAndClear(), batch);
+ batch->commit();
}
catch (const css::uno::Exception&)
{
@@ -256,18 +218,13 @@ private:
}
}
- void GetCachedData(const css::uno::Reference<css::uno::XComponentContext>& xContext)
+ void GetCachedData()
{
if (m_sUserDN.isEmpty())
throw css::uno::RuntimeException();
- auto xIface = comphelper::ConfigurationHelper::openConfig(
- xContext, "org.openoffice.UserProfile/WinUserInfo",
- comphelper::EConfigurationModes::ReadOnly);
- css::uno::Reference<css::container::XNameAccess> xNameAccess(xIface,
- css::uno::UNO_QUERY_THROW);
- OUString sCache;
- xNameAccess->getByName("Cache") >>= sCache;
+ OUString sCache = officecfg::UserProfile::WinUserInfo::Cache::get();
+
if (sCache.isEmpty())
throw css::uno::RuntimeException();
@@ -346,13 +303,13 @@ namespace config
{
namespace WinUserInfo
{
-WinUserInfoBe::WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext)
+WinUserInfoBe::WinUserInfoBe()
: WinUserInfoMutexHolder()
, BackendBase(mMutex)
{
try
{
- m_pImpl.reset(new ADsUserAccess(xContext));
+ m_pImpl.reset(new ADsUserAccess());
}
catch (css::uno::RuntimeException&)
{
@@ -373,79 +330,79 @@ css::uno::Any WinUserInfoBe::getPropertyValue(OUString const& PropertyName)
OUString sValue;
// Only process the first argument of possibly multiple space- or comma-separated arguments
OUString sToken = PropertyName.getToken(0, ' ').getToken(0, ',');
- if (sToken == givenname)
+ if (sToken == _givenname)
{
sValue = m_pImpl->GetGivenName();
}
- else if (sToken == sn)
+ else if (sToken == _sn)
{
sValue = m_pImpl->GetSn();
}
- else if (sToken == fathersname)
+ else if (sToken == _fathersname)
{
sValue = m_pImpl->GetFathersname();
}
- else if (sToken == initials)
+ else if (sToken == _initials)
{
sValue = m_pImpl->GetInitials();
}
- else if (sToken == street)
+ else if (sToken == _street)
{
sValue = m_pImpl->GetStreet();
}
- else if (sToken == l)
+ else if (sToken == _l)
{
sValue = m_pImpl->GetCity();
}
- else if (sToken == st)
+ else if (sToken == _st)
{
sValue = m_pImpl->GetState();
}
- else if (sToken == apartment)
+ else if (sToken == _apartment)
{
sValue = m_pImpl->GetApartment();
}
- else if (sToken == postalcode)
+ else if (sToken == _postalcode)
{
sValue = m_pImpl->GetPostalCode();
}
- else if (sToken == c)
+ else if (sToken == _c)
{
sValue = m_pImpl->GetCountry();
}
- else if (sToken == o)
+ else if (sToken == _o)
{
sValue = m_pImpl->GetOrganization();
}
- else if (sToken == position)
+ else if (sToken == _position)
{
sValue = m_pImpl->GetPosition();
}
- else if (sToken == title)
+ else if (sToken == _title)
{
sValue = m_pImpl->GetTitle();
}
- else if (sToken == homephone)
+ else if (sToken == _homephone)
{
sValue = m_pImpl->GetHomePhone();
}
- else if (sToken == telephonenumber)
+ else if (sToken == _telephonenumber)
{
sValue = m_pImpl->GetTelephoneNumber();
}
- else if (sToken == facsimiletelephonenumber)
+ else if (sToken == _facsimiletelephonenumber)
{
sValue = m_pImpl->GetFaxNumber();
}
- else if (sToken == mail)
+ else if (sToken == _mail)
{
sValue = m_pImpl->GetMail();
}
else
throw css::beans::UnknownPropertyException(sToken, static_cast<cppu::OWeakObject*>(this));
- return css::uno::makeAny(css::beans::Optional<css::uno::Any>(
- !sValue.isEmpty(), sValue.isEmpty() ? css::uno::Any() : css::uno::makeAny(sValue)));
+ return css::uno::Any(css::beans::Optional<css::uno::Any>(
+ !sValue.isEmpty(), sValue.isEmpty() ? css::uno::Any() : css::uno::Any(sValue)));
}
OUString SAL_CALL WinUserInfoBe::getImplementationName()
@@ -467,10 +424,10 @@ css::uno::Sequence<OUString> SAL_CALL WinUserInfoBe::getSupportedServiceNames()
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
-extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext* context,
+extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext*,
css::uno::Sequence<css::uno::Any> const&)
{
- return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe(context));
+ return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx
index 4ebca2678a59..30ca088c3aca 100644
--- a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx
+++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx
@@ -7,8 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_WINUSERINFO_WINUSERINFOBE_HXX
-#define INCLUDED_EXTENSIONS_SOURCE_CONFIG_WINUSERINFO_WINUSERINFOBE_HXX
+#pragma once
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -52,7 +51,7 @@ struct WinUserInfoMutexHolder
class WinUserInfoBe : private WinUserInfoMutexHolder, public BackendBase
{
public:
- explicit WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext);
+ explicit WinUserInfoBe();
virtual ~WinUserInfoBe() override;
// XServiceInfo
@@ -99,6 +98,4 @@ private:
}
}
-#endif // INCLUDED_EXTENSIONS_SOURCE_CONFIG_WINUSERINFO_WINUSERINFOBE_HXX
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/config/ldap/ldapaccess.hxx b/extensions/source/config/ldap/ldapaccess.hxx
index 274cdb88009d..36a0708b1eb7 100644
--- a/extensions/source/config/ldap/ldapaccess.hxx
+++ b/extensions/source/config/ldap/ldapaccess.hxx
@@ -17,8 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPACCESS_HXX
-#define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPACCESS_HXX
+#pragma once
#include <sal/config.h>
@@ -131,6 +130,4 @@ private:
};
}
-#endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx
index 8be633a4ca3e..a735b5fbd71a 100644
--- a/extensions/source/config/ldap/ldapuserprofilebe.cxx
+++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx
@@ -21,7 +21,7 @@
#include "ldapaccess.hxx"
#include "ldapuserprofilebe.hxx"
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <rtl/instance.hxx>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -35,8 +35,7 @@
namespace extensions::config::ldap {
LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContext>& xContext)
-: LdapProfileMutexHolder(),
- BackendBase(mMutex)
+: BackendBase(m_aMutex)
{
LdapDefinition aDefinition;
OUString loggedOnUser;
@@ -47,7 +46,7 @@ LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContex
// the configuration for the backend would create another instance of the
// backend, which would try and read the configuration which would...
{
- osl::Mutex & aInitMutex = rtl::Static< osl::Mutex, LdapUserProfileBe >::get();
+ static osl::Mutex aInitMutex;
osl::MutexGuard aInitGuard(aInitMutex);
static bool bReentrantCall; // = false
@@ -94,10 +93,9 @@ bool LdapUserProfileBe::readLdapConfiguration(
uno::Reference< lang::XMultiServiceFactory > xCfgProvider(
css::configuration::theDefaultProvider::get(context));
- css::beans::NamedValue aPath("nodepath", uno::makeAny(OUString("org.openoffice.LDAP/UserDirectory")) );
+ css::beans::NamedValue aPath("nodepath", uno::Any(OUString("org.openoffice.LDAP/UserDirectory")) );
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] <<= aPath;
+ uno::Sequence< uno::Any > aArgs{ uno::Any(aPath) };
xIface = xCfgProvider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aArgs);
@@ -174,16 +172,16 @@ css::uno::Any LdapUserProfileBe::getPropertyValue(
}
LdapData::iterator k(data_.find(PropertyName.copy(i, j - i)));
if (k != data_.end()) {
- return css::uno::makeAny(
+ return css::uno::Any(
css::beans::Optional< css::uno::Any >(
- true, css::uno::makeAny(k->second)));
+ true, css::uno::Any(k->second)));
}
if (j == PropertyName.getLength()) {
break;
}
i = j + 1;
}
- return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
+ return css::uno::Any(css::beans::Optional< css::uno::Any >());
}
diff --git a/extensions/source/config/ldap/ldapuserprofilebe.hxx b/extensions/source/config/ldap/ldapuserprofilebe.hxx
index 634d0e848992..2f05365328db 100644
--- a/extensions/source/config/ldap/ldapuserprofilebe.hxx
+++ b/extensions/source/config/ldap/ldapuserprofilebe.hxx
@@ -17,13 +17,13 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX
-#define INCLUDED_EXTENSIONS_SOURCE_CONFIG_LDAP_LDAPUSERPROFILEBE_HXX
+#pragma once
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
#include "ldapaccess.hxx"
@@ -42,13 +42,12 @@ struct LdapDefinition;
typedef cppu::WeakComponentImplHelper<css::beans::XPropertySet,
lang::XServiceInfo> BackendBase ;
-struct LdapProfileMutexHolder { osl::Mutex mMutex; };
/**
Implements the PlatformBackend service, a specialization of the
XPropertySet service for retrieving LDAP user profile
configuration settings from an LDAP repository.
*/
-class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase
+class LdapUserProfileBe : private cppu::BaseMutex, public BackendBase
{
public:
@@ -111,6 +110,4 @@ class LdapUserProfileBe : private LdapProfileMutexHolder, public BackendBase
}
-#endif // EXTENSIONS_CONFIG_LDAP_LDAPUSERPROFILE_HXX_
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */