== Deleted Functionality
-The `Response-Packet-Type` attribute has been removed. Please replace
-it with `&reply.Packet-Type`.
+Many "virtual" or "fake" attributes have been removed or renamed.
+
+`&Module-Return-Code` should be replaced by `%{interpreter:rcode}`.
+
+`&Response-Packet-Type` should be replaced by `&reply.Packet-Type`.
+
+`&Virtual-Server` should be replaced by `%{interpreter:server}`.
# NOTE: OpenSSL only allows 32 bytes of session ctx, so
# the value provided here is digested with SHA256.
#
-# name = "%{EAP-Type}%{Virtual-Server}"
+# name = "%{EAP-Type}%{interpreter:server}"
#
# lifetime::
ATTRIBUTE Load-Balance-Key 20 string
ATTRIBUTE Proxy-To-Realm 21 string
# 22 - was Replicate-To-Realm
-ATTRIBUTE Virtual-Server 23 string virtual
-ATTRIBUTE Module-Return-Code 24 integer virtual
-
-VALUE Module-Return-Code reject 0
-VALUE Module-Return-Code fail 1
-VALUE Module-Return-Code ok 2
-VALUE Module-Return-Code handled 3
-VALUE Module-Return-Code invalid 4
-VALUE Module-Return-Code disallow 5
-VALUE Module-Return-Code notfound 6
-VALUE Module-Return-Code noop 7
-VALUE Module-Return-Code updated 8
+# 23 was Virtual-Server
+# 24 was Module-Return-Code
#
# Cannonical definition of all available module methods
VALUE Module-Method clear 23
VALUE Module-Method refresh 24
-ATTRIBUTE Request-Processing-Stage 26 string virtual
+# 26 was Request-Processing-Stage
#
# Range: 50 - 99
static fr_dict_attr_t const *attr_packet_src_port;
static fr_dict_attr_t const *attr_packet_type;
static fr_dict_attr_t const *attr_packet_authentication_vector;
-static fr_dict_attr_t const *attr_request_processing_stage;
-static fr_dict_attr_t const *attr_virtual_server;
-static fr_dict_attr_t const *attr_module_return_code;
/** Placeholder attribute for uses of unspecified attribute references
*/
fr_dict_attr_t const *tmpl_attr_unspec;
static fr_dict_attr_autoload_t tmpl_dict_attr[] = {
- { .out = &attr_module_return_code, .name = "Module-Return-Code", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
{ .out = &attr_packet_dst_ip_address, .name = "Packet-Dst-IP-Address", .type = FR_TYPE_IPV4_ADDR, .dict = &dict_freeradius },
{ .out = &attr_packet_dst_ipv6_address, .name = "Packet-Dst-IPV6-Address", .type = FR_TYPE_IPV6_ADDR, .dict = &dict_freeradius },
{ .out = &attr_packet_dst_port, .name = "Packet-Dst-Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
{ .out = &attr_packet_src_ip_address, .name = "Packet-Src-IP-Address", .type = FR_TYPE_IPV4_ADDR, .dict = &dict_freeradius },
{ .out = &attr_packet_src_ipv6_address, .name = "Packet-Src-IPv6-Address", .type = FR_TYPE_IPV6_ADDR, .dict = &dict_freeradius },
{ .out = &attr_packet_src_port, .name = "Packet-Src-Port", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
- { .out = &attr_request_processing_stage, .name = "Request-Processing-Stage", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
- { .out = &attr_virtual_server, .name = "Virtual-Server", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
{ .out = &attr_packet_authentication_vector, .name = "Packet-Authentication-Vector", .type = FR_TYPE_OCTETS, .dict = &dict_radius },
{ .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_radius },
goto done;
}
- /*
- * Some non-packet expansions
- */
- if (tmpl_attr_tail_da(vpt) == attr_request_processing_stage) {
- if (!request->component) return 0;
-
- MEM(value = fr_value_box_alloc_null(ctx));
- if (fr_value_box_strdup(ctx, value, tmpl_attr_tail_da(vpt), request->component, false) < 0) {
- error:
- talloc_free(value);
- return -1;
- }
- goto done;
- }
-
- if (tmpl_attr_tail_da(vpt) == attr_virtual_server) {
- if (!unlang_call_current(request)) return 0;
-
- MEM(value = fr_value_box_alloc_null(ctx));
- if (fr_value_box_bstrdup_buffer(ctx, value, tmpl_attr_tail_da(vpt),
- cf_section_name2(unlang_call_current(request)), false) < 0) goto error;
- goto done;
- }
-
- if (tmpl_attr_tail_da(vpt) == attr_module_return_code) {
- MEM(value = fr_value_box_alloc(ctx, tmpl_attr_tail_da(vpt)->type, tmpl_attr_tail_da(vpt)));
- value->datum.int32 = request->rcode;
- goto done;
- }
-
/*
* All of the attributes must now refer to a packet.
* If there's no packet, we can't print any attribute
*/
while (*fmt == '.') {
if (depth <= 1) {
- if (fr_value_box_bstrndup(ctx, vb, NULL, "<underflow>", 11, false) < 0) {
+ if (fr_value_box_bstrndup(vb, vb, NULL, "<underflow>", 11, false) < 0) {
error:
talloc_free(vb);
return XLAT_ACTION_FAIL;
* The current module
*/
if (strcmp(fmt, "module") == 0) {
- if (fr_value_box_strdup(ctx, vb, NULL, request->module, false) < 0) goto error;
+ if (fr_value_box_strdup(vb, vb, NULL, request->module, false) < 0) goto error;
goto finish;
}
* Name of the instruction.
*/
if (strcmp(fmt, "name") == 0) {
- if (fr_value_box_bstrndup(ctx, vb, NULL, instruction->name,
+ if (fr_value_box_bstrndup(vb, vb, NULL, instruction->name,
strlen(instruction->name), false) < 0) goto error;
goto finish;
}
* The request processing stage.
*/
if (strcmp(fmt, "processing_stage") == 0) {
- if (fr_value_box_strdup(ctx, vb, NULL, request->component, false) < 0) goto error;
+ if (fr_value_box_strdup(vb, vb, NULL, request->component, false) < 0) goto error;
goto finish;
}
* The current return code.
*/
if (strcmp(fmt, "rcode") == 0) {
- if (fr_value_box_strdup(ctx, vb, NULL, fr_table_str_by_value(rcode_table, request->rcode, "<INVALID>"), false) < 0) goto error;
+ if (fr_value_box_strdup(vb, vb, NULL, fr_table_str_by_value(rcode_table, request->rcode, "<INVALID>"), false) < 0) goto error;
goto finish;
}
if (strcmp(fmt, "server") == 0) {
if (!unlang_call_current(request)) goto finish;
- if (fr_value_box_strdup(ctx, vb, NULL, cf_section_name2(unlang_call_current(request)), false) < 0) goto error;
+ if (fr_value_box_strdup(vb, vb, NULL, cf_section_name2(unlang_call_current(request)), false) < 0) goto error;
goto finish;
}
* Unlang instruction type.
*/
if (strcmp(fmt, "type") == 0) {
- if (fr_value_box_bstrndup(ctx, vb, NULL, unlang_ops[instruction->type].name,
+ if (fr_value_box_bstrndup(vb, vb, NULL, unlang_ops[instruction->type].name,
strlen(unlang_ops[instruction->type].name), false) < 0) goto error;
goto finish;
* All of the remaining things need a CONF_ITEM.
*/
if (!instruction->ci) {
- if (fr_value_box_bstrndup(ctx, vb, NULL, "<INVALID>", 3, false) < 0) goto error;
+ if (fr_value_box_bstrndup(vb, vb, NULL, "<INVALID>", 3, false) < 0) goto error;
goto finish;
}
* Filename of the current section.
*/
if (strcmp(fmt, "filename") == 0) {
- if (fr_value_box_strdup(ctx, vb, NULL, cf_filename(instruction->ci), false) < 0) goto error;
+ if (fr_value_box_strdup(vb, vb, NULL, cf_filename(instruction->ci), false) < 0) goto error;
goto finish;
}
};
fr_dict_attr_t const *attr_expr_bool_enum; /* xlat_expr.c */
-fr_dict_attr_t const *attr_module_return_code; /* xlat_expr.c */
fr_dict_attr_t const *attr_cast_base; /* xlat_expr.c */
static fr_dict_attr_autoload_t xlat_eval_dict_attr[] = {
- { .out = &attr_module_return_code, .name = "Module-Return-Code", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
-
{ .out = &attr_expr_bool_enum, .name = "Expr-Bool-Enum", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
{ .out = &attr_cast_base, .name = "Cast-Base", .type = FR_TYPE_UINT8, .dict = &dict_freeradius },
{ NULL }
* matches the current rcode.
*/
if (!src) {
- MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_UINT32, attr_module_return_code));
- vb->datum.int32 = request->rcode;
+ MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL));
+ if (fr_value_box_strdup(vb, vb, NULL, fr_table_str_by_value(rcode_table, request->rcode, "<INVALID>"), false) < 0) {
+ talloc_free(vb);
+ return XLAT_ACTION_FAIL;
+ }
} else {
rlm_rcode_t rcode;
+++ /dev/null
-#
-# PRE: if
-#
-if (&Packet-Type == Access-Request) {
- success
-}
+++ /dev/null
-#
-# PRE: if
-#
-if (&Virtual-Server) {
- success
-}
# PRE: if
#
-if (!("%{Virtual-Server}" == 'default')) {
- test_fail
-}
-
-ok
-if (!("%{Module-Return-Code}" == 'ok')) {
- test_fail
-}
-
if (!("%{Packet-Type}" == 'Access-Request')) {
test_fail
}
test_fail
}
-# Operations on virtual attributes should be the same as on real ones
-if (!("%{Virtual-Server[0]}" == 'default')) {
- test_fail
-}
-
-if (!("%{Virtual-Server[*]}" == 'default')) {
- test_fail
-}
-
-if (!(%{Virtual-Server[#]} == 1)) {
- test_fail
-}
-
success