src/connection.c file

Classes

struct option_value_t

Typedefs

using option_value_t = struct option_value_t

Functions

static auto ldap_option2string(int option) -> const char*
static void ldap_requests_init(struct ldap_request_t* requests, int size)
static void search_requests_init(struct ldap_search_request_t* requests, int size)
auto connection_microseconds_to_timeval(TALLOC_CTX* talloc_ctx, int microseconds) -> struct timeval*
connection_microseconds_to_timeval
auto connection_configure(struct ldap_global_context_t* global_ctx, struct ldap_connection_ctx_t* connection, struct ldap_connection_config_t* config) -> enum OperationReturnCode
connection_configure Configures connection while performing following actions:
auto connection_install_handlers(struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_install_handlers Installs handlers for read and write operations.
auto connection_start_tls(struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_start_tls Setups tls transport.
auto connection_sasl_bind(struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_sasl_bind Tries to perform non interactive connection using sasl bind. Installs connection_bind_on_read operation handler.
auto sasl_interact_gssapi(LDAP* ld, unsigned flags, void* indefaults, void* in) -> int
sasl_interact_gssapi This function is a callback that is called by ldap_sasl_interactive_bind.
auto connection_ldap_bind(struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_ldap_bind Performs interactive bind and installs connection_bind_on_read operation handler.
void connection_optional_transition_on_error(struct ldap_connection_ctx_t* connection)
void connection_on_read(verto_ctx* ctx, verto_ev* ev)
connection_on_read This callback is performed on read operation.
void connection_on_write(verto_ctx* ctx, verto_ev* ev)
connection_on_read This callback is performed on write operation.
auto connection_close(struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_close Closes connection and frees resources associated with said connection.
auto connection_bind_on_read(int rc, LDAPMessage* message, struct ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_bind_on_read This callback is performed during bind operation.
auto connection_start_tls_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection) -> enum OperationReturnCode
connection_start_tls_on_read This callback is performed during initiation of tls connection.

Variables

const option_value_t option_strings
const int option_strings_size

Defines

#define container_of(ptr, type, member)
#define number_of_elements(x)
#define set_ldap_option(ldap, option, value)
#define set_bool_option(ldap, option, value)
#define get_ldap_option(ldap, option, value)

Function documentation

struct timeval* connection_microseconds_to_timeval(TALLOC_CTX* talloc_ctx, int microseconds)

connection_microseconds_to_timeval

Parameters
talloc_ctx in
microseconds in Number of microseconds for timeout.
Returns Pointer to timeval struct.

enum OperationReturnCode connection_configure(struct ldap_global_context_t* global_ctx, struct ldap_connection_ctx_t* connection, struct ldap_connection_config_t* config)

connection_configure Configures connection while performing following actions:

Parameters
global_ctx [in] global context to use
connection [out] configured connection ready to be supplied to connection state machine
config [in] connection configuration contains parameters for sasl, tls, etc.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.
  1. Creates LDAP handle and sets protocol version, turns on async connection flag.
  2. Depending on usage of sasl configures sals flags for connection. Allocates structure to hold sasl parameters.
  3. Depending on usage of TLS configures TLS flags for connection.
  4. Creates event base for connection.

enum OperationReturnCode connection_install_handlers(struct ldap_connection_ctx_t* connection)

connection_install_handlers Installs handlers for read and write operations.

Parameters
connection [in] connection to install handlers for.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_SUCCESS on failure.

enum OperationReturnCode connection_start_tls(struct ldap_connection_ctx_t* connection)

connection_start_tls Setups tls transport.

Parameters
connection in connection to use

enum OperationReturnCode connection_sasl_bind(struct ldap_connection_ctx_t* connection)

connection_sasl_bind Tries to perform non interactive connection using sasl bind. Installs connection_bind_on_read operation handler.

Parameters
connection [in] connection to perform bind with.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

int sasl_interact_gssapi(LDAP* ld, unsigned flags, void* indefaults, void* in)

sasl_interact_gssapi This function is a callback that is called by ldap_sasl_interactive_bind.

Parameters
ld [in] ldap handle to use
flags [in] unused
indefaults [in] we need to provide ldap_sasl_defaults_t
in [in] list of client interactions with user for caller to fill in
Returns
  • LDAP_SUCCESS on success.
  • LDAP_PARAM_ERROR on parameter error.

enum OperationReturnCode connection_ldap_bind(struct ldap_connection_ctx_t* connection)

connection_ldap_bind Performs interactive bind and installs connection_bind_on_read operation handler.

Parameters
connection [in] connection to perform bind on
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_OPERATION_IN_PROGRESS if operation is still running.
  • RETURN_CODE_FAILURE on failure.

void connection_on_read(verto_ctx* ctx, verto_ev* ev)

connection_on_read This callback is performed on read operation.

Parameters
ctx [in] event context
ev [in] event

void connection_on_write(verto_ctx* ctx, verto_ev* ev)

connection_on_read This callback is performed on write operation.

Parameters
ctx [in] event context
ev [in] event

enum OperationReturnCode connection_close(struct ldap_connection_ctx_t* connection)

connection_close Closes connection and frees resources associated with said connection.

Parameters
connection [in] connection to use
Returns RETURN_CODE_SUCCESS.

enum OperationReturnCode connection_bind_on_read(int rc, LDAPMessage* message, struct ldap_connection_ctx_t* connection)

connection_bind_on_read This callback is performed during bind operation.

Parameters
rc [in] result code of bind operation.
message [in] message received during operation.
connection [in] connection used during bind operation.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.

enum OperationReturnCode connection_start_tls_on_read(int rc, LDAPMessage* message, ldap_connection_ctx_t* connection)

connection_start_tls_on_read This callback is performed during initiation of tls connection.

Parameters
rc in result code of bind operation.
message in message received during operation.
connection in connection used during bind operation.
Returns
  • RETURN_CODE_SUCCESS on success.
  • RETURN_CODE_FAILURE on failure.