• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KLDAP Library

  • KLDAP
  • LdapOperation
Public Types | Public Member Functions | List of all members
KLDAP::LdapOperation Class Reference

#include <ldapoperation.h>

Public Types

typedef QList< ModOp > ModOps
 
enum  ModType { Mod_None, Mod_Add, Mod_Replace, Mod_Del }
 
enum  ResultType {
  RES_BIND = 0x61, RES_SEARCH_ENTRY = 0x64, RES_SEARCH_REFERENCE = 0x73, RES_SEARCH_RESULT = 0x65,
  RES_MODIFY = 0x67, RES_ADD = 0x69, RES_DELETE = 0x69, RES_MODDN = 0x6d,
  RES_COMPARE = 0x6f, RES_EXTENDED = 0x78, RES_EXTENDED_PARTIAL = 0x79
}
 
typedef int( SASL_Callback_Proc )(SASL_Credentials &cred, void *data)
 
enum  SASL_Fields { SASL_Authname = 0x1, SASL_Authzid = 0x2, SASL_Realm = 0x4, SASL_Password = 0x8 }
 

Public Member Functions

 LdapOperation (LdapConnection &conn)
 
int abandon (int id)
 
int add (const LdapObject &object)
 
int add (const LdapDN &dn, const ModOps &ops)
 
int add_s (const LdapObject &object)
 
int add_s (const LdapDN &dn, const ModOps &ops)
 
int bind (const QByteArray &creds=QByteArray(), SASL_Callback_Proc *saslproc=NULL, void *data=NULL)
 
int bind_s (SASL_Callback_Proc *saslproc=NULL, void *data=NULL)
 
LdapControls clientControls () const
 
int compare (const LdapDN &dn, const QString &attr, const QByteArray &value)
 
int compare_s (const LdapDN &dn, const QString &attr, const QByteArray &value)
 
LdapConnection & connection ()
 
LdapControls controls () const
 
int del (const LdapDN &dn)
 
int del_s (const LdapDN &dn)
 
int exop (const QString &oid, const QByteArray &data)
 
int exop_s (const QString &oid, const QByteArray &data)
 
QByteArray extendedData () const
 
QByteArray extendedOid () const
 
QString matchedDn () const
 
int modify (const LdapDN &dn, const ModOps &ops)
 
int modify_s (const LdapDN &dn, const ModOps &ops)
 
LdapObject object () const
 
QList< QByteArray > referrals () const
 
int rename (const LdapDN &dn, const QString &newRdn, const QString &newSuperior, bool deleteold=true)
 
int rename_s (const LdapDN &dn, const QString &newRdn, const QString &newSuperior, bool deleteold=true)
 
int search (const LdapDN &base, LdapUrl::Scope scope, const QString &filter, const QStringList &attrs)
 
LdapControls serverControls () const
 
QByteArray serverCred () const
 
void setClientControls (const LdapControls &ctrls)
 
void setConnection (LdapConnection &conn)
 
void setServerControls (const LdapControls &ctrls)
 
int waitForResult (int id, int msecs=-1)
 

Detailed Description

This class allows sending an ldap operation (search, rename, modify, delete, compare, exop) to an LDAP server.

Definition at line 43 of file ldapoperation.h.

Member Function Documentation

int LdapOperation::abandon ( int  id)

Abandons a long-running operation.

Requires the message id.

Definition at line 1315 of file ldapoperation.cpp.

int LdapOperation::add ( const LdapObject &  object)

Starts an addition operation.

Returns a message id if successful, -1 if not.

Parameters
objectthe additional operation to start

Definition at line 1223 of file ldapoperation.cpp.

int LdapOperation::add ( const LdapDN &  dn,
const ModOps &  ops 
)

Starts an addition operation.

This version accepts ModOps not LdapObject. Returns a message id if successful, -1 if not.

Parameters
dnthe LdapDN operation to start
opsthe ModOps operation to start

Definition at line 1235 of file ldapoperation.cpp.

int LdapOperation::add_s ( const LdapObject &  object)

Adds the specified object to the LDAP database.

Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Parameters
objectthe object to add to LDAP database

Definition at line 1229 of file ldapoperation.cpp.

int LdapOperation::add_s ( const LdapDN &  dn,
const ModOps &  ops 
)

Adds the specified object to the LDAP database.

This version accepts ModOps not LdapObject. This is the synchronous version. Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Parameters
dnthe LdapDN object to add
opsthe ModOps object to add

Definition at line 1241 of file ldapoperation.cpp.

int LdapOperation::bind ( const QByteArray &  creds = QByteArray(),
SASL_Callback_Proc *  saslproc = NULL,
void *  data = NULL 
)

Binds to the server which specified in the connection object.

Can do simple or SASL bind. Returns a message id if successful, negative value if not.

Definition at line 1204 of file ldapoperation.cpp.

int LdapOperation::bind_s ( SASL_Callback_Proc *  saslproc = NULL,
void *  data = NULL 
)

Binds to the server which specified in the connection object.

Can do simple or SASL bind. This is the synchronous version. Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Definition at line 1210 of file ldapoperation.cpp.

LdapControls LdapOperation::clientControls ( ) const

Returns the client controls (which set by setClientControls()).

Definition at line 124 of file ldapoperation.cpp.

int LdapOperation::compare ( const LdapDN &  dn,
const QString &  attr,
const QByteArray &  value 
)

Starts a compare operation on the given DN, compares the specified attribute with the given value.

Returns a message id if successful, -1 if not.

Definition at line 1285 of file ldapoperation.cpp.

int LdapOperation::compare_s ( const LdapDN &  dn,
const QString &  attr,
const QByteArray &  value 
)

Performs a compare operation on the given DN, compares the specified attribute with the given value.

This is the synchronous version. Returns KLDAP_COMPARE_TRUE if the entry contains the attribute value and KLDAP_COMPARE_FALSE if it does not. Otherwise, some error code is returned.

Definition at line 1297 of file ldapoperation.cpp.

LdapConnection & LdapOperation::connection ( )

Returns the connection object.

Definition at line 109 of file ldapoperation.cpp.

LdapControls LdapOperation::controls ( ) const

Returns the server controls from the returned ldap message (grabbed by result()).

Definition at line 139 of file ldapoperation.cpp.

int LdapOperation::del ( const LdapDN &  dn)

Starts a delete operation on the given DN.

Returns a message id if successful, -1 if not.

Definition at line 1261 of file ldapoperation.cpp.

int LdapOperation::del_s ( const LdapDN &  dn)

Deletes the given DN.

This is the synchronous version. Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Parameters
dnthe dn to delete

Definition at line 1267 of file ldapoperation.cpp.

int LdapOperation::exop ( const QString &  oid,
const QByteArray &  data 
)

Starts an extended operation specified with oid and data.

Returns a message id if successful, -1 if not.

Definition at line 1291 of file ldapoperation.cpp.

int LdapOperation::exop_s ( const QString &  oid,
const QByteArray &  data 
)

Performs an extended operation specified with oid and data.

This is the synchronous version. Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Definition at line 1303 of file ldapoperation.cpp.

QByteArray LdapOperation::extendedData ( ) const

Returns the data from the extended operation response (result returned RES_EXTENDED).

Definition at line 149 of file ldapoperation.cpp.

QByteArray LdapOperation::extendedOid ( ) const

Returns the OID of the extended operation response (result returned RES_EXTENDED).

Definition at line 144 of file ldapoperation.cpp.

QString LdapOperation::matchedDn ( ) const

The server might supply a matched DN string in the message indicating how much of a name in a request was recognized.

This can be grabbed by matchedDn().

Definition at line 154 of file ldapoperation.cpp.

int LdapOperation::modify ( const LdapDN &  dn,
const ModOps &  ops 
)

Starts a modify operation on the given DN.

Returns a message id if successful, -1 if not.

Parameters
dnthe DN to start modify operation on

Definition at line 1273 of file ldapoperation.cpp.

int LdapOperation::modify_s ( const LdapDN &  dn,
const ModOps &  ops 
)

Performs a modify operation on the given DN.

This is the synchronous version. Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Definition at line 1279 of file ldapoperation.cpp.

LdapObject LdapOperation::object ( ) const

Returns the result object if result() returned RES_SEARCH_ENTRY.

Definition at line 134 of file ldapoperation.cpp.

QList< QByteArray > LdapOperation::referrals ( ) const

This function returns the referral strings from the parsed message (if any).

Definition at line 159 of file ldapoperation.cpp.

int LdapOperation::rename ( const LdapDN &  dn,
const QString &  newRdn,
const QString &  newSuperior,
bool  deleteold = true 
)

Starts a modrdn operation on given DN, changing its RDN to newRdn, changing its parent to newSuperior (if it's not empty), and deletes the old dn if deleteold is true.

Returns a message id if successful, -1 if not.

Definition at line 1247 of file ldapoperation.cpp.

int LdapOperation::rename_s ( const LdapDN &  dn,
const QString &  newRdn,
const QString &  newSuperior,
bool  deleteold = true 
)

Performs a modrdn operation on given DN, changing its RDN to newRdn, changing its parent to newSuperior (if it's not empty), and deletes the old dn if deleteold is true.

This is the synchronous version. Returns KLDAP_SUCCESS id if successful, else an LDAP error code.

Definition at line 1254 of file ldapoperation.cpp.

int LdapOperation::search ( const LdapDN &  base,
LdapUrl::Scope  scope,
const QString &  filter,
const QStringList &  attrs 
)

Starts a search operation with the given base DN, scope, filter and result attributes.

Returns a message id if successful, -1 if not.

Definition at line 1216 of file ldapoperation.cpp.

LdapControls LdapOperation::serverControls ( ) const

Returns the server controls (which set by setServerControls()).

Definition at line 129 of file ldapoperation.cpp.

QByteArray LdapOperation::serverCred ( ) const

Returns the server response for a bind request (result returned RES_BIND).

Definition at line 164 of file ldapoperation.cpp.

void LdapOperation::setClientControls ( const LdapControls &  ctrls)

Sets the client controls which will sent with each operation.

Definition at line 114 of file ldapoperation.cpp.

void LdapOperation::setConnection ( LdapConnection &  conn)

Sets the connection object.

Without living connection object, LDAP operations are not possible.

Parameters
theconnection object to set

Definition at line 104 of file ldapoperation.cpp.

void LdapOperation::setServerControls ( const LdapControls &  ctrls)

Sets the server controls which will sent with each operation.

Definition at line 119 of file ldapoperation.cpp.

int LdapOperation::waitForResult ( int  id,
int  msecs = -1 
)

Waits for up to msecs milliseconds for a result message from the LDAP server.

If msecs is -1, then this function will block indefinitely. If msecs is 0, then this function will return immediately, that is it will perform a poll for a result message.

Returns the type of the result LDAP message (RES_XXX constants). -1 if error occurred, 0 if the timeout value elapsed. Note! Return code -1 means that fetching the message resulted in error, not the LDAP operation error. Call connection().ldapErrorCode() to determine if the operation succeeded.

Definition at line 1309 of file ldapoperation.cpp.


The documentation for this class was generated from the following files:
  • ldapoperation.h
  • ldapoperation.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:37:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KLDAP Library

Skip menu "KLDAP Library"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal