#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/rad_assert.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <ctype.h>
#include "rlm_sql.h"
Go to the source code of this file.
Functions | |
static int | _mod_conn_free (rlm_sql_handle_t *conn) |
void * | mod_conn_create (TALLOC_CTX *ctx, void *instance, struct timeval const *timeout) |
Create a new connection pool handle. More... | |
sql_rcode_t | rlm_sql_fetch_row (rlm_sql_row_t *out, rlm_sql_t const *inst, REQUEST *request, rlm_sql_handle_t **handle) |
Call the driver's sql_fetch_row function. More... | |
void | rlm_sql_print_error (rlm_sql_t const *inst, REQUEST *request, rlm_sql_handle_t *handle, bool force_debug) |
Retrieve any errors from the SQL driver. More... | |
sql_rcode_t | rlm_sql_query (rlm_sql_t const *inst, REQUEST *request, rlm_sql_handle_t **handle, char const *query) |
Call the driver's sql_query method, reconnecting if necessary. More... | |
void | rlm_sql_query_log (rlm_sql_t const *inst, REQUEST *request, sql_acct_section_t *section, char const *query) |
sql_rcode_t | rlm_sql_select_query (rlm_sql_t const *inst, REQUEST *request, rlm_sql_handle_t **handle, char const *query) |
Call the driver's sql_select_query method, reconnecting if necessary. More... | |
int | sql_fr_pair_list_afrom_str (TALLOC_CTX *ctx, REQUEST *request, VALUE_PAIR **head, rlm_sql_row_t row) |
int | sql_getvpdata (TALLOC_CTX *ctx, rlm_sql_t const *inst, REQUEST *request, rlm_sql_handle_t **handle, VALUE_PAIR **pair, char const *query) |
Variables | |
const FR_NAME_NUMBER | sql_rcode_table [] |
|
static |
void* mod_conn_create | ( | TALLOC_CTX * | ctx, |
void * | instance, | ||
struct timeval const * | timeout | ||
) |
Create a new connection pool handle.
Create a new connection to Couchbase within the pool and initialize information associated with the connection instance.
ctx | The connection parent context. |
instance | The module instance. |
timeout | Maximum time to establish the connection. |
Create a new connection pool handle.
Create a new ldap connection and allocate memory for a new rlm_handle_t
Create a new connection pool handle.
Matches the fr_connection_create_t function prototype, is passed to fr_connection_pool_init, and called when a new connection is required by the connection pool API.
Creates an instances of rlm_rest_handle_t, and rlm_rest_curl_context_t which hold the context data required for generating requests and parsing responses.
If instance->connect_uri is not NULL libcurl will attempt to open a TCP socket to the server specified in the URI. This is done so that when the socket is first used, there will already be a cached TCP connection to the REST server associated with the curl handle.
Definition at line 67 of file sql.c.
sql_rcode_t rlm_sql_fetch_row | ( | rlm_sql_row_t * | out, |
rlm_sql_t const * | inst, | ||
REQUEST * | request, | ||
rlm_sql_handle_t ** | handle | ||
) |
Call the driver's sql_fetch_row function.
Calls the driver's sql_fetch_row logging any errors. On success, will write row data to (*handle)->row
.
out | Where to write row data. |
inst | Instance of rlm_sql_t. |
request | The Current request, may be NULL. |
handle | Handle to retrieve errors for. |
Definition at line 249 of file sql.c.
void rlm_sql_print_error | ( | rlm_sql_t const * | inst, |
REQUEST * | request, | ||
rlm_sql_handle_t * | handle, | ||
bool | force_debug | ||
) |
Retrieve any errors from the SQL driver.
Retrieves errors from the driver from the last operation and writes them to to request/global log, in the ERROR, WARN, INFO and DEBUG categories.
inst | Instance of rlm_sql. |
request | Current request, may be NULL. |
handle | Handle to retrieve errors for. |
force_debug | Force all errors to be logged as debug messages. |
Definition at line 280 of file sql.c.
sql_rcode_t rlm_sql_query | ( | rlm_sql_t const * | inst, |
REQUEST * | request, | ||
rlm_sql_handle_t ** | handle, | ||
char const * | query | ||
) |
Call the driver's sql_query method, reconnecting if necessary.
(inst->module->sql_finish_query)(handle, inst->config);
after they're done with the result.handle | to query the database with. *handle should not be NULL, as this indicates previous reconnection attempt has failed. |
request | Current request. |
inst | rlm_sql_t instance data. |
query | to execute. Should not be zero length. |
Definition at line 337 of file sql.c.
void rlm_sql_query_log | ( | rlm_sql_t const * | inst, |
REQUEST * | request, | ||
sql_acct_section_t * | section, | ||
char const * | query | ||
) |
sql_rcode_t rlm_sql_select_query | ( | rlm_sql_t const * | inst, |
REQUEST * | request, | ||
rlm_sql_handle_t ** | handle, | ||
char const * | query | ||
) |
Call the driver's sql_select_query method, reconnecting if necessary.
(inst->module->sql_finish_select_query)(handle, inst->config);
after they're done with the result.inst | rlm_sql_t instance data. |
request | Current request. |
handle | to query the database with. *handle should not be NULL, as this indicates previous reconnection attempt has failed. |
query | to execute. Should not be zero length. |
Definition at line 438 of file sql.c.
int sql_fr_pair_list_afrom_str | ( | TALLOC_CTX * | ctx, |
REQUEST * | request, | ||
VALUE_PAIR ** | head, | ||
rlm_sql_row_t | row | ||
) |
int sql_getvpdata | ( | TALLOC_CTX * | ctx, |
rlm_sql_t const * | inst, | ||
REQUEST * | request, | ||
rlm_sql_handle_t ** | handle, | ||
VALUE_PAIR ** | pair, | ||
char const * | query | ||
) |
const FR_NAME_NUMBER sql_rcode_table[] |