The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/util/debug.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <ctype.h>
#include "rlm_sql.h"
Go to the source code of this file.
Macros | |
#define | LOG_PREFIX inst->name |
Functions | |
fr_sql_query_t * | fr_sql_query_alloc (TALLOC_CTX *ctx, rlm_sql_t const *inst, request_t *request, rlm_sql_handle_t *handle, trunk_t *trunk, char const *query_str, fr_sql_query_type_t type) |
Allocate an sql query structure. More... | |
static int | fr_sql_query_free (fr_sql_query_t *to_free) |
Automatically run the correct finish function when freeing an SQL query. More... | |
unlang_action_t | rlm_sql_fetch_row (rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx) |
Call the driver's sql_fetch_row function. More... | |
void | rlm_sql_print_error (rlm_sql_t const *inst, request_t *request, fr_sql_query_t *query_ctx, bool force_debug) |
Retrieve any errors from the SQL driver. More... | |
unlang_action_t | rlm_sql_query (rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx) |
Call the driver's sql_query method, reconnecting if necessary. More... | |
void | rlm_sql_query_log (rlm_sql_t const *inst, char const *filename, char const *query) |
unlang_action_t | rlm_sql_select_query (rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx) |
Call the driver's sql_select_query method, reconnecting if necessary. More... | |
unlang_action_t | rlm_sql_trunk_query (rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx) |
Submit an SQL query using a trunk connection. More... | |
unlang_action_t | sql_get_map_list (request_t *request, fr_sql_map_ctx_t *map_ctx, rlm_sql_handle_t **handle, trunk_t *trunk) |
Submit the query to get any user / group check or reply pairs. More... | |
static unlang_action_t | sql_get_map_list_resume (rlm_rcode_t *p_result, UNUSED int *priority, request_t *request, void *uctx) |
Process the results of an SQL query to produce a map list. More... | |
void * | sql_mod_conn_create (TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeout) |
static void | sql_trunk_query_cancel (UNUSED request_t *request, UNUSED fr_signal_t action, void *uctx) |
Cancel an SQL query submitted on a trunk. More... | |
static unlang_action_t | sql_trunk_query_start (UNUSED rlm_rcode_t *p_result, UNUSED int *priority, UNUSED request_t *request, UNUSED void *uctx) |
Yield processing after submitting a trunk request. More... | |
fr_sql_query_t* fr_sql_query_alloc | ( | TALLOC_CTX * | ctx, |
rlm_sql_t const * | inst, | ||
request_t * | request, | ||
rlm_sql_handle_t * | handle, | ||
trunk_t * | trunk, | ||
char const * | query_str, | ||
fr_sql_query_type_t | type | ||
) |
|
static |
unlang_action_t rlm_sql_fetch_row | ( | rlm_rcode_t * | p_result, |
UNUSED int * | priority, | ||
request_t * | request, | ||
void * | uctx | ||
) |
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 uctx->row
.
The rcode within the query context is updated to
p_result | Result of current module call. |
priority | Unused. |
request | Current request. |
uctx | query context containing query to execute. |
Definition at line 308 of file sql.c.
void rlm_sql_print_error | ( | rlm_sql_t const * | inst, |
request_t * | request, | ||
fr_sql_query_t * | query_ctx, | ||
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. |
query_ctx | Query context to retrieve errors for. |
force_debug | Force all errors to be logged as debug messages. |
Definition at line 352 of file sql.c.
unlang_action_t rlm_sql_query | ( | rlm_rcode_t * | p_result, |
UNUSED int * | priority, | ||
request_t * | request, | ||
void * | uctx | ||
) |
Call the driver's sql_query method, reconnecting if necessary.
(inst->driver->sql_finish_query)(handle, &inst->config);
after they're done with the result.The rcode within the query context is updated to
p_result | Result of current module call. |
priority | Unused. |
request | Current request. |
uctx | query context containing query to execute. |
Definition at line 447 of file sql.c.
void rlm_sql_query_log | ( | rlm_sql_t const * | inst, |
char const * | filename, | ||
char const * | query | ||
) |
unlang_action_t rlm_sql_select_query | ( | rlm_rcode_t * | p_result, |
UNUSED int * | priority, | ||
request_t * | request, | ||
void * | uctx | ||
) |
Call the driver's sql_select_query method, reconnecting if necessary.
(inst->driver->sql_finish_select_query)(handle, &inst->config);
after they're done with the result.The rcode within the query context is updated to
p_result | Result of current module call. |
priority | Unused. |
request | Current request. |
uctx | query context containing query to execute. |
Definition at line 646 of file sql.c.
unlang_action_t rlm_sql_trunk_query | ( | rlm_rcode_t * | p_result, |
UNUSED int * | priority, | ||
request_t * | request, | ||
void * | uctx | ||
) |
Submit an SQL query using a trunk connection.
p_result | Result of current module call. |
priority | Unused. |
request | Current request. |
uctx | query context containing query to execute. |
Definition at line 572 of file sql.c.
unlang_action_t sql_get_map_list | ( | request_t * | request, |
fr_sql_map_ctx_t * | map_ctx, | ||
rlm_sql_handle_t ** | handle, | ||
trunk_t * | trunk | ||
) |
|
static |
void* sql_mod_conn_create | ( | TALLOC_CTX * | ctx, |
void * | instance, | ||
fr_time_delta_t | timeout | ||
) |
|
static |
|
static |
fr_table_num_sorted_t const sql_rcode_description_table[] |
size_t sql_rcode_description_table_len = NUM_ELEMENTS(sql_rcode_description_table) |
fr_table_num_sorted_t const sql_rcode_table[] |
size_t sql_rcode_table_len = NUM_ELEMENTS(sql_rcode_table) |