The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros | Functions | Variables
rlm_attr_filter.c File Reference

Filter the contents of a list, allowing only certain attributes. More...

#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/users_file.h>
#include <sys/stat.h>
#include <ctype.h>
#include <fcntl.h>
+ Include dependency graph for rlm_attr_filter.c:

Go to the source code of this file.

Data Structures

struct  rlm_attr_filter_t
 

Macros

#define LOG_PREFIX   mctx->inst->name
 
#define RLM_AF_FUNC(_x, _y, _z)
 

Functions

static unlang_action_t attr_filter_common (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, fr_packet_t *packet, fr_pair_list_t *list)
 
static int attr_filter_getfile (TALLOC_CTX *ctx, module_inst_ctx_t const *mctx, char const *filename, PAIR_LIST_LIST *pair_list)
 
static void check_pair (request_t *request, fr_pair_t *check_item, fr_pair_t *reply_item, int *pass, int *fail)
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 

Variables

static fr_dict_attr_t const * attr_fall_through
 
static fr_dict_attr_t const * attr_relax_filter
 
static fr_dict_attr_t const * attr_stripped_user_name
 
static fr_dict_attr_t const * attr_vendor_specific
 
static fr_dict_t const * dict_freeradius
 
static fr_dict_t const * dict_radius
 
static const conf_parser_t module_config []
 
module_rlm_t rlm_attr_filter
 
fr_dict_autoload_t rlm_attr_filter_dict []
 
fr_dict_attr_autoload_t rlm_attr_filter_dict_attr []
 

Detailed Description

Filter the contents of a list, allowing only certain attributes.

Id
bad95a7a399984a8666995193669f21bb97bc015

Definition in file rlm_attr_filter.c.


Data Structure Documentation

◆ rlm_attr_filter_t

struct rlm_attr_filter_t

Definition at line 43 of file rlm_attr_filter.c.

+ Collaboration diagram for rlm_attr_filter_t:
Data Fields
PAIR_LIST_LIST attrs
char const * filename
tmpl_t * key
bool relaxed

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   mctx->inst->name

Definition at line 27 of file rlm_attr_filter.c.

◆ RLM_AF_FUNC

#define RLM_AF_FUNC (   _x,
  _y,
  _z 
)
Value:
static unlang_action_t mod_##_x(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) \
{ \
return attr_filter_common(p_result, mctx, request, request->_y, &request->_z##_pairs); \
}
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
Temporary structure to hold arguments for module calls.
Definition: module_ctx.h:41
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
static unlang_action_t attr_filter_common(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, fr_packet_t *packet, fr_pair_list_t *list)

Definition at line 362 of file rlm_attr_filter.c.

Function Documentation

◆ attr_filter_common()

static unlang_action_t attr_filter_common ( rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request,
fr_packet_t packet,
fr_pair_list_t list 
)
static

Definition at line 189 of file rlm_attr_filter.c.

+ Here is the call graph for this function:

◆ attr_filter_getfile()

static int attr_filter_getfile ( TALLOC_CTX *  ctx,
module_inst_ctx_t const *  mctx,
char const *  filename,
PAIR_LIST_LIST pair_list 
)
static

Definition at line 103 of file rlm_attr_filter.c.

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

◆ check_pair()

static void check_pair ( request_t request,
fr_pair_t check_item,
fr_pair_t reply_item,
int *  pass,
int *  fail 
)
static

Definition at line 83 of file rlm_attr_filter.c.

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

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 169 of file rlm_attr_filter.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_fall_through

fr_dict_attr_t const* attr_fall_through
static

Definition at line 68 of file rlm_attr_filter.c.

◆ attr_relax_filter

fr_dict_attr_t const* attr_relax_filter
static

Definition at line 69 of file rlm_attr_filter.c.

◆ attr_stripped_user_name

fr_dict_attr_t const* attr_stripped_user_name
static

Definition at line 67 of file rlm_attr_filter.c.

◆ attr_vendor_specific

fr_dict_attr_t const* attr_vendor_specific
static

Definition at line 71 of file rlm_attr_filter.c.

◆ dict_freeradius

fr_dict_t const* dict_freeradius
static

Definition at line 57 of file rlm_attr_filter.c.

◆ dict_radius

fr_dict_t const* dict_radius
static

Definition at line 58 of file rlm_attr_filter.c.

◆ module_config

const conf_parser_t module_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("key", rlm_attr_filter_t, key), .dflt = "&Realm", .quote = T_BARE_WORD },
{ FR_CONF_OFFSET("relaxed", rlm_attr_filter_t, relaxed), .dflt = "no" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
#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_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_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:406
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:412
@ T_BARE_WORD
Definition: token.h:120

Definition at line 50 of file rlm_attr_filter.c.

◆ rlm_attr_filter

module_rlm_t rlm_attr_filter
Initial value:
= {
.common = {
.name = "attr_filter",
.inst_size = sizeof(rlm_attr_filter_t),
},
.method_names = (module_method_name_t[]){
{ .name1 = "authorize", .name2 = CF_IDENT_ANY, .method = mod_authorize },
{ .name1 = "recv", .name2 = "accounting-request", .method = mod_preacct },
{ .name1 = "recv", .name2 = CF_IDENT_ANY, .method = mod_authorize },
{ .name1 = "accounting", .name2 = CF_IDENT_ANY, .method = mod_accounting },
{ .name1 = "send", .name2 = CF_IDENT_ANY, .method = mod_post_auth },
}
}
#define CF_IDENT_ANY
Definition: cf_util.h:78
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
Specifies a module method identifier.
Definition: module_method.c:36
static const conf_parser_t config[]
Definition: base.c:188
static const conf_parser_t module_config[]
static int mod_instantiate(module_inst_ctx_t const *mctx)
static unlang_action_t mod_authorize(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_chap.c:176
static unlang_action_t mod_accounting(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Write accounting data to Couchbase documents.
static unlang_action_t mod_post_auth(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition: rlm_detail.c:400
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1312
static unlang_action_t mod_preacct(rlm_rcode_t *p_result, module_ctx_t const *mctx, UNUSED request_t *request)
Definition: rlm_test.c:248
#define MODULE_NAME_TERMINATOR
Definition: module.h:135

Definition at line 375 of file rlm_attr_filter.c.

◆ rlm_attr_filter_dict

fr_dict_autoload_t rlm_attr_filter_dict
Initial value:
= {
{ .out = &dict_freeradius, .proto = "freeradius" },
{ .out = &dict_radius, .proto = "radius" },
{ NULL }
}
static fr_dict_t const * dict_freeradius
static fr_dict_t const * dict_radius

Definition at line 61 of file rlm_attr_filter.c.

◆ rlm_attr_filter_dict_attr

fr_dict_attr_autoload_t rlm_attr_filter_dict_attr
Initial value:
= {
{ .out = &attr_stripped_user_name, .name = "Stripped-User-Name", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_fall_through, .name = "Fall-Through", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ .out = &attr_relax_filter, .name = "Relax-Filter", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ .out = &attr_vendor_specific, .name = "Vendor-Specific", .type = FR_TYPE_VSA, .dict = &dict_radius },
{ NULL }
}
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83
@ FR_TYPE_BOOL
A truth value.
Definition: merged_model.c:95
@ FR_TYPE_VSA
Vendor-Specific, for RADIUS attribute 26.
Definition: merged_model.c:121
static fr_dict_attr_t const * attr_relax_filter
static fr_dict_attr_t const * attr_stripped_user_name
static fr_dict_attr_t const * attr_fall_through
static fr_dict_attr_t const * attr_vendor_specific

Definition at line 74 of file rlm_attr_filter.c.