The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Data Structures | Functions
start_tls.c File Reference

Start TLS asynchronously. More...

#include <freeradius-devel/ldap/base.h>
#include <freeradius-devel/util/debug.h>
+ Include dependency graph for start_tls.c:

Go to the source code of this file.

Data Structures

struct  fr_ldap_start_tls_ctx_t
 Holds arguments for the start_tls operation. More...
 

Functions

static void _ldap_start_tls_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.
 
static void _ldap_start_tls_io_read (fr_event_list_t *el, UNUSED int fd, UNUSED int flags, void *uctx)
 Event handler for the response to the StartTLS extended operation.
 
static void _ldap_start_tls_io_write (fr_event_list_t *el, int fd, UNUSED int flags, void *uctx)
 Send an extended operation to the LDAP server, requesting a transition to TLS.
 
int fr_ldap_start_tls_async (fr_ldap_connection_t *c, LDAPControl **serverctrls, LDAPControl **clientctrls)
 Install I/O handlers for Start TLS negotiation.
 
static void ldap_start_tls_handshake (UNUSED fr_event_list_t *el, fr_ldap_start_tls_ctx_t *tls_ctx)
 Run the TLS handshake to completion.
 

Detailed Description

Start TLS asynchronously.

Id
7f03983b541acd48e9ebe89ecc7e0c5e95c4ae4c

Definition in file start_tls.c.


Data Structure Documentation

◆ fr_ldap_start_tls_ctx_t

struct fr_ldap_start_tls_ctx_t

Holds arguments for the start_tls operation.

Definition at line 34 of file start_tls.c.

+ Collaboration diagram for fr_ldap_start_tls_ctx_t:
Data Fields
fr_ldap_connection_t * c The current connection.
LDAPControl ** clientctrls Controls to pass to the client (library).
int msgid
LDAPControl ** serverctrls Controls to pass to the server.

Function Documentation

◆ _ldap_start_tls_io_error()

static void _ldap_start_tls_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 50 of file start_tls.c.

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

◆ _ldap_start_tls_io_read()

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

Event handler for the response to the StartTLS extended operation.

Once the server has agreed to StartTLS, run the TLS handshake.

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

Definition at line 228 of file start_tls.c.

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

◆ _ldap_start_tls_io_write()

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

Send an extended operation to the LDAP server, requesting a transition to TLS.

Behind the scenes ldap_start_tls calls:

 ldap_extended_operation(ld, LDAP_EXOP_START_TLS, NULL, serverctrls, clientctrls, msgidp);
Parameters
[in]elthe event occurred in.
[in]fdthe event occurred on.
[in]flagsfrom kevent.
[in]uctxConnection config and handle.

Definition at line 265 of file start_tls.c.

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

◆ fr_ldap_start_tls_async()

int fr_ldap_start_tls_async ( fr_ldap_connection_t *  c,
LDAPControl **  serverctrls,
LDAPControl **  clientctrls 
)

Install I/O handlers for Start TLS negotiation.

Parameters
[in]cconnection to StartTLS on.
[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 345 of file start_tls.c.

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

◆ ldap_start_tls_handshake()

static void ldap_start_tls_handshake ( UNUSED fr_event_list_t *  el,
fr_ldap_start_tls_ctx_t *  tls_ctx 
)
static

Run the TLS handshake to completion.

libldap before 2.6.9 can't resume a TLS handshake, so the socket is put back into blocking mode, and this call blocks the thread until the handshake completes or fails. Build against libldap 2.6.9 or later to avoid this.

Parameters
[in]elunused.
[in]tls_ctxof the StartTLS operation. Always freed.

Definition at line 191 of file start_tls.c.

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