Skip to content

Commit

Permalink
allow bare word attributes in configuration
Browse files Browse the repository at this point in the history
via CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE
  • Loading branch information
alandekok committed Jan 22, 2025
1 parent e19c62d commit 8d2c07c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 40 deletions.
28 changes: 14 additions & 14 deletions src/modules/rlm_redis_ippool/rlm_redis_ippool.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ typedef struct {
static const call_env_method_t redis_ippool_alloc_method_env = {
FR_CALL_ENV_METHOD_OUT(redis_ippool_alloc_call_env_t),
.env = (call_env_parser_t[]){
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT,
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE,
redis_ippool_alloc_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("owner", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT,
{ FR_CALL_ENV_OFFSET("owner", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE,
redis_ippool_alloc_call_env_t, owner) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT,
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE,
redis_ippool_alloc_call_env_t, gateway_id ), .pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING },
{ FR_CALL_ENV_OFFSET("offer_time", FR_TYPE_UINT32, CALL_ENV_FLAG_NONE, redis_ippool_alloc_call_env_t, offer_time ) },
{ FR_CALL_ENV_OFFSET("lease_time", FR_TYPE_UINT32, CALL_ENV_FLAG_REQUIRED, redis_ippool_alloc_call_env_t, lease_time) },
{ FR_CALL_ENV_OFFSET("requested_address", FR_TYPE_COMBO_IP_ADDR, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_NULLABLE, redis_ippool_alloc_call_env_t, requested_address ),
{ FR_CALL_ENV_OFFSET("requested_address", FR_TYPE_COMBO_IP_ADDR, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_alloc_call_env_t, requested_address ),
.pair.dflt = "%{%{Requested-IP-Address} || %{Net.Src.IP}}", .pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
{ FR_CALL_ENV_PARSE_ONLY_OFFSET("allocated_address_attr", FR_TYPE_VOID, CALL_ENV_FLAG_ATTRIBUTE | CALL_ENV_FLAG_REQUIRED, redis_ippool_alloc_call_env_t, allocated_address_attr) },
{ FR_CALL_ENV_PARSE_ONLY_OFFSET("range_attr", FR_TYPE_VOID, CALL_ENV_FLAG_ATTRIBUTE | CALL_ENV_FLAG_REQUIRED, redis_ippool_alloc_call_env_t, range_attr),
Expand All @@ -205,12 +205,12 @@ static const call_env_method_t redis_ippool_alloc_method_env = {
static const call_env_method_t redis_ippool_update_method_env = {
FR_CALL_ENV_METHOD_OUT(redis_ippool_update_call_env_t),
.env = (call_env_parser_t[]) {
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT, redis_ippool_update_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("owner", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT, redis_ippool_update_call_env_t, owner) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT, redis_ippool_update_call_env_t, gateway_id),
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_update_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("owner", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_update_call_env_t, owner) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_update_call_env_t, gateway_id),
.pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING },
{ FR_CALL_ENV_OFFSET("lease_time", FR_TYPE_UINT32, CALL_ENV_FLAG_REQUIRED, redis_ippool_update_call_env_t, lease_time) },
{ FR_CALL_ENV_OFFSET("requested_address", FR_TYPE_COMBO_IP_ADDR, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_NULLABLE, redis_ippool_update_call_env_t, requested_address),
{ FR_CALL_ENV_OFFSET("requested_address", FR_TYPE_COMBO_IP_ADDR, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_update_call_env_t, requested_address),
.pair.dflt = "%{%{Requested-IP-Address} || %{Net.Src.IP}}", .pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
{ FR_CALL_ENV_PARSE_ONLY_OFFSET("allocated_address_attr", FR_TYPE_VOID, CALL_ENV_FLAG_ATTRIBUTE | CALL_ENV_FLAG_REQUIRED, redis_ippool_update_call_env_t, allocated_address_attr) },
{ FR_CALL_ENV_PARSE_ONLY_OFFSET("range_attr", FR_TYPE_VOID, CALL_ENV_FLAG_ATTRIBUTE | CALL_ENV_FLAG_REQUIRED, redis_ippool_update_call_env_t, range_attr),
Expand All @@ -223,11 +223,11 @@ static const call_env_method_t redis_ippool_update_method_env = {
static const call_env_method_t redis_ippool_release_method_env = {
FR_CALL_ENV_METHOD_OUT(redis_ippool_release_call_env_t),
.env = (call_env_parser_t[]) {
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT, redis_ippool_release_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("owner", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT, redis_ippool_release_call_env_t, owner) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT, redis_ippool_release_call_env_t, gateway_id),
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_release_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("owner", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_release_call_env_t, owner) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_release_call_env_t, gateway_id),
.pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING },
{ FR_CALL_ENV_OFFSET("requested_address", FR_TYPE_COMBO_IP_ADDR, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_NULLABLE, redis_ippool_release_call_env_t, requested_address),
{ FR_CALL_ENV_OFFSET("requested_address", FR_TYPE_COMBO_IP_ADDR, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_release_call_env_t, requested_address),
.pair.dflt = "%{%{Requested-IP-Address} || %{Net.Src.IP}}", .pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
CALL_ENV_TERMINATOR
}
Expand All @@ -236,8 +236,8 @@ static const call_env_method_t redis_ippool_release_method_env = {
static const call_env_method_t redis_ippool_bulk_release_method_env = {
FR_CALL_ENV_METHOD_OUT(redis_ippool_bulk_release_call_env_t),
.env = (call_env_parser_t[]) {
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT, redis_ippool_bulk_release_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT, redis_ippool_bulk_release_call_env_t, gateway_id),
{ FR_CALL_ENV_OFFSET("pool_name", FR_TYPE_STRING, CALL_ENV_FLAG_REQUIRED | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_bulk_release_call_env_t, pool_name) },
{ FR_CALL_ENV_OFFSET("gateway", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, redis_ippool_bulk_release_call_env_t, gateway_id),
.pair.dflt = "", .pair.dflt_quote = T_SINGLE_QUOTED_STRING },
CALL_ENV_TERMINATOR
}
Expand Down
10 changes: 5 additions & 5 deletions src/modules/rlm_smtp/rlm_smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,15 +1001,15 @@ static const call_env_method_t method_env = {
.pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
{ FR_CALL_ENV_OFFSET("password", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_CONCAT, rlm_smtp_env_t, password), .pair.dflt_quote = T_DOUBLE_QUOTED_STRING },
{ FR_CALL_ENV_OFFSET("sender_address", FR_TYPE_STRING, CALL_ENV_FLAG_NONE, rlm_smtp_env_t, sender_address) },
{ FR_CALL_ENV_OFFSET("recipients", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE, rlm_smtp_env_t, recipient_addrs),
{ FR_CALL_ENV_OFFSET("recipients", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUTE, rlm_smtp_env_t, recipient_addrs),
.pair.dflt = "&SMTP-Recipients[*]", .pair.dflt_quote = T_BARE_WORD },
{ FR_CALL_ENV_OFFSET("TO", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE, rlm_smtp_env_t, to_addrs),
{ FR_CALL_ENV_OFFSET("TO", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUT, rlm_smtp_env_t, to_addrs),
.pair.dflt = "&SMTP-TO[*]", .pair.dflt_quote = T_BARE_WORD },
{ FR_CALL_ENV_OFFSET("CC", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE, rlm_smtp_env_t, cc_addrs),
{ FR_CALL_ENV_OFFSET("CC", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUT, rlm_smtp_env_t, cc_addrs),
.pair.dflt = "&SMTP-CC[*]", .pair.dflt_quote = T_BARE_WORD },
{ FR_CALL_ENV_OFFSET("BCC", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE, rlm_smtp_env_t, bcc_addrs),
{ FR_CALL_ENV_OFFSET("BCC", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUT, rlm_smtp_env_t, bcc_addrs),
.pair.dflt = "&SMTP-BCC[*]", .pair.dflt_quote = T_BARE_WORD },
{ FR_CALL_ENV_OFFSET("attachments", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE, rlm_smtp_env_t, attachments),
{ FR_CALL_ENV_OFFSET("attachments", FR_TYPE_STRING, CALL_ENV_FLAG_NULLABLE | CALL_ENV_FLAG_BARE_WORD_ATTRIBUT, rlm_smtp_env_t, attachments),
.pair.dflt = "&SMTP-Attachments[*]", .pair.dflt_quote = T_BARE_WORD },
{ FR_CALL_ENV_SUBSECTION_FUNC("header", CF_IDENT_ANY, CALL_ENV_FLAG_SUBSECTION, smtp_header_section_parse) },

Expand Down
14 changes: 7 additions & 7 deletions src/tests/modules/redis_ippool/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
# expansion.
#
redis_ippool {
owner = &Calling-Station-ID
gateway = &NAS-IP-Address
pool_name = &control.IP-Pool.Name
owner = Calling-Station-ID
gateway = NAS-IP-Address
pool_name = control.IP-Pool.Name

offer_time = 30
lease_time = 60

requested_address = &Framed-IP-Address
allocated_address_attr = &reply.Framed-IP-address
range_attr = &reply.IP-Pool.Range
expiry_attr = &reply.Session-Timeout
requested_address = Framed-IP-Address
allocated_address_attr = reply.Framed-IP-address
range_attr = reply.IP-Pool.Range
expiry_attr = reply.Session-Timeout

copy_on_update = yes

Expand Down
12 changes: 6 additions & 6 deletions src/tests/modules/smtp/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ smtp {
template_directory = "$ENV{top_srcdir}build/ci/exim4"

envelope_address = "postmaster@localhost"
attachments = &SMTP-Attachments[*]
attachments = SMTP-Attachments[*]

recipients = "conf_recipient_1@localhost"
recipients = "conf_recipient_2@localhost"
recipients = &SMTP-Recipients[*]
recipients = &SMTP-TO[*]
recipients = &SMTP-CC[*]
recipients = SMTP-Recipients[*]
recipients = SMTP-TO[*]
recipients = SMTP-CC[*]

TO = "conf_to@localhost"
TO = &SMTP-TO[*]
TO = SMTP-TO[*]

CC = &SMTP-CC[*]
CC = SMTP-CC[*]

set_date = no
}
Expand Down
6 changes: 3 additions & 3 deletions src/tests/modules/smtp/smtp_attachment/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ smtp {

recipients = "conf_recipient_1@localhost"
recipients = "conf_recipient_2@localhost"
recipients = &SMTP-Recipients[*]
recipients = SMTP-Recipients[*]

TO = "conf_to@localhost"
TO = &SMTP-TO[*]
TO = SMTP-TO[*]

CC = &SMTP-CC[*]
CC = SMTP-CC[*]

set_date = no
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/modules/smtp/smtp_crln/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ smtp {
sender_address = "sender_email2@localhost"
envelope_address = "postmaster@localhost"
recipients = "crln_test_receiver@localhost"
recipients = &SMTP-Recipients[*]
recipients = SMTP-Recipients[*]
set_date = no
}

Expand Down
8 changes: 4 additions & 4 deletions src/tests/modules/smtp/smtp_stringparse/module.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ smtp {
message_id = "[email protected]"
}

username = &User-Name
password = &User-Password
username = User-Name
password = User-Password

uri = "$ENV{SMTP_TEST_SERVER}:$ENV{SMTP_TEST_SERVER_PORT}"
timeout = 5s
template_directory = "$ENV{top_srcdir}build/ci/exim4"
sender_address = &SMTP-Sender-Address[*]
sender_address = SMTP-Sender-Address[*]
envelope_address = "postmaster@localhost"
recipients = "conf-stringparse-recipient@localhost"
recipients = &SMTP-Recipients[*]
recipients = SMTP-Recipients[*]
set_date = no
}

Expand Down

0 comments on commit 8d2c07c

Please sign in to comment.