LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContext>& xContext)
: BackendBase(m_aMutex)
{
LdapDefinition aDefinition;
OUString loggedOnUser; // true initially to handle reentrant call; will become false if readLdapConfiguration fails bool bHaveLdapConfiguration = true;
// This whole rigmarole is to prevent an infinite recursion where reading // the configuration for the backend would create another instance of the // backend, which would try and read the configuration which would...
{ static osl::Mutex aInitMutex;
osl::MutexGuard aInitGuard(aInitMutex);
staticbool bReentrantCall; // = false
OSL_ENSURE(!bReentrantCall, "configuration: Ldap Backend constructor called reentrantly - probably a registration error.");
if (!bReentrantCall)
{
bReentrantCall = true ;
comphelper::ScopeGuard aReentrantCallGuard([]() { bReentrantCall = false; }); // Don't throw on fail: this will crash if LDAP is misconfigured, and user opens // Expert Configuration dialog. Instead, just don't fill data_, which will make the // backend return empty values. This happens in SvtUserOptions::Impl::GetValue_Impl // anyway even in throwing scenario, but doing it here also improves performance // because of avoiding repeated attempts to create the backend.
bHaveLdapConfiguration = readLdapConfiguration(
xContext, &aDefinition, &loggedOnUser); if (!bHaveLdapConfiguration)
SAL_WARN("extensions.config", "LdapUserProfileBackend: LDAP not configured");
}
}
if (bHaveLdapConfiguration)
{
LdapConnection connection;
connection.connectSimple(aDefinition);
connection.getUserProfile(loggedOnUser, &data_);
}
}
if (!getLdapStringParam(xChildAccess, u"Server"_ustr, definition->mServer)) returnfalse; if (!getLdapStringParam(xChildAccess, u"BaseDN"_ustr, definition->mBaseDN)) returnfalse;
definition->mPort=0;
xChildAccess->getByName(u"Port"_ustr) >>= definition->mPort ; if (definition->mPort == 0) returnfalse;
if (!getLdapStringParam(xAccess, u"UserObjectClass"_ustr, definition->mUserObjectClass)) returnfalse; if (!getLdapStringParam(xAccess, u"UserUniqueAttribute"_ustr, definition->mUserUniqueAttr)) returnfalse;
getLdapStringParam(xAccess, u"SearchUser"_ustr, definition->mAnonUser);
getLdapStringParam(xAccess, u"SearchPassword"_ustr, definition->mAnonCredentials);
} catch (const uno::Exception&)
{
TOOLS_WARN_EXCEPTION("extensions.config", "LdapUserProfileBackend: access to configuration data failed"); returnfalse;
}
osl::Security aSecurityContext; if (!aSecurityContext.getUserName(*loggedOnUser))
SAL_WARN("extensions.config", "LdapUserProfileBackend - could not get Logged on user from system");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.