The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
base.c
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15 */
16
17/**
18 * $Id: c4f4b9cf67253f8b25c9e812507fc219844a6dfb $
19 * @file src/process/radius/base.c
20 * @brief RADIUS process module
21 *
22 * @copyright 2021 The FreeRADIUS server project.
23 * @copyright 2021 Network RADIUS SAS (legal@networkradius.com)
24 */
25#include <freeradius-devel/protocol/freeradius/freeradius.internal.h>
26
27#include <freeradius-devel/radius/radius.h>
28
29#include <freeradius-devel/server/main_config.h>
30#include <freeradius-devel/server/module.h>
31#include <freeradius-devel/server/pair.h>
32#include <freeradius-devel/server/state.h>
33
34#include <freeradius-devel/unlang/module.h>
35#include <freeradius-devel/unlang/xlat_func.h>
36
37#include <freeradius-devel/util/debug.h>
38
40static fr_dict_t const *dict_radius;
41
44 { .out = &dict_freeradius, .proto = "freeradius" },
45 { .out = &dict_radius, .proto = "radius" },
47};
48
53
63
66 { .out = &attr_auth_type, .name = "Auth-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
67 { .out = &attr_module_failure_message, .name = "Module-Failure-Message", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
68 { .out = &attr_module_success_message, .name = "Module-Success-Message", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
69 { .out = &attr_stripped_user_name, .name = "Stripped-User-Name", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
70
71 { .out = &attr_acct_status_type, .name = "Acct-Status-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius },
72 { .out = &attr_proxy_state, .name = "Proxy-State", .type = FR_TYPE_OCTETS, .dict = &dict_radius },
73 { .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius },
74 { .out = &attr_state, .name = "State", .type = FR_TYPE_OCTETS, .dict = &dict_radius },
75 { .out = &attr_user_name, .name = "User-Name", .type = FR_TYPE_STRING, .dict = &dict_radius },
76 { .out = &attr_user_password, .name = "User-Password", .type = FR_TYPE_STRING, .dict = &dict_radius },
77 { .out = &attr_eap_message, .name = "EAP-Message", .type = FR_TYPE_OCTETS, .dict = &dict_radius },
78
79 { .out = &attr_original_packet_code, .name = "Extended-Attribute-1.Original-Packet-Code", .type = FR_TYPE_UINT32, .dict = &dict_radius },
80 { .out = &attr_error_cause, .name = "Error-Cause", .type = FR_TYPE_UINT32, .dict = &dict_radius },
81
83};
84
87
90 { .out = &enum_auth_type_accept, .name = "Accept", .attr = &attr_auth_type },
91 { .out = &enum_auth_type_reject, .name = "Reject", .attr = &attr_auth_type },
93};
94
95/*
96 * RADIUS state machine configuration
97 */
126
127typedef struct {
128 fr_state_config_t session; //!< track state session information.
129 fr_state_tree_t *state_tree; //!< State tree to link multiple requests/responses.
131
132typedef struct {
133 CONF_SECTION *server_cs; //!< Our virtual server.
134 process_radius_sections_t sections; //!< Pointers to various config sections
135 ///< we need to execute.
136 process_radius_auth_t auth; //!< Authentication configuration.
138
139/** Records fields from the original request so we have a known good copy
140 */
141typedef struct {
142 fr_value_box_list_head_t proxy_state; //!< These need to be copied into the response in exactly
143 ///< the same order as they were added.
146
147#define FR_RADIUS_PROCESS_CODE_VALID(_x) (FR_RADIUS_PACKET_CODE_VALID(_x) || (_x == FR_RADIUS_CODE_DO_NOT_RESPOND))
148
149#define PROCESS_PACKET_TYPE fr_radius_packet_code_t
150#define PROCESS_CODE_MAX FR_RADIUS_CODE_MAX
151#define PROCESS_CODE_DO_NOT_RESPOND FR_RADIUS_CODE_DO_NOT_RESPOND
152#define PROCESS_PACKET_CODE_VALID FR_RADIUS_PROCESS_CODE_VALID
153#define PROCESS_INST process_radius_t
154#define PROCESS_RCTX process_radius_rctx_t
155#define PROCESS_CODE_DYNAMIC_CLIENT FR_RADIUS_CODE_ACCESS_ACCEPT
156#include <freeradius-devel/server/process.h>
157
158static const conf_parser_t auth_config[] = {
159 { FR_CONF_POINTER("session", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) state_session_config },
160
162};
163
164static const conf_parser_t config[] = {
165 { FR_CONF_POINTER("Access-Request", 0, CONF_FLAG_SUBSECTION, NULL), .subcs = (void const *) auth_config,
166 .offset = offsetof(process_radius_t, auth), },
167
169};
170
171/** Keep a copy of some attributes to keep them from being tampered with
172 *
173 */
174static inline CC_HINT(always_inline)
176{
177 fr_pair_t *proxy_state;
178
179 /*
180 * Don't bother allocing the struct if there's no proxy state to store
181 */
182 proxy_state = fr_pair_find_by_da(&request->request_pairs, NULL, attr_proxy_state);
183 if (!proxy_state) return;
184
185 fr_value_box_list_init(&rctx->proxy_state);
186
187 /*
188 * We don't use fr_pair_list_copy_by_da, to avoid doing the lookup for
189 * the first proxy-state attr again.
190 */
191 do {
192 fr_value_box_t *proxy_state_value;
193
194 MEM((proxy_state_value = fr_value_box_acopy(rctx, &proxy_state->data)));
195 fr_value_box_list_insert_tail(&rctx->proxy_state, proxy_state_value);
196 } while ((proxy_state = fr_pair_find_by_da(&request->request_pairs, proxy_state, attr_proxy_state)));
197}
198
199static inline CC_HINT(always_inline)
201{
202 /*
203 * Proxy-State is a link-level signal between RADIUS
204 * client and server. RFC 2865 Section 5.33 says that
205 * Proxy-State is an opaque field, and implementations
206 * most not examine it, interpret it, or assign it any
207 * meaning. Implementations must also copy all Proxy-State
208 * from the request to the reply.
209 *
210 * The rlm_radius module already deletes any Proxy-State
211 * from the reply before appending the proxy reply to the
212 * current reply.
213 *
214 * If any policy creates Proxy-State, that could affect
215 * individual RADIUS links (perhaps), and that would be
216 * wrong. As such, we nuke any nonsensical Proxy-State
217 * added by policies or errant modules, and instead just
218 * do exactly what the RFCs require us to do. No more.
219 */
221
222 RDEBUG3("Adding Proxy-State attributes from request");
223 RINDENT();
224 fr_value_box_list_foreach(&rctx->proxy_state, proxy_state_value) {
225 fr_pair_t *vp;
226
228 if (unlikely(fr_value_box_copy(vp, &vp->data, proxy_state_value) < 0)) {
229 RDEBUG2("Failed to copy Proxy-State value %pV", proxy_state_value);
231 break;
232 }
233 fr_pair_append(&request->reply_pairs, vp);
234 RDEBUG3("reply.%pP", vp);
235 }
236 REXDENT();
237}
238
239/** A wrapper around recv generic which stores fields from the request
240 */
241RECV(generic_radius_request)
242{
244
245 return CALL_RECV(generic);
246}
247
248/** A wrapper around send generic which restores fields
249 *
250 */
251RESUME(generic_radius_response)
252{
253 radius_request_pairs_to_reply(request, talloc_get_type_abort(mctx->rctx, process_radius_rctx_t));
254
255 return CALL_RESUME(send_generic);
256}
257
258RECV(access_request)
259{
261 fr_pair_t *state, *eap_message;
262
263 /*
264 * Enforce the requirements of RFC 5080 Section 2.1.1, which says:
265 *
266 * "An Access-Request sent as a result of a new or restarted
267 * authentication run MUST NOT include the State attribute, even if a
268 * State attribute has previously been received in an Access-Challenge
269 * for the same user and port."
270 *
271 * We therefore look for this situation, and delete the offending State.
272 */
273 state = fr_pair_find_by_da(&request->request_pairs, NULL, attr_state);
274 if (state &&
275 ((eap_message = fr_pair_find_by_da(&request->request_pairs, NULL, attr_eap_message)) != NULL)) {
276 if ((eap_message->vp_length == 0) || (eap_message->vp_length == 2) ||
277 ((eap_message->vp_length >= 5) && (eap_message->vp_octets[4] == 0x01))) {
278 RWDEBUG("Received EAP-Request/Identity with unexpected State - deleting State");
279 fr_pair_delete_by_da(&request->request_pairs, attr_state);
280 }
281 }
282
283 if (fr_state_restore(inst->auth.state_tree, request) < 0) {
284 return CALL_SEND_TYPE(FR_RADIUS_CODE_ACCESS_REJECT);
285 }
286
287 return CALL_RECV(generic_radius_request);
288}
289
290RESUME(auth_type);
291
292RESUME(access_request)
293{
294 rlm_rcode_t rcode = RESULT_RCODE;
295 fr_pair_t *vp;
296 CONF_SECTION *cs;
297 fr_dict_enum_value_t const *dv;
298 fr_process_state_t const *state;
300
302
304
305 /*
306 * See if the return code from "recv Access-Request" says we reject, or continue.
307 */
308 UPDATE_STATE(packet);
309
310 /*
311 * A policy or a module can hard-code the reply, in which case we can process that immediately,
312 * and bypass the "authenticate" section.
313 */
314 vp = fr_pair_find_by_da(&request->reply_pairs, NULL, attr_packet_type);
315 if (vp && FR_RADIUS_PROCESS_CODE_VALID(vp->vp_uint32)) {
316 request->reply->code = vp->vp_uint32;
317 (void) fr_pair_delete(&request->reply_pairs, vp);
318 } else {
319 /*
320 * Get the default reply packet based on the rcode.
321 */
322 request->reply->code = state->packet_type[rcode];
323 if (!request->reply->code) request->reply->code = state->default_reply;
324 }
325
326 /*
327 * Either the code above or a module set reject, we're done.
328 */
329 if (request->reply->code == FR_RADIUS_CODE_ACCESS_REJECT) {
330 RDEBUG("The 'recv Access-Request' section returned %s - rejecting the request",
331 fr_table_str_by_value(rcode_table, rcode, "<INVALID>"));
332
334 UPDATE_STATE(reply);
335
336 fr_assert(state->send != NULL);
337 return CALL_SEND_STATE(state);
338 }
339
340 /*
341 * Something set a reply, bypass the "authenticate" section.
342 */
343 if (request->reply->code) {
344 goto send_reply;
345 }
346
347 /*
348 * Run authenticate foo { ... }
349 *
350 * If we can't find Auth-Type, OR if we can't find
351 * Auth-Type = foo, then it's a reject.
352 */
353 vp = fr_pair_find_by_da(&request->control_pairs, NULL, attr_auth_type);
354 if (!vp) {
355 RDEBUG("No 'Auth-Type' attribute found, cannot authenticate the user - rejecting the request");
356
357 reject:
359 goto send_reply;
360 }
361
362 dv = fr_dict_enum_by_value(vp->da, &vp->data);
363 if (!dv) {
364 RDEBUG("Invalid value for 'Auth-Type' attribute, cannot authenticate the user - rejecting the request");
365 goto reject;
366 }
367
368 /*
369 * The magic Auth-Type Accept value which means skip the authenticate section.
370 *
371 * And Reject means always reject. Tho the admin should instead just return "reject" from the
372 * section.
373 */
376 goto send_reply;
377
378 } else if (fr_value_box_cmp(enum_auth_type_reject, dv->value) == 0) {
379 goto reject;
380 }
381
382 cs = cf_section_find(inst->server_cs, "authenticate", dv->name);
383 if (!cs) {
384 RDEBUG2("No 'authenticate %s { ... }' section found - rejecting the request", dv->name);
385 goto reject;
386 }
387
388 /*
389 * Run the "Authenticate = foo" section.
390 *
391 * And continue with sending the generic reply.
392 */
394 cs, RLM_MODULE_NOOP, resume_auth_type,
395 NULL, FR_SIGNAL_NONE, mctx->rctx);
396}
397
398RESUME(auth_type)
399{
400 static const fr_process_rcode_t auth_type_rcode = {
411 };
412
413 rlm_rcode_t rcode = RESULT_RCODE;
414 fr_pair_t *vp;
415 fr_process_state_t const *state;
416
418
420
421 /*
422 * Allow user to specify response packet type here, too.
423 */
424 if (!auth_type_rcode[rcode]) {
425 vp = fr_pair_find_by_da(&request->reply_pairs, NULL, attr_packet_type);
426 if (vp && FR_RADIUS_PROCESS_CODE_VALID(vp->vp_uint32)) {
427 request->reply->code = vp->vp_uint32;
428 (void) fr_pair_delete(&request->reply_pairs, vp);
429 }
430 } else {
431 request->reply->code = auth_type_rcode[rcode];
432 }
433
434 switch (request->reply->code) {
435 case 0:
436 RDEBUG("No reply code was set. Forcing to Access-Reject");
439
440 /*
441 * Print complaints before running "send Access-Reject"
442 */
444 RDEBUG2("Failed to authenticate the user");
445
446 /*
447 * Maybe the shared secret is wrong?
448 */
449 vp = fr_pair_find_by_da(&request->request_pairs, NULL, attr_user_password);
450 if (vp) {
451 if (RDEBUG_ENABLED2) {
452 uint8_t const *p;
453
454 p = (uint8_t const *) vp->vp_strvalue;
455 while (*p) {
456 size_t size;
457
458 size = fr_utf8_char(p, -1);
459 if (!size) {
460 RWDEBUG("Unprintable characters in the password. "
461 "Double-check the shared secret on the server "
462 "and the NAS!");
463 RWDEBUG("For more information, please see " DOC_ROOT_URL "/troubleshooting/network/shared_secret.html");
464 break;
465 }
466 p += size;
467 }
468 }
469 }
470 break;
471
472 /*
473 * Access-Challenge sections require a State. If there is
474 * none, create one here. This is so that the State
475 * attribute is accessible in the "send Access-Challenge"
476 * section.
477 */
479 if ((vp = fr_pair_find_by_da(&request->reply_pairs, NULL, attr_state)) == NULL) {
480 uint8_t buffer[16];
481
482 fr_rand_buffer(buffer, sizeof(buffer));
483
485 fr_pair_value_memdup(vp, buffer, sizeof(buffer), false);
486 }
487 break;
488
489 default:
490 break;
491 }
492 UPDATE_STATE(reply);
493
494 fr_assert(state->send != NULL);
495 return state->send(p_result, mctx, request);
496}
497
498RESUME_FLAG(access_accept,UNUSED,)
499{
500 fr_pair_t *vp;
502
504
505 /*
506 * Check that there is a name which can be used to
507 * identify the user. The configuration depends on
508 * User-Name or Stripped-User-Name existing, and being
509 * (mostly) unique to that user.
510 */
511 if (!request->parent &&
512 ((vp = fr_pair_find_by_da(&request->request_pairs, NULL, attr_user_name)) != NULL) &&
513 (vp->vp_strvalue[0] == '@') &&
514 !fr_pair_find_by_da(&request->request_pairs, NULL, attr_stripped_user_name)) {
515 RWDEBUG("User-Name is anonymized, and no Stripped-User-Name exists.");
516 RWDEBUG("It may be difficult or impossible to identify the user.");
517 RWDEBUG("Please update Stripped-User-Name with information which identifies the user.");
518 }
519
520 fr_state_discard(inst->auth.state_tree, request);
523}
524
525RESUME_FLAG(access_reject,UNUSED,)
526{
528
530
531 fr_state_discard(inst->auth.state_tree, request);
534}
535
536RESUME(access_challenge)
537{
539
541
542 /*
543 * Cache the state context, unless this is a subrequest.
544 * Subrequest state context will be handled by the caller.
545 *
546 * If this fails, don't respond to the request.
547 */
548 if (!request->parent && fr_state_store(inst->auth.state_tree, request) < 0) {
549 return CALL_SEND_TYPE(FR_RADIUS_CODE_DO_NOT_RESPOND);
550 }
551
555}
556
557/** A wrapper around recv generic which stores fields from the request
558 */
559RECV(accounting_request)
560{
562
563 return CALL_RECV(generic);
564}
565
566RESUME(acct_type)
567{
568 static const fr_process_rcode_t acct_type_rcode = {
575 };
576
577 rlm_rcode_t rcode = RESULT_RCODE;
578 fr_process_state_t const *state;
579
581
584
585 if (acct_type_rcode[rcode]) {
586 fr_assert(acct_type_rcode[rcode] == FR_RADIUS_CODE_DO_NOT_RESPOND);
587
588 request->reply->code = acct_type_rcode[rcode];
589 UPDATE_STATE(reply);
590
591 RDEBUG("The 'accounting' section returned %s - not sending a response",
592 fr_table_str_by_value(rcode_table, rcode, "<INVALID>"));
593
594 fr_assert(state->send != NULL);
595 return state->send(p_result, mctx, request);
596 }
597
599 UPDATE_STATE(reply);
600
601 fr_assert(state->send != NULL);
602 return state->send(p_result, mctx, request);
603}
604
605RESUME(accounting_request)
606{
607 rlm_rcode_t rcode = RESULT_RCODE;
608 fr_pair_t *vp;
609 CONF_SECTION *cs;
610 fr_dict_enum_value_t const *dv;
611 fr_process_state_t const *state;
613
615
617
618 UPDATE_STATE(packet);
619 fr_assert(state->packet_type[rcode] != 0);
620
621 request->reply->code = state->packet_type[rcode];
622 UPDATE_STATE_CS(reply);
623
624 if (request->reply->code == FR_RADIUS_CODE_DO_NOT_RESPOND) {
625 RDEBUG("The 'recv Accounting-Request' section returned %s - not sending a response",
626 fr_table_str_by_value(rcode_table, rcode, "<INVALID>"));
627
629 fr_assert(state->send != NULL);
630 return CALL_SEND_STATE(state);
631 }
632
633 /*
634 * Run accounting foo { ... }
635 */
636 vp = fr_pair_find_by_da(&request->request_pairs, NULL, attr_acct_status_type);
637 if (!vp) goto send_reply;
638
639 dv = fr_dict_enum_by_value(vp->da, &vp->data);
640 if (!dv) goto send_reply;
641
642 cs = cf_section_find(inst->server_cs, "accounting", dv->name);
643 if (!cs) {
644 RDEBUG2("No 'accounting %s { ... }' section found - skipping...", dv->name);
645 goto send_reply;
646 }
647
648 /*
649 * Run the "Acct-Status-Type = foo" section.
650 *
651 * And continue with sending the generic reply.
652 */
654 cs, RLM_MODULE_NOOP, resume_acct_type,
655 NULL, FR_SIGNAL_NONE, mctx->rctx);
656}
657
658#if 0
659// @todo - send canned responses like in v3?
660RECV(status_server)
661{
663}
664
665RESUME(status_server)
666{
668}
669#endif
670
671RESUME(protocol_error)
672{
673 fr_pair_t *vp;
675
677
679
680 /*
681 * https://tools.ietf.org/html/rfc7930#section-4
682 */
683 /*
684 * Original-Packet-Code is a child of Extended-Attribute-1, so it has to be created below its
685 * parent, and not appended to the top-level list.
686 */
687 if (pair_update_reply(&vp, attr_original_packet_code) == 0) vp->vp_uint32 = request->packet->code;
688
689 /*
690 * If there's no Error-Cause, then include a generic 404.
691 */
692 vp = fr_pair_find_by_da(&request->reply_pairs, NULL, attr_error_cause);
693 if (!vp) {
695 if (vp) {
696 vp->vp_uint32 = FR_ERROR_CAUSE_VALUE_INVALID_REQUEST;
697 fr_pair_append(&request->reply_pairs, vp);
698 }
699 }
700
701 /*
702 * Discard any session state associated with the request.
703 */
704 if (request->packet->code == FR_RADIUS_CODE_ACCESS_REQUEST) {
705 fr_state_discard(inst->auth.state_tree, request);
706 }
707
708 /*
709 * Add Proxy-State back.
710 */
711 radius_request_pairs_to_reply(request, talloc_get_type_abort(mctx->rctx, process_radius_rctx_t));
712
713 /*
714 * And do the generic processing after running a "send" section.
715 */
716 return CALL_RESUME(send_generic);
717}
718
720{
721 fr_process_state_t const *state;
722
724
726
727 request->component = "radius";
728 request->module = NULL;
729 fr_assert(request->proto_dict == dict_radius);
730
732
733 UPDATE_STATE(packet);
734
735 if (!state->recv) {
736 REDEBUG("Invalid packet type (%u)", request->packet->code);
738 }
739
741 return new_client(p_result, mctx, request);
742 }
743
744 return state->recv(p_result, mctx, request);
745}
746
748 { .required = true, .single = true, .type = FR_TYPE_OCTETS },
750};
751
752/** Validates a request against a known shared secret
753 *
754 * Designed for the specific purpose of verifying dynamic clients
755 * against a known shared secret in a `new client` section.
756 *
757 * Example:
758@verbatim
759%radius.secret.verify(<secret>)
760@endverbatim
761 *
762 * @ingroup xlat_functions
763 */
765 request_t *request, fr_value_box_list_t *args)
766{
768 int ret;
769 bool require_message_authenticator = false;
770
772
773 if (request->proto_dict != dict_radius) return XLAT_ACTION_FAIL;
774
775 MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_BOOL, NULL));
776
777 /*
778 * Only Access-Requests require a Message-Authenticator.
779 * All the other packet types are signed using the
780 * authenticator field.
781 */
782 if (request->packet->code == FR_RADIUS_CODE_ACCESS_REQUEST) require_message_authenticator = true;
783
784 ret = fr_radius_verify(request->packet->data, NULL, secret->vb_octets, secret->vb_length, require_message_authenticator, false);
785 switch (ret) {
786 case 0:
787 vb->vb_bool = true;
788 break;
789
790 default:
791 RPEDEBUG("Invalid packet");
792 return XLAT_ACTION_FAIL;
793
796 RPEDEBUG("Failed to verify the packet signature");
797 vb->vb_bool = false;
798 break;
799 }
801
802 return XLAT_ACTION_DONE;
803}
804
805static int mod_instantiate(module_inst_ctx_t const *mctx)
806{
807 process_radius_t *inst = talloc_get_type_abort(mctx->mi->data, process_radius_t);
808
809 inst->server_cs = cf_item_to_section(cf_parent(mctx->mi->conf));
810
811 FR_INTEGER_BOUND_CHECK("session.max_rounds", inst->auth.session.max_rounds, >=, 32);
812 FR_INTEGER_BOUND_CHECK("session.max_rounds", inst->auth.session.max_rounds, <=, 100);
813
814 inst->auth.session.thread_safe = main_config->spawn_workers;
815 inst->auth.session.context_id = fr_hash_string(cf_section_name2(inst->server_cs));
816
817 MEM(inst->auth.state_tree = fr_state_tree_init(inst, attr_state, &inst->auth.session));
818
819 return 0;
820}
821
822static int mod_bootstrap(module_inst_ctx_t const *mctx)
823{
824 CONF_SECTION *server_cs = cf_item_to_section(cf_parent(mctx->mi->conf));
825
826 if (virtual_server_section_attribute_define(server_cs, "authenticate", attr_auth_type) < 0) return -1;
827
828 return 0;
829}
830
831static int mod_load(void)
832{
833 xlat_t *xlat;
834
835 if (unlikely(!(xlat = xlat_func_register(NULL, "radius.secret.verify", xlat_func_radius_secret_verify,
836 FR_TYPE_BOOL)))) return -1;
837
839
840 return 0;
841}
842
843static void mod_unload(void)
844{
845 xlat_func_unregister("radius.secret.verify");
846}
847
848/*
849 * rcodes not listed under a packet_type
850 * mean that the packet code will not be
851 * changed.
852 */
853static fr_process_state_t const process_state[] = {
855 .packet_type = {
862 },
863 .default_rcode = RLM_MODULE_NOOP,
864 .recv = recv_access_request,
865 .resume = resume_access_request,
866 .section_offset = offsetof(process_radius_sections_t, access_request),
867 },
869 .packet_type = {
875 },
876 .default_rcode = RLM_MODULE_NOOP,
877 .result_rcode = RLM_MODULE_OK,
878 .send = send_generic,
879 .resume = resume_access_accept,
880 .section_offset = offsetof(process_radius_sections_t, access_accept),
881 },
883 .packet_type = {
889 },
890 .default_rcode = RLM_MODULE_NOOP,
891 .result_rcode = RLM_MODULE_REJECT,
892 .send = send_generic,
893 .resume = resume_access_reject,
894 .section_offset = offsetof(process_radius_sections_t, access_reject),
895 },
897 .packet_type = {
903 },
904 .default_rcode = RLM_MODULE_NOOP,
905 .result_rcode = RLM_MODULE_OK,
906 .send = send_generic,
907 .resume = resume_access_challenge,
908 .section_offset = offsetof(process_radius_sections_t, access_challenge),
909 },
910
912 .packet_type = {
917
924 },
925 .default_rcode = RLM_MODULE_NOOP,
926 .recv = recv_accounting_request,
927 .resume = resume_accounting_request,
928 .section_offset = offsetof(process_radius_sections_t, accounting_request),
929 },
931 .packet_type = {
938 },
939 .default_rcode = RLM_MODULE_NOOP,
940 .result_rcode = RLM_MODULE_OK,
941 .send = send_generic,
942 .resume = resume_generic_radius_response,
943 .section_offset = offsetof(process_radius_sections_t, accounting_response),
944 },
945 [ FR_RADIUS_CODE_STATUS_SERVER ] = { /* @todo - negotiation, stats, etc. */
946 .packet_type = {
949
957 },
958 .default_rcode = RLM_MODULE_NOOP,
959 .recv = recv_generic,
960 .resume = resume_recv_generic,
961 .section_offset = offsetof(process_radius_sections_t, status_server),
962 },
964 .packet_type = {
969
975 },
976 .default_rcode = RLM_MODULE_NOOP,
977 .recv = recv_generic_radius_request,
978 .resume = resume_recv_generic,
979 .section_offset = offsetof(process_radius_sections_t, coa_request),
980 },
982 .packet_type = {
988 },
989 .default_rcode = RLM_MODULE_NOOP,
990 .result_rcode = RLM_MODULE_OK,
991 .send = send_generic,
992 .resume = resume_generic_radius_response,
993 .section_offset = offsetof(process_radius_sections_t, coa_ack),
994 },
996 .packet_type = {
1002 },
1003 .default_rcode = RLM_MODULE_NOOP,
1004 .result_rcode = RLM_MODULE_NOTFOUND,
1005 .send = send_generic,
1006 .resume = resume_generic_radius_response,
1007 .section_offset = offsetof(process_radius_sections_t, coa_nak),
1008 },
1010 .packet_type = {
1015
1021 },
1022 .default_rcode = RLM_MODULE_NOOP,
1023 .recv = recv_generic_radius_request,
1024 .resume = resume_recv_generic,
1025 .section_offset = offsetof(process_radius_sections_t, disconnect_request),
1026 },
1028 .packet_type = {
1034 },
1035 .default_rcode = RLM_MODULE_NOOP,
1036 .result_rcode = RLM_MODULE_OK,
1037 .send = send_generic,
1038 .resume = resume_generic_radius_response,
1039 .section_offset = offsetof(process_radius_sections_t, disconnect_ack),
1040 },
1042 .packet_type = {
1048 },
1049 .default_rcode = RLM_MODULE_NOOP,
1050 .result_rcode = RLM_MODULE_NOTFOUND,
1051 .send = send_generic,
1052 .resume = resume_generic_radius_response,
1053 .section_offset = offsetof(process_radius_sections_t, disconnect_nak),
1054 },
1055 [ FR_RADIUS_CODE_PROTOCOL_ERROR ] = { /* @todo - fill out required fields */
1056 .packet_type = {
1062 },
1063 .default_rcode = RLM_MODULE_NOOP,
1064 .result_rcode = RLM_MODULE_OK,
1065 .send = send_generic,
1066 .resume = resume_protocol_error,
1067 .section_offset = offsetof(process_radius_sections_t, protocol_error),
1068 },
1070 .packet_type = {
1075
1082 },
1083 .default_rcode = RLM_MODULE_NOOP,
1084 .result_rcode = RLM_MODULE_HANDLED,
1085 .send = send_generic,
1086 .resume = resume_send_generic,
1087 .section_offset = offsetof(process_radius_sections_t, do_not_respond),
1088 }
1089};
1090
1092 {
1093 .section = SECTION_NAME("recv", "Access-Request"),
1094 .actions = &mod_actions_authorize,
1095 .offset = PROCESS_CONF_OFFSET(access_request),
1096 },
1097 {
1098 .section = SECTION_NAME("send", "Access-Accept"),
1100 .offset = PROCESS_CONF_OFFSET(access_accept),
1101 },
1102 {
1103 .section = SECTION_NAME("send", "Access-Challenge"),
1105 .offset = PROCESS_CONF_OFFSET(access_challenge),
1106 },
1107 {
1108 .section = SECTION_NAME("send", "Access-Reject"),
1110 .offset = PROCESS_CONF_OFFSET(access_reject),
1111 },
1112
1113 {
1114 .section = SECTION_NAME("recv", "Accounting-Request"),
1116 .offset = PROCESS_CONF_OFFSET(accounting_request),
1117 },
1118 {
1119 .section = SECTION_NAME("send", "Accounting-Response"),
1121 .offset = PROCESS_CONF_OFFSET(accounting_response),
1122 },
1123
1124 {
1125 .section = SECTION_NAME("recv", "Status-Server"),
1127 .offset = PROCESS_CONF_OFFSET(status_server),
1128 },
1129 {
1130 .section = SECTION_NAME("recv", "CoA-Request"),
1132 .offset = PROCESS_CONF_OFFSET(coa_request),
1133 },
1134 {
1135 .section = SECTION_NAME("send", "CoA-ACK"),
1137 .offset = PROCESS_CONF_OFFSET(coa_ack),
1138 },
1139 {
1140 .section = SECTION_NAME("send", "CoA-NAK"),
1142 .offset = PROCESS_CONF_OFFSET(coa_nak),
1143 },
1144 {
1145 .section = SECTION_NAME("recv", "Disconnect-Request"),
1147 .offset = PROCESS_CONF_OFFSET(disconnect_request),
1148 },
1149 {
1150 .section = SECTION_NAME("send", "Disconnect-ACK"),
1152 .offset = PROCESS_CONF_OFFSET(disconnect_ack),
1153 },
1154 {
1155 .section = SECTION_NAME("send", "Disconnect-NAK"),
1157 .offset = PROCESS_CONF_OFFSET(disconnect_nak),
1158 },
1159 {
1160 .section = SECTION_NAME("send", "Protocol-Error"),
1162 .offset = PROCESS_CONF_OFFSET(protocol_error),
1163 },
1164 {
1165 .section = SECTION_NAME("send", "Do-Not-Respond"),
1167 .offset = PROCESS_CONF_OFFSET(do_not_respond),
1168 },
1169 {
1170 .section = SECTION_NAME("authenticate", CF_IDENT_ANY),
1172 },
1173 {
1174 .section = SECTION_NAME("accounting", CF_IDENT_ANY),
1176 },
1177
1178 DYNAMIC_CLIENT_SECTIONS,
1179
1181};
1182
1185 .common = {
1186 .magic = MODULE_MAGIC_INIT,
1187 .name = "radius",
1188 .config = config,
1191
1192 .onload = mod_load,
1193 .unload = mod_unload,
1194 .bootstrap = mod_bootstrap,
1195 .instantiate = mod_instantiate
1196 },
1197 .process = mod_process,
1198 .compile_list = compile_list,
1199 .dict = &dict_radius,
1200 .packet_type = &attr_packet_type
1201};
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition action.h:35
@ UNLANG_ACTION_CALCULATE_RESULT
Calculate a new section rlm_rcode_t value.
Definition action.h:38
static int const char char buffer[256]
Definition acutest.h:641
va_list args
Definition acutest.h:923
static uint8_t request[4]
static uint8_t reply[4]
#define FALL_THROUGH
clang 10 doesn't recognised the FALL-THROUGH comment anymore
Definition build.h:422
#define unlikely(_x)
Definition build.h:492
#define UNUSED
Definition build.h:415
#define CONF_PARSER_TERMINATOR
Definition cf_parse.h:722
#define FR_INTEGER_BOUND_CHECK(_name, _var, _op, _bound)
Definition cf_parse.h:572
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition cf_parse.h:460
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
Definition cf_parse.h:350
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:649
A section grouping multiple CONF_PAIR.
Definition cf_priv.h:106
char const * cf_section_name2(CONF_SECTION const *cs)
Return the second identifier of a CONF_SECTION.
Definition cf_util.c:1405
CONF_SECTION * cf_section_find(CONF_SECTION const *cs, char const *name1, char const *name2)
Find a CONF_SECTION with name1 and optionally name2.
Definition cf_util.c:1247
CONF_SECTION * cf_item_to_section(CONF_ITEM const *ci)
Cast a CONF_ITEM to a CONF_SECTION.
Definition cf_util.c:671
#define cf_parent(_cf)
Definition cf_util.h:115
#define CF_IDENT_ANY
Definition cf_util.h:80
static int fr_dcursor_append(fr_dcursor_t *cursor, void *v)
Insert a single item at the end of the list.
Definition dcursor.h:406
#define MEM(x)
Definition debug.h:38
@ FR_RADIUS_CODE_ACCESS_CHALLENGE
RFC2865 - Access-Challenge.
Definition defs.h:43
@ FR_RADIUS_CODE_ACCESS_REQUEST
RFC2865 - Access-Request.
Definition defs.h:33
@ FR_RADIUS_CODE_DISCONNECT_REQUEST
RFC3575/RFC5176 - Disconnect-Request.
Definition defs.h:46
@ FR_RADIUS_CODE_DO_NOT_RESPOND
Special rcode to indicate we will not respond.
Definition defs.h:54
@ FR_RADIUS_CODE_DISCONNECT_ACK
RFC3575/RFC5176 - Disconnect-Ack (positive)
Definition defs.h:47
@ FR_RADIUS_CODE_STATUS_SERVER
RFC2865/RFC5997 - Status Server (request)
Definition defs.h:44
@ FR_RADIUS_CODE_COA_REQUEST
RFC3575/RFC5176 - CoA-Request.
Definition defs.h:49
@ FR_RADIUS_CODE_ACCESS_ACCEPT
RFC2865 - Access-Accept.
Definition defs.h:34
@ FR_RADIUS_CODE_ACCOUNTING_RESPONSE
RFC2866 - Accounting-Response.
Definition defs.h:37
@ FR_RADIUS_CODE_COA_NAK
RFC3575/RFC5176 - CoA-Nak (not willing to perform)
Definition defs.h:51
@ FR_RADIUS_CODE_UNDEFINED
Packet code has not been set.
Definition defs.h:32
@ FR_RADIUS_CODE_COA_ACK
RFC3575/RFC5176 - CoA-Ack (positive)
Definition defs.h:50
@ FR_RADIUS_CODE_DISCONNECT_NAK
RFC3575/RFC5176 - Disconnect-Nak (not willing to perform)
Definition defs.h:48
@ FR_RADIUS_CODE_PROTOCOL_ERROR
RFC7930 - Protocol-Error (generic NAK)
Definition defs.h:52
@ FR_RADIUS_CODE_ACCOUNTING_REQUEST
RFC2866 - Accounting-Request.
Definition defs.h:36
@ FR_RADIUS_CODE_ACCESS_REJECT
RFC2865 - Access-Reject.
Definition defs.h:35
fr_value_box_t const ** out
Enumeration value.
Definition dict.h:305
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
Definition dict.h:316
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
Definition dict.h:329
fr_value_box_t const * value
Enum value (what name maps to).
Definition dict.h:281
fr_dict_enum_value_t const * fr_dict_enum_by_value(fr_dict_attr_t const *da, fr_value_box_t const *value)
Lookup the structure representing an enum value in a fr_dict_attr_t.
Definition dict_util.c:3737
#define DICT_AUTOLOAD_TERMINATOR
Definition dict.h:335
char const * name
Enum name.
Definition dict.h:278
Specifies an attribute which must be present for the module to function.
Definition dict.h:315
Specifies a dictionary which must be loaded/loadable for the module to function.
Definition dict.h:328
Specifies a value which must be present for the module to function.
Definition dict.h:304
Value of an enumerated attribute.
Definition dict.h:277
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition dl_module.h:63
static xlat_action_t xlat_func_radius_secret_verify(TALLOC_CTX *ctx, fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args)
Validates a request against a known shared secret.
Definition base.c:764
uint32_t fr_hash_string(char const *p)
Definition hash.c:919
talloc_free(hp)
static fr_dict_t const * dict_freeradius
Definition base.c:37
fr_dict_attr_t const * attr_packet_type
Definition base.c:91
fr_dict_attr_t const * attr_eap_message
Definition base.c:94
fr_dict_t const * dict_radius
Definition base.c:76
fr_dict_attr_t const * attr_user_name
Definition base.c:101
static fr_dict_attr_t const * attr_module_failure_message
Definition log.c:206
#define REXDENT()
Exdent (unindent) R* messages by one level.
Definition log.h:460
#define RWDEBUG(fmt,...)
Definition log.h:378
#define RDEBUG3(fmt,...)
Definition log.h:360
#define RPEDEBUG(fmt,...)
Definition log.h:393
#define RINDENT()
Indent R* messages by one level.
Definition log.h:447
main_config_t const * main_config
Main server configuration.
Definition main_config.c:56
bool spawn_workers
Should the server spawn threads.
Definition main_config.h:66
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_BOOL
A truth value.
@ FR_TYPE_OCTETS
Raw octets.
unsigned char uint8_t
unlang_mod_actions_t const mod_actions_preacct
Definition mod_action.c:61
unlang_mod_actions_t const mod_actions_authenticate
Definition mod_action.c:29
unlang_mod_actions_t const mod_actions_accounting
Definition mod_action.c:77
unlang_mod_actions_t const mod_actions_authorize
Definition mod_action.c:45
unlang_mod_actions_t const mod_actions_postauth
Definition mod_action.c:92
unlang_mod_action_t actions[RLM_MODULE_NUMCODES]
Definition mod_action.h:69
module_instance_t const * mi
Instance of the module being instantiated.
Definition module_ctx.h:42
module_instance_t * mi
Instance of the module being instantiated.
Definition module_ctx.h:51
Temporary structure to hold arguments for module calls.
Definition module_ctx.h:41
Temporary structure to hold arguments for instantiation calls.
Definition module_ctx.h:50
int fr_pair_value_memdup(fr_pair_t *vp, uint8_t const *src, size_t len, bool tainted)
Copy data into an "octets" data type.
Definition pair.c:2906
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
Definition pair.c:716
int fr_pair_append(fr_pair_list_t *list, fr_pair_t *to_add)
Add a VP to the end of the list.
Definition pair.c:1306
int fr_pair_delete_by_da(fr_pair_list_t *list, fr_dict_attr_t const *da)
Delete matching pairs from the specified list.
Definition pair.c:1650
fr_pair_t * fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da)
Dynamically allocate a new attribute and assign a fr_dict_attr_t.
Definition pair.c:284
int fr_pair_delete(fr_pair_list_t *list, fr_pair_t *vp)
Remove fr_pair_t from a list and free.
Definition pair.c:1787
size_t fr_utf8_char(uint8_t const *str, ssize_t inlen)
Checks for utf-8, taken from http://www.w3.org/International/questions/qa-forms-utf-8.
Definition print.c:39
static unlang_action_t mod_process(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
Definition base.c:170
static const virtual_server_compile_t compile_list[]
Definition base.c:194
static fr_process_state_t const process_state[]
Definition base.c:70
static fr_dict_attr_t const * attr_module_success_message
Definition base.c:36
RECV(for_any_server)
Validate a solicit/rebind/confirm message.
Definition base.c:348
static int mod_load(void)
Definition base.c:228
static void mod_unload(void)
Definition base.c:237
static int mod_instantiate(module_inst_ctx_t const *mctx)
Definition base.c:213
process_radius_auth_t auth
Authentication configuration.
Definition base.c:136
CONF_SECTION * access_challenge
Definition base.c:104
static fr_dict_attr_t const * attr_user_password
Definition base.c:59
CONF_SECTION * coa_nak
Definition base.c:113
static fr_dict_attr_t const * attr_state
Definition base.c:57
static xlat_arg_parser_t const xlat_func_radius_secret_verify_args[]
Definition base.c:747
CONF_SECTION * disconnect_ack
Definition base.c:116
CONF_SECTION * protocol_error
Definition base.c:120
CONF_SECTION * new_client
Definition base.c:122
static fr_dict_attr_t const * attr_stripped_user_name
Definition base.c:52
fr_dict_attr_autoload_t process_radius_dict_attr[]
Definition base.c:65
CONF_SECTION * coa_request
Definition base.c:111
RESUME_FLAG(access_accept, UNUSED,)
Definition base.c:498
fr_value_box_list_head_t proxy_state
These need to be copied into the response in exactly the same order as they were added.
Definition base.c:142
fr_dict_enum_autoload_t process_radius_dict_enum[]
Definition base.c:89
static int mod_bootstrap(module_inst_ctx_t const *mctx)
Definition base.c:822
fr_process_module_t process_radius
Definition base.c:1184
static fr_dict_attr_t const * attr_auth_type
Definition base.c:49
static void radius_request_pairs_to_reply(request_t *request, process_radius_rctx_t *rctx)
Definition base.c:200
#define FR_RADIUS_PROCESS_CODE_VALID(_x)
Definition base.c:147
CONF_SECTION * disconnect_nak
Definition base.c:117
CONF_SECTION * access_accept
Definition base.c:102
static fr_value_box_t const * enum_auth_type_reject
Definition base.c:86
static void radius_request_pairs_store(request_t *request, process_radius_rctx_t *rctx)
Keep a copy of some attributes to keep them from being tampered with.
Definition base.c:175
static fr_dict_attr_t const * attr_error_cause
Definition base.c:62
CONF_SECTION * add_client
Definition base.c:123
static const conf_parser_t auth_config[]
Definition base.c:158
CONF_SECTION * server_cs
Our virtual server.
Definition base.c:133
CONF_SECTION * access_request
Definition base.c:101
static fr_dict_attr_t const * attr_proxy_state
Definition base.c:56
static fr_value_box_t const * enum_auth_type_accept
Definition base.c:85
CONF_SECTION * status_server
Definition base.c:109
CONF_SECTION * access_reject
Definition base.c:103
static fr_dict_attr_t const * attr_acct_status_type
Definition base.c:54
CONF_SECTION * disconnect_request
Definition base.c:115
CONF_SECTION * accounting_request
Definition base.c:106
CONF_SECTION * coa_ack
Definition base.c:112
CONF_SECTION * do_not_respond
Definition base.c:119
fr_state_config_t session
track state session information.
Definition base.c:128
process_radius_sections_t sections
Pointers to various config sections we need to execute.
Definition base.c:134
static fr_dict_attr_t const * attr_original_packet_code
Definition base.c:61
unlang_result_t result
Definition base.c:144
static const conf_parser_t config[]
Definition base.c:164
fr_dict_autoload_t process_radius_dict[]
Definition base.c:43
fr_state_tree_t * state_tree
State tree to link multiple requests/responses.
Definition base.c:129
CONF_SECTION * accounting_response
Definition base.c:107
CONF_SECTION * deny_client
Definition base.c:124
Records fields from the original request so we have a known good copy.
Definition base.c:141
#define PROCESS_TRACE
Trace each state function as it's entered.
Definition process.h:55
#define PROCESS_CONF_OFFSET(_x)
Definition process.h:79
module_t common
Common fields for all loadable modules.
Common public symbol definition for all process modules.
int fr_radius_verify(uint8_t *packet, uint8_t const *vector, uint8_t const *secret, size_t secret_len, bool require_message_authenticator, bool limit_proxy_state)
Verify the signature of a request / response packet.
Definition base.c:853
#define fr_assert(_expr)
Definition rad_assert.h:37
static char * secret
Definition radclient.c:68
#define REDEBUG(fmt,...)
Definition radclient.h:52
#define RDEBUG_ENABLED2()
Definition radclient.h:50
#define RDEBUG2(fmt,...)
Definition radclient.h:54
#define RDEBUG(fmt,...)
Definition radclient.h:53
static void send_reply(int sockfd, fr_channel_data_t *reply)
@ FR_RADIUS_FAIL_VERIFY
Definition radius.h:113
@ FR_RADIUS_FAIL_MA_INVALID
Definition radius.h:109
#define FR_RADIUS_PACKET_CODE_VALID(_x)
Definition radius.h:51
void fr_rand_buffer(void *start, size_t length)
Definition rand.c:148
fr_table_num_sorted_t const rcode_table[]
Definition rcode.c:35
rlm_rcode_t
Return codes indicating the result of the module call.
Definition rcode.h:44
@ RLM_MODULE_INVALID
The module considers the request invalid.
Definition rcode.h:51
@ RLM_MODULE_OK
The module is OK, continue.
Definition rcode.h:49
@ RLM_MODULE_FAIL
Module failed, don't reply.
Definition rcode.h:48
@ RLM_MODULE_DISALLOW
Reject the request (user is locked out).
Definition rcode.h:52
@ RLM_MODULE_REJECT
Immediately reject the request.
Definition rcode.h:47
@ RLM_MODULE_TIMEOUT
Module (or section) timed out.
Definition rcode.h:56
@ RLM_MODULE_NOTFOUND
User not found.
Definition rcode.h:53
@ RLM_MODULE_UPDATED
OK (pairs modified).
Definition rcode.h:55
@ RLM_MODULE_NOOP
Module succeeded without doing anything.
Definition rcode.h:54
@ RLM_MODULE_NUMCODES
How many valid return codes there are.
Definition rcode.h:57
@ RLM_MODULE_HANDLED
The module handled the request, so stop.
Definition rcode.h:50
#define RETURN_UNLANG_FAIL
Definition rcode.h:69
#define request_is_dynamic_client(_x)
Definition request.h:189
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
Definition section.h:39
CONF_SECTION * conf
Module's instance configuration.
Definition module.h:356
void * data
Module's instance data.
Definition module.h:298
#define MODULE_RCTX(_ctype)
Definition module.h:263
#define MODULE_INST(_ctype)
Definition module.h:261
conf_parser_t const * config
How to convert a CONF_SECTION to a module instance.
Definition module.h:208
#define pair_update_reply(_attr, _da)
Return or allocate a fr_pair_t in the reply list.
Definition pair.h:129
int fr_state_restore(fr_state_tree_t *state, request_t *request)
Copy a pointer to the head of the list of state fr_pair_ts (and their ctx) into the request.
Definition state.c:781
void fr_state_discard(fr_state_tree_t *state, request_t *request)
Called when sending an Access-Accept/Access-Reject to discard state information.
Definition state.c:702
int fr_state_store(fr_state_tree_t *state, request_t *request)
Transfer ownership of the state fr_pair_ts and ctx, back to a state entry.
Definition state.c:857
const conf_parser_t state_session_config[]
Definition state.c:59
fr_state_tree_t * fr_state_tree_init(TALLOC_CTX *ctx, fr_dict_attr_t const *da, fr_state_config_t const *config)
Initialise a new state tree.
Definition state.c:232
@ FR_SIGNAL_NONE
No signals.
Definition signal.h:39
unlang_action_t unlang_module_yield_to_section(unlang_result_t *p_result, request_t *request, CONF_SECTION *subcs, rlm_rcode_t default_rcode, module_method_t resume, unlang_module_signal_t signal, fr_signal_t sigmask, void *rctx)
Definition module.c:236
eap_aka_sim_process_conf_t * inst
#define RESUME(_x)
fr_pair_t * vp
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
fr_dict_attr_t const *_CONST da
Dictionary attribute defines the attribute number, vendor and type of the pair.
Definition pair.h:69
#define fr_table_str_by_value(_table, _number, _def)
Convert an integer to a string.
Definition table.h:804
#define talloc_get_type_abort_const
Definition talloc.h:117
xlat_action_t
Definition xlat.h:37
@ XLAT_ACTION_FAIL
An xlat function failed.
Definition xlat.h:44
@ XLAT_ACTION_DONE
We're done evaluating this level of nesting.
Definition xlat.h:43
#define XLAT_ARGS(_list,...)
Populate local variables with value boxes from the input list.
Definition xlat.h:373
unsigned int required
Argument must be present, and non-empty.
Definition xlat.h:136
#define XLAT_ARG_PARSER_TERMINATOR
Definition xlat.h:160
Definition for a single argument consumed by an xlat function.
Definition xlat.h:135
#define DOC_ROOT_URL
Definition version.h:87
fr_cmp_ret_t fr_value_box_cmp(fr_value_box_t const *a, fr_value_box_t const *b)
Compare two values.
Definition value.c:770
int fr_value_box_copy(TALLOC_CTX *ctx, fr_value_box_t *dst, const fr_value_box_t *src)
Copy value data verbatim duplicating any buffers.
Definition value.c:4526
#define fr_value_box_alloc(_ctx, _type, _enumv)
Allocate a value box of a specific type.
Definition value.h:668
static fr_value_box_t * fr_value_box_acopy(TALLOC_CTX *ctx, fr_value_box_t const *src)
Copy an existing box, allocating a new box to hold its contents.
Definition value.h:775
static fr_sbuff_err_t char ** out
Definition value.h:1061
#define fr_value_box_list_foreach(_list_head, _iter)
Definition value.h:253
int virtual_server_section_attribute_define(CONF_SECTION *server_cs, char const *subcs_name, fr_dict_attr_t const *da)
Define a values for Auth-Type attributes by the sections present in a virtual-server.
section_name_t const * section
Identifier for the section.
#define COMPILE_TERMINATOR
Processing sections which are allowed in this virtual server.
An xlat calling ctx.
Definition xlat_ctx.h:49
int xlat_func_args_set(xlat_t *x, xlat_arg_parser_t const args[])
Register the arguments of an xlat.
Definition xlat_func.c:374
xlat_t * xlat_func_register(TALLOC_CTX *ctx, char const *name, xlat_func_t func, fr_type_t return_type)
Register an xlat function.
Definition xlat_func.c:225
void xlat_func_unregister(char const *name)
Unregister an xlat function.
Definition xlat_func.c:520