The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Functions | Variables
base.c File Reference

Curl global initialisation. More...

#include <freeradius-devel/curl/base.h>
#include <freeradius-devel/curl/xlat.h>
#include <freeradius-devel/util/talloc.h>
#include <freeradius-devel/util/syserror.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include "attrs.h"
+ Include dependency graph for base.c:

Go to the source code of this file.

Functions

static int _curl_tmpl_handle (void *arg)
 Free the curl easy handle. More...
 
int fr_curl_easy_tls_init (fr_curl_io_request_t *randle, fr_curl_tls_t const *conf)
 
static void fr_curl_free (void)
 
static int fr_curl_init (void)
 Initialise global curl options. More...
 
int fr_curl_response_certinfo (request_t *request, fr_curl_io_request_t *randle)
 
CURL * fr_curl_tmp_handle (void)
 Return a thread local curl easy handle. More...
 
static int tls_config_dflt_capath (CONF_PAIR **out, UNUSED void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule)
 

Variables

fr_dict_attr_t const * attr_tls_certificate
 Attribute definitions for lib curl. More...
 
fr_dict_attr_autoload_t curl_attr []
 
static fr_dict_autoload_t curl_dict []
 
static fr_dict_t const * dict_freeradius
 
global_lib_autoinst_t fr_curl_autoinst
 
conf_parser_t fr_curl_conn_config []
 
static fr_table_num_sorted_t const fr_curl_sslcode_table []
 
static size_t fr_curl_sslcode_table_len = NUM_ELEMENTS(fr_curl_sslcode_table)
 
conf_parser_t fr_curl_tls_config []
 
static conf_parser_t reuse_curl_conn_config []
 

Detailed Description

Curl global initialisation.

Id
a700bb2c0ceb17ae09040d3f3656b1eb0c479862

Definition in file base.c.

Function Documentation

◆ _curl_tmpl_handle()

static int _curl_tmpl_handle ( void *  arg)
static

Free the curl easy handle.

Parameters
[in]argcurl easy handle to free.

Definition at line 264 of file base.c.

+ Here is the caller graph for this function:

◆ fr_curl_easy_tls_init()

int fr_curl_easy_tls_init ( fr_curl_io_request_t randle,
fr_curl_tls_t const *  conf 
)

Definition at line 141 of file base.c.

+ Here is the caller graph for this function:

◆ fr_curl_free()

static void fr_curl_free ( void  )
static

Definition at line 383 of file base.c.

+ Here is the call graph for this function:

◆ fr_curl_init()

static int fr_curl_init ( void  )
static

Initialise global curl options.

libcurl is meant to performa reference counting, but still seems to leak lots of memory if we call curl_global_init many times.

Definition at line 299 of file base.c.

+ Here is the call graph for this function:

◆ fr_curl_response_certinfo()

int fr_curl_response_certinfo ( request_t request,
fr_curl_io_request_t randle 
)

Definition at line 172 of file base.c.

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

◆ fr_curl_tmp_handle()

CURL* fr_curl_tmp_handle ( void  )

Return a thread local curl easy handle.

This should only be used for calls into libcurl functions which don't operate on an active request, like the escape/unescape functions.

Returns
  • A thread local curl easy handle.
  • NULL on failure.

Definition at line 280 of file base.c.

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

◆ tls_config_dflt_capath()

static int tls_config_dflt_capath ( CONF_PAIR **  out,
UNUSED void *  parent,
CONF_SECTION cs,
fr_token_t  quote,
conf_parser_t const *  rule 
)
static

Definition at line 57 of file base.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_tls_certificate

fr_dict_attr_t const* attr_tls_certificate

Attribute definitions for lib curl.

Definition at line 36 of file base.c.

◆ curl_attr

Initial value:
= {
{ .out = &attr_tls_certificate, .name = "TLS-Certificate", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
{ NULL }
}
static fr_dict_t const * dict_freeradius
Definition: base.c:37
fr_dict_attr_t const * attr_tls_certificate
Attribute definitions for lib curl.
Definition: base.c:36
@ FR_TYPE_TLV
Contains nested attributes.
Definition: merged_model.c:118

Definition at line 40 of file base.c.

◆ curl_dict

fr_dict_autoload_t curl_dict[]
static
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ NULL }
}

Definition at line 45 of file base.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 37 of file base.c.

◆ fr_curl_autoinst

global_lib_autoinst_t fr_curl_autoinst
Initial value:
= {
.name = "curl",
.init = fr_curl_init,
.free = fr_curl_free
}
static int fr_curl_init(void)
Initialise global curl options.
Definition: base.c:299
static void fr_curl_free(void)
Definition: base.c:383

Definition at line 400 of file base.c.

◆ fr_curl_conn_config

conf_parser_t fr_curl_conn_config[]
Initial value:
= {
{ FR_CONF_OFFSET("connect_timeout", fr_curl_conn_config_t, connect_timeout), .dflt = "3.0" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:627
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268
#define FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
Definition: cf_parse.h:297
static conf_parser_t reuse_curl_conn_config[]
Definition: base.c:92

Definition at line 99 of file base.c.

◆ fr_curl_sslcode_table

fr_table_num_sorted_t const fr_curl_sslcode_table[]
static
Initial value:
= {
{L("allow"), CURLUSESSL_TRY },
{L("demand"), CURLUSESSL_ALL },
{L("never"), CURLUSESSL_NONE },
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition: build.h:207

Definition at line 50 of file base.c.

◆ fr_curl_sslcode_table_len

size_t fr_curl_sslcode_table_len = NUM_ELEMENTS(fr_curl_sslcode_table)
static

Definition at line 55 of file base.c.

◆ fr_curl_tls_config

conf_parser_t fr_curl_tls_config[]
Initial value:
= {
{ FR_CONF_OFFSET_FLAGS("ca_issuer_file", CONF_FLAG_FILE_INPUT, fr_curl_tls_t, ca_issuer_file) },
{ FR_CONF_OFFSET_FLAGS("certificate_file", CONF_FLAG_FILE_INPUT, fr_curl_tls_t, certificate_file) },
{ FR_CONF_OFFSET_FLAGS("private_key_file", CONF_FLAG_FILE_INPUT, fr_curl_tls_t, private_key_file) },
{ FR_CONF_OFFSET_FLAGS("private_key_password", CONF_FLAG_SECRET, fr_curl_tls_t, private_key_password) },
{ FR_CONF_OFFSET("random_file", fr_curl_tls_t, random_file) },
{ FR_CONF_OFFSET_TYPE_FLAGS("require_cert", FR_TYPE_VOID, 0, fr_curl_tls_t, require_cert),
},
.dflt = "allow" },
{ FR_CONF_OFFSET("check_cert", fr_curl_tls_t, check_cert), .dflt = "yes" },
{ FR_CONF_OFFSET("check_cert_cn", fr_curl_tls_t, check_cert_cn), .dflt = "yes" },
{ FR_CONF_OFFSET("extract_cert_attrs", fr_curl_tls_t, extract_cert_attrs), .dflt = "no" },
}
int cf_table_parse_int(UNUSED TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
Generic function for parsing conf pair values as int.
Definition: cf_parse.c:1474
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:256
@ CONF_FLAG_SECRET
Only print value if debug level >= 3.
Definition: cf_parse.h:409
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:411
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:241
static fr_table_num_sorted_t const fr_curl_sslcode_table[]
Definition: base.c:50
static size_t fr_curl_sslcode_table_len
Definition: base.c:55
static int tls_config_dflt_capath(CONF_PAIR **out, UNUSED void *parent, CONF_SECTION *cs, fr_token_t quote, conf_parser_t const *rule)
Definition: base.c:57
@ FR_TYPE_VOID
User data.
Definition: merged_model.c:127

Definition at line 68 of file base.c.

◆ reuse_curl_conn_config

conf_parser_t reuse_curl_conn_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("min", fr_slab_config_t, min_elements), .dflt = "10" },
{ FR_CONF_OFFSET("max", fr_slab_config_t, max_elements), .dflt = "100" },
{ FR_CONF_OFFSET("cleanup_interval", fr_slab_config_t, interval), .dflt = "30s" },
}
Tuneable parameters for slabs.
Definition: slab.h:42

Definition at line 92 of file base.c.