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->mi->name
 
#define RLM_AF_FUNC(_x, _y)
 

Functions

static unlang_action_t attr_filter_common (TALLOC_CTX *ctx, rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, 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
72413589333cbc5bcdf8576bd87256d798aee1cd

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->mi->name

Definition at line 27 of file rlm_attr_filter.c.

◆ RLM_AF_FUNC

#define RLM_AF_FUNC (   _x,
  _y 
)
Value:
static unlang_action_t mod_##_x(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) \
{ \
return attr_filter_common(request->_y##_ctx, p_result, mctx, request, &request->_y##_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(TALLOC_CTX *ctx, rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request, fr_pair_list_t *list)

Definition at line 358 of file rlm_attr_filter.c.

Function Documentation

◆ attr_filter_common()

static unlang_action_t attr_filter_common ( TALLOC_CTX *  ctx,
rlm_rcode_t p_result,
module_ctx_t const *  mctx,
request_t request,
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: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_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:405
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition: cf_parse.h:411
@ 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_group = {
.bindings = (module_method_binding_t[]){
{ .section = SECTION_NAME("accounting", CF_IDENT_ANY), .method = mod_reply },
{ .section = SECTION_NAME("authorize", CF_IDENT_ANY), .method = mod_request },
{ .section = SECTION_NAME("recv", "accounting-request"), .method = mod_request },
{ .section = SECTION_NAME("recv", CF_IDENT_ANY), .method = mod_request },
{ .section = SECTION_NAME("send", CF_IDENT_ANY), .method = mod_reply },
{ .section = SECTION_NAME("request", CF_IDENT_ANY), .method = mod_request },
{ .section = SECTION_NAME("reply", CF_IDENT_ANY), .method = mod_reply },
{ .section = SECTION_NAME("control", CF_IDENT_ANY), .method = mod_control },
{ .section = SECTION_NAME("session-state", CF_IDENT_ANY), .method = mod_session },
}
}
}
#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:63
static const conf_parser_t config[]
Definition: base.c:183
static const conf_parser_t module_config[]
static int mod_instantiate(module_inst_ctx_t const *mctx)
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1302
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition: section.h:40
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Definition: module.h:151
Named methods exported by a module.
Definition: module.h:173

Definition at line 370 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.