The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions
sasl.c File Reference
#include <freeradius-devel/ldap/base.h>
#include <freeradius-devel/util/debug.h>
#include <sasl/sasl.h>
+ Include dependency graph for sasl.c:

Go to the source code of this file.

Functions

static void _ldap_sasl_bind_io_error (UNUSED fr_event_list_t *el, UNUSED int fd, UNUSED int flags, UNUSED int fd_errno, void *uctx)
 Error reading from or writing to the file descriptor. More...
 
static void _ldap_sasl_bind_io_read (fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
 Parse a sasl bind response from a server. More...
 
static USES_APPLE_DEPRECATED_API void _ldap_sasl_bind_io_write (fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
 Progress an interactive SASL bind. More...
 
static int _sasl_ctx_free (fr_ldap_sasl_ctx_t *sasl_ctx)
 Ensure any outstanding messages are freed. More...
 
static int _sasl_interact (UNUSED LDAP *handle, UNUSED unsigned flags, void *uctx, void *sasl_callbacks)
 Callback for fr_ldap_sasl_interactive_bind. More...
 
int fr_ldap_sasl_bind_async (fr_ldap_connection_t *c, char const *mechs, char const *identity, char const *password, char const *proxy, char const *realm, LDAPControl **serverctrls, LDAPControl **clientctrls)
 Install I/O handlers for the bind operation. More...
 
unlang_action_t fr_ldap_sasl_bind_auth_async (request_t *request, fr_ldap_thread_t *thread, char const *mechs, char const *identity, char const *password, char const *proxy, char const *realm)
 Initiate an async SASL LDAP bind for authentication. More...
 
int fr_ldap_sasl_bind_auth_send (fr_ldap_sasl_ctx_t *sasl_ctx, int *msgid, fr_ldap_connection_t *ldap_conn)
 Send a SASL LDAP auth bind. More...
 
static void ldap_async_sasl_bind_auth_cancel (request_t *request, UNUSED fr_signal_t action, void *uctx)
 Signal an outstanding SASL LDAP bind to cancel. More...
 
static unlang_action_t ldap_async_sasl_bind_auth_results (rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx)
 Handle the return code from parsed LDAP results to set the module rcode. More...
 
static unlang_action_t ldap_async_sasl_bind_auth_start (UNUSED rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, UNUSED void *uctx)
 Yield interpreter after enqueueing sasl auth bind. More...
 

Function Documentation

◆ _ldap_sasl_bind_io_error()

static void _ldap_sasl_bind_io_error ( UNUSED fr_event_list_t el,
UNUSED int  fd,
UNUSED int  flags,
UNUSED int  fd_errno,
void *  uctx 
)
static

Error reading from or writing to the file descriptor.

Parameters
[in]elthe event occurred in.
[in]fdthe event occurred on.
[in]flagsfrom kevent.
[in]fd_errnoThe error that occurred.
[in]uctxConnection config and handle.

Definition at line 42 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ldap_sasl_bind_io_read()

static void _ldap_sasl_bind_io_read ( fr_event_list_t el,
int  fd,
UNUSED int  flags,
void *  uctx 
)
static

Parse a sasl bind response from a server.

Parameters
[in]elthe event occurred in.
[in]fdthe event occurred on.
[in]flagsfrom kevent.
[in]uctxbind_ctx containing credentials, and connection config/handle.

Definition at line 122 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _ldap_sasl_bind_io_write()

static void _ldap_sasl_bind_io_write ( fr_event_list_t el,
int  fd,
UNUSED int  flags,
void *  uctx 
)
static

Progress an interactive SASL bind.

Parameters
[in]elthe event occurred in.
[in]fdthe event occurred on.
[in]flagsfrom kevent.
[in]uctxConnection config and handle.

Definition at line 200 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _sasl_ctx_free()

static int _sasl_ctx_free ( fr_ldap_sasl_ctx_t sasl_ctx)
static

Ensure any outstanding messages are freed.

Parameters
[in]sasl_ctxto free.
Returns
0;

Definition at line 287 of file sasl.c.

+ Here is the caller graph for this function:

◆ _sasl_interact()

static int _sasl_interact ( UNUSED LDAP *  handle,
UNUSED unsigned  flags,
void *  uctx,
void *  sasl_callbacks 
)
static

Callback for fr_ldap_sasl_interactive_bind.

Parameters
[in]handleused for the SASL bind.
[in]flagsdata as provided to fr_ldap_sasl_interactive_bind.
[in]uctxOur context data, containing the identity, password, realm and various other things.
[in]sasl_callbacksArray of challenges to provide responses for.
Returns
SASL_OK.

Definition at line 60 of file sasl.c.

+ Here is the caller graph for this function:

◆ fr_ldap_sasl_bind_async()

int fr_ldap_sasl_bind_async ( fr_ldap_connection_t c,
char const *  mechs,
char const *  identity,
char const *  password,
char const *  proxy,
char const *  realm,
LDAPControl **  serverctrls,
LDAPControl **  clientctrls 
)

Install I/O handlers for the bind operation.

Parameters
[in]cconnection to StartTLS on.
[in]mechsSpace delimited list of sasl mechs to try.
[in]identitySASL identity to bind with.
[in]passwordPassword credential to pass to SASL.
[in]proxyidentity. May be NULL.
[in]realmSASL realm.
[in]serverctrlsExtra controls to pass to the server.
[in]clientctrlsExtra controls to pass to libldap.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 308 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_ldap_sasl_bind_auth_async()

unlang_action_t fr_ldap_sasl_bind_auth_async ( request_t request,
fr_ldap_thread_t thread,
char const *  mechs,
char const *  identity,
char const *  password,
char const *  proxy,
char const *  realm 
)

Initiate an async SASL LDAP bind for authentication.

Parameters
[in]requestthis bind relates to.
[in]threadwhose connection the bind should be performed on.
[in]mechsSASL mechanisms to use.
[in]identityIdentity to bind with.
[in]passwordPassword to bind with.
[in]proxyIdentity to proxy.
[in]realmSASL realm if applicable.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 504 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_ldap_sasl_bind_auth_send()

int fr_ldap_sasl_bind_auth_send ( fr_ldap_sasl_ctx_t sasl_ctx,
int *  msgid,
fr_ldap_connection_t ldap_conn 
)

Send a SASL LDAP auth bind.

Shares the same callback as SASL admin binds

Parameters
[in]sasl_ctxcontaining SASL parameters / state for the bind.
[out]msgidwhere to write the LDAP message ID.
[in]ldap_connon which the message should be sent.

Definition at line 367 of file sasl.c.

+ Here is the call graph for this function:

◆ ldap_async_sasl_bind_auth_cancel()

static void ldap_async_sasl_bind_auth_cancel ( request_t request,
UNUSED fr_signal_t  action,
void *  uctx 
)
static

Signal an outstanding SASL LDAP bind to cancel.

Parameters
[in]requestbeing processed. Unused.
[in]actionSignal to handle.
[in]uctxbind auth ctx.

Definition at line 391 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ldap_async_sasl_bind_auth_results()

static unlang_action_t ldap_async_sasl_bind_auth_results ( rlm_rcode_t p_result,
UNUSED int *  priority,
request_t request,
void *  uctx 
)
static

Handle the return code from parsed LDAP results to set the module rcode.

Parameters
[out]p_resultWhere to write return code.
[in]priorityUnused.
[in]requestbeing processed.
[in]uctxbind auth ctx.
Returns
unlang action.

Definition at line 408 of file sasl.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ldap_async_sasl_bind_auth_start()

static unlang_action_t ldap_async_sasl_bind_auth_start ( UNUSED rlm_rcode_t p_result,
UNUSED int *  priority,
UNUSED request_t request,
UNUSED void *  uctx 
)
static

Yield interpreter after enqueueing sasl auth bind.

Definition at line 379 of file sasl.c.

+ Here is the caller graph for this function: