21#include "ldapserver.h"
27class LdapServer::LdapServerPrivate
39 int mTimeLimit, mSizeLimit, mVersion, mPageSize, mTimeout;
46 : d( new LdapServerPrivate )
52 : d( new LdapServerPrivate )
60 : d( new LdapServerPrivate )
67 if (
this == &that ) {
93 d->mSizeLimit = d->mTimeLimit = d->mPageSize = 0;
143 return d->mTimeLimit;
148 return d->mSizeLimit;
218 d->mTimeLimit = timelimit;
223 d->mSizeLimit = sizelimit;
228 d->mPageSize = pagesize;
268 bool critical =
true;
270 d->mHost =
url.host();
277 d->mBaseDn =
url.dn();
278 d->mScope =
url.scope();
280 d->mFilter =
url.filter();
283 if (
url.protocol() == QLatin1String(
"ldaps") ) {
285 }
else if (
url.hasExtension( QLatin1String(
"x-tls") ) ) {
288 kDebug() <<
"security:" << d->mSecurity;
293 if (
url.hasExtension(QLatin1String(
"x-sasl") ) ) {
295 if (
url.hasExtension( QLatin1String(
"x-mech") ) ) {
296 d->mMech =
url.extension( QLatin1String(
"x-mech"), critical );
298 if (
url.hasExtension( QLatin1String(
"x-realm") ) ) {
299 d->mRealm =
url.extension( QLatin1String(
"x-realm"), critical );
301 if (
url.hasExtension( QLatin1String(
"bindname") ) ) {
302 d->mBindDn =
url.extension( QLatin1String(
"bindname"), critical );
304 d->mUser =
url.user();
305 }
else if (
url.hasExtension( QLatin1String(
"bindname") ) ) {
307 d->mBindDn =
url.extension( QLatin1String(
"bindname"), critical );
310 if (
user.isEmpty() ) {
317 d->mPassword =
url.password();
318 if (
url.hasExtension( QLatin1String(
"x-version") ) ) {
319 d->mVersion =
url.extension( QLatin1String(
"x-version"), critical ).toInt();
324 if (
url.hasExtension( QLatin1String(
"x-timeout") ) ) {
325 d->mTimeout =
url.extension( QLatin1String(
"x-timeout"), critical ).toInt();
330 if (
url.hasExtension( QLatin1String(
"x-timelimit") ) ) {
331 d->mTimeLimit =
url.extension( QLatin1String(
"x-timelimit"), critical ).toInt();
336 if (
url.hasExtension( QLatin1String(
"x-sizelimit") ) ) {
337 d->mSizeLimit =
url.extension( QLatin1String(
"x-sizelimit"), critical ).toInt();
342 if (
url.hasExtension( QLatin1String(
"x-pagesize") ) ) {
343 d->mPageSize =
url.extension( QLatin1String(
"x-pagesize"), critical ).toInt();
352 url.setProtocol( d->mSecurity ==
SSL ? QLatin1String(
"ldaps") : QLatin1String(
"ldap") );
353 url.setPort( d->mPort );
354 url.setHost( d->mHost );
355 url.setDn( d->mBaseDn );
356 url.setFilter( d->mFilter );
357 url.setScope( d->mScope );
358 if ( d->mAuth ==
SASL ) {
359 url.setUser( d->mUser );
360 url.setPassword( d->mPassword );
361 url.setExtension( QLatin1String(
"bindname"), d->mBindDn,
true );
362 url.setExtension( QLatin1String(
"x-sasl"), QString() );
363 if ( !d->mMech.isEmpty() ) {
364 url.setExtension( QLatin1String(
"x-mech"), d->mMech );
366 if ( !d->mRealm.isEmpty() ) {
367 url.setExtension( QLatin1String(
"x-realm"), d->mRealm );
369 }
else if (d->mAuth ==
Simple ) {
370 url.setUser( d->mBindDn );
371 url.setPassword( d->mPassword );
373 if ( d->mVersion == 2 ) {
374 url.setExtension( QLatin1String(
"x-version"), d->mVersion );
377 url.setExtension( QLatin1String(
"x-timeout"), d->mTimeout );
379 if ( d->mTimeLimit != 0 ) {
380 url.setExtension( QLatin1String(
"x-timelimit"), d->mTimeLimit );
382 if ( d->mSizeLimit != 0 ) {
383 url.setExtension( QLatin1String(
"x-sizelimit"), d->mSizeLimit );
385 if ( d->mPageSize != 0 ) {
386 url.setExtension( QLatin1String(
"x-pagesize"), d->mPageSize );
388 if ( d->mSecurity ==
TLS ) {
389 url.setExtension( QLatin1String(
"x-tls"), 1,
true );
QString realm() const
Returns the realm of the LDAP connection.
void setHost(const QString &host)
Sets the host of the LDAP connection.
Auth
Describes the authentication method that can be used for the LDAP connection.
@ Simple
Authenticate via login and password.
@ SASL
Azthenticate with the SASL framework.
@ Anonymous
Do no authentication.
void setTimeout(int timeout)
Sets the timeout of the LDAP connection.
void setMech(const QString &mech)
Sets the mech of the LDAP connection.
Security security() const
Returns the security mode of the LDAP connection.
void setSecurity(Security mode)
Sets the security mode of the LDAP connection.
void setSizeLimit(int sizelimit)
Sets the size limit of the LDAP connection.
LdapServer()
Creates an empty LDAP server object.
LdapUrl url() const
Returns the server parameters as an RFC2255 compliant LDAP Url.
QString filter() const
Returns the filter string of the LDAP connection.
void setVersion(int version)
Sets the protocol version of the LDAP connection.
LdapDN baseDn() const
Returns the baseDn of the LDAP connection.
int timeout() const
Returns the timeout of the LDAP connection.
void setPassword(const QString &password)
Sets the password of the LDAP connection.
void setScope(LdapUrl::Scope scope)
Sets the search scope of the LDAP connection.
int timeLimit() const
Returns the time limit of the LDAP connection.
void setUser(const QString &user)
Sets the user of the LDAP connection.
QString password() const
Returns the password of the LDAP connection.
QString bindDn() const
Returns the bindDn of the LDAP connection.
void setTimeLimit(int limit)
Sets the time limit of the LDAP connection.
virtual ~LdapServer()
Destroys the LDAP server object.
void setRealm(const QString &realm)
Sets the realm of the LDAP connection.
int version() const
Returns the protocol version of the LDAP connection.
void setUrl(const LdapUrl &url)
Sets the server parameters from an RFC2255 compliant LDAP url.
void setAuth(Auth authentication)
Sets the authentication method of the LDAP connection.
int port() const
Returns the port of the LDAP connection.
int sizeLimit() const
Returns the size limit of the LDAP connection.
void setPageSize(int size)
Sets the page size of the LDAP connection.
QString host() const
Returns the host of the LDAP connection.
int pageSize() const
Returns the page size of the LDAP connection.
void setBindDn(const QString &bindDn)
Sets the bindDn of the LDAP connection.
void setBaseDn(const LdapDN &baseDn)
Sets the baseDn of the LDAP connection.
QString user() const
Returns the user of the LDAP connection.
LdapServer & operator=(const LdapServer &other)
Overwrites the values of the LDAP server object with the values from an other object.
Auth auth() const
Returns the authentication method of the LDAP connection.
void clear()
Clears all server settings.
Security
Describes the encryption settings that can be used for the LDAP connection.
@ None
Do not use any encryption.
void setPort(int port)
Sets the port of the LDAP connection.
QString mech() const
Returns the mech of the LDAP connection.
LdapUrl::Scope scope() const
Returns the search scope of the LDAP connection.
void setFilter(const QString &filter)
Sets the filter string of the LDAP connection.
A special url class for LDAP.
Scope
Describes the scope of the LDAP url.