25 RCSID(
"$Id: 98c4a4a706a7edea01bb63cdb7105a4fbd90d5a5 $")
27 #include <freeradius-devel/radiusd.h>
28 #include <freeradius-devel/modules.h>
29 #include <freeradius-devel/rad_assert.h>
71 return tmp ? tmp->vp_integer : 0;
89 if (nas_port->vp_integer > 9999) {
90 service = nas_port->vp_integer/10000;
91 line = (nas_port->vp_integer - (10000 * service)) / 100;
92 channel = nas_port->vp_integer - ((10000 * service) + (100 * line));
93 nas_port->vp_integer = (channel - 1) + ((line - 1) * channels_per_line);
116 if (!((vendorcode == 9) || (vendorcode == 6618))) {
127 ptr = strchr(vp->vp_strvalue,
'=');
147 gettoken(&p, newattr,
sizeof(newattr),
false);
273 if (!namepair || (namepair->vp_length == 0)) {
287 if ((ptr = strchr(namepair->vp_strvalue,
'\\')) != NULL) {
288 strlcpy(newname, ptr + 1,
sizeof(newname));
303 if ((strlen(namepair->vp_strvalue) > 10) &&
304 (namepair->vp_strvalue[10] ==
'/')) {
327 if (tmp->
da->
attr != PW_PROXY_STATE) {
334 if (num_proxy_state > 10) {
335 RWDEBUG(
"There are more than 10 Proxy-State attributes in the request");
336 RWDEBUG(
"You have likely configured an infinite proxy loop");
352 if (!check)
return 0;
355 check_item && (result != 0);
359 tmp->
op = check_item->op;
360 result =
paircompare(req, request, check_item, NULL);
383 if (!hints || !request_pairs)
390 tmp->vp_strvalue : NULL;
391 if (!name || name[0] == 0) {
398 for (i = hints; i; i = i->
next) {
402 if (((strcmp(i->
name,
"DEFAULT") == 0) || (strcmp(i->
name, name) == 0)) &&
448 for (i = huntgroups; i; i = i->
next) {
507 ERROR(
"Unknown address family for packet");
606 vp =
radius_pair_create(request->packet, &request->packet->vps, PW_EVENT_TIMESTAMP, 0);
607 vp->vp_date = request->packet->timestamp.tv_sec;
629 vp =
radius_pair_create(request->packet, &request->packet->vps, PW_CHAP_CHALLENGE, 0);
635 RIDEBUG(
"No huntgroup access: [%s] (%s)",
636 request->username ? request->username->vp_strvalue :
"<NO User-Name>",
637 auth_name(buf,
sizeof(buf), request, 1));
702 vp =
radius_pair_create(request->packet, &request->packet->vps, PW_EVENT_TIMESTAMP, 0);
703 vp->vp_date = request->packet->timestamp.tv_sec;
707 if ((delay->vp_integer >= vp->vp_date) || (delay->vp_integer == UINT32_MAX)) {
708 RWARN(
"Ignoring invalid Acct-Delay-time of %u seconds", delay->vp_integer);
710 vp->vp_date -= delay->vp_integer;
717 RIDEBUG(
"No huntgroup access: [%s] (%s)",
718 request->username ? request->username->vp_strvalue :
"<NO User-Name>",
719 auth_name(buf,
sizeof(buf), request, 1));
730 .name =
"preprocess",
732 .config = module_config,
void fr_pair_list_free(VALUE_PAIR **)
Free memory used by a valuepair list.
#define PW_TYPE_FILE_INPUT
File matching value must exist, and must be readable.
void radius_pairmove(REQUEST *request, VALUE_PAIR **to, VALUE_PAIR *from, bool do_xlat) CC_HINT(nonnull)
The module is OK, continue.
static int mod_instantiate(UNUSED CONF_SECTION *conf, void *instance)
Metadata exported by the module.
fr_ipaddr_t src_ipaddr
Src IP address of packet.
static rlm_rcode_t CC_HINT(nonnull)
int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check, VALUE_PAIR **rep_list)
Compare two pair lists except for the password information.
VALUE_PAIR * radius_pair_create(TALLOC_CTX *ctx, VALUE_PAIR **vps, unsigned int attribute, unsigned int vendor)
Create a VALUE_PAIR and add it to a list of VALUE_PAIR s.
static rlm_rcode_t mod_authorize(void *instance, REQUEST *request)
Handle authorization requests using Couchbase document data.
static int hints_setup(PAIR_LIST *hints, REQUEST *request)
char * auth_name(char *buf, size_t buflen, REQUEST *request, bool do_cli)
VALUE_PAIR * vps
Result of decoding the packet into VALUE_PAIRs.
#define CONF_PARSER_TERMINATOR
#define pair_make_request(_a, _b, _c)
VALUE_PAIR * fr_cursor_init(vp_cursor_t *cursor, VALUE_PAIR *const *node)
Setup a cursor to iterate over attribute pairs.
struct rlm_preprocess_t rlm_preprocess_t
Defines a CONF_PAIR to C data type mapping.
Abstraction to allow iterating over different configurations of VALUE_PAIRs.
char const * huntgroup_file
VALUE_PAIR * fr_pair_list_copy(TALLOC_CTX *ctx, VALUE_PAIR *from)
Copy a pairlist.
static void alvarion_vsa_hack(VALUE_PAIR *vp)
void fr_pair_value_strcpy(VALUE_PAIR *vp, char const *src)
Copy data into an "string" data type.
static void rad_mangle(rlm_preprocess_t *inst, REQUEST *request)
unsigned int attr
Attribute number.
Immediately reject the request.
union fr_ipaddr_t::@1 ipaddr
bool with_specialix_jetstream_hack
unsigned int vendor
Vendor that defines this attribute.
Stores an attribute, a value and various bits of other data.
FR_TOKEN op
Operator to use when moving or inserting valuepair into a list.
enum rlm_rcodes rlm_rcode_t
Return codes indicating the result of the module call.
void fr_pair_delete_by_num(VALUE_PAIR **head, unsigned int vendor, unsigned int attr, int8_t tag)
Delete matching pairs.
Module succeeded without doing anything.
static void ascend_nasport_hack(VALUE_PAIR *nas_port, int channels_per_line)
uint64_t magic
Used to validate module struct.
Module failed, don't reply.
static void cisco_vsa_hack(REQUEST *request)
struct cl_em_hdr_t cl_em_hdr_t
#define FR_CONF_OFFSET(_n, _t, _s, _f)
FR_TOKEN gettoken(char const **ptr, char *buf, int buflen, bool unescape)
VALUE_PAIR * fr_cursor_next(vp_cursor_t *cursor)
Advanced the cursor to the next VALUE_PAIR.
RADIUS_PACKET * packet
Incoming request.
static void cablelabs_vsa_hack(VALUE_PAIR **list)
bool with_cablelabs_vsa_hack
static int fall_through(VALUE_PAIR *vp)
2 methods index for preacct section.
struct cl_timezone_t cl_timezone_t
VALUE_PAIR * fr_pair_copy(TALLOC_CTX *ctx, VALUE_PAIR const *vp)
Copy a single valuepair.
VALUE_PAIR * fr_pair_find_by_num(VALUE_PAIR *head, unsigned int vendor, unsigned int attr, int8_t tag)
Find the pair with the matching attribute.
static int add_nas_attr(REQUEST *request)
size_t strlcpy(char *dst, char const *src, size_t siz)
fr_dict_attr_t const * da
Dictionary attribute defines the attribute.
static const CONF_PARSER module_config[]
fr_dict_attr_t const * fr_dict_attr_by_num(fr_dict_t *dict, unsigned int vendor, unsigned int attr)
Lookup a fr_dict_attr_t by its vendor and attribute numbers.
String of printable characters.
1 methods index for authorize section.
bool with_alvarion_vsa_hack
uint32_t ascend_channels_per_line
int pairlist_read(TALLOC_CTX *ctx, char const *file, PAIR_LIST **list, int complain)
static int huntgroup_access(REQUEST *request, PAIR_LIST *huntgroups)
void fr_pair_value_memcpy(VALUE_PAIR *vp, uint8_t const *src, size_t len)
Copy data into an "octets" data type.
struct cl_bcid_t cl_bcid_t
static int hunt_paircmp(REQUEST *req, VALUE_PAIR *request, VALUE_PAIR *check)
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_t *dict, char const *attr)
Locate a fr_dict_attr_t by its name.