/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP char* stub = nullptr;
ldap_get_lderrno(aConnection, NULL, &stub) ; if (stub != nullptr)
{
message += OUString::createFromAscii(stub) ; // It would seem the message returned is actually // not a copy of a string but rather some static // string itself. At any rate freeing it seems to // cause some undue problems at least on Windows. // This call is thus disabled for the moment. //ldap_memfree(stub) ;
} else #endif
{ message += "No additional information"; }
void LdapConnection::connectSimple(const LdapDefinition& aDefinition)
{
OSL_ENSURE(!isValid(), "Re-connecting to an LDAP connection that is already established"); if (isValid()) disconnect();
mLdapDefinition = aDefinition;
connectSimple();
}
void LdapConnection::connectSimple()
{ if (isValid()) return;
// Connect to the server
initConnection() ; // Set Protocol V3 int version = LDAP_VERSION3;
ldap_set_option(mConnection,
LDAP_OPT_PROTOCOL_VERSION,
&version);
#ifdef LDAP_X_OPT_CONNECT_TIMEOUT // OpenLDAP doesn't support this and the func /* timeout is specified in milliseconds -> 4 seconds*/ int timeout = 4000; #ifdef _WIN32
ldap_set_optionW( mConnection,
LDAP_X_OPT_CONNECT_TIMEOUT,
&timeout ); #else
ldap_set_option( mConnection,
LDAP_X_OPT_CONNECT_TIMEOUT,
&timeout ); #endif #endif
void LdapConnection::initConnection()
{ if (mLdapDefinition.mServer.isEmpty())
{ throw ldap::LdapConnectionException(u"Cannot initialise connection to LDAP: No server specified."_ustr);
}
if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
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.