vici: Add support for POSIX regular expressions in identity fields

This commit is contained in:
Tobias Brunner
2025-05-28 09:58:17 +02:00
parent 10c2985cdd
commit 981c82ab50
3 changed files with 31 additions and 13 deletions
+4 -2
View File
@@ -1486,13 +1486,15 @@ CALLBACK(parse_auth, bool,
*/
static bool parse_id(auth_cfg_t *cfg, auth_rule_t rule, chunk_t v)
{
identification_t *id;
char buf[BUF_LEN];
if (!vici_stringify(v, buf, sizeof(buf)))
if (!vici_stringify(v, buf, sizeof(buf)) ||
!(id = identification_create_from_string_with_regex(buf)))
{
return FALSE;
}
cfg->add(cfg, rule, identification_create_from_string(buf));
cfg->add(cfg, rule, id);
return TRUE;
}
+4 -2
View File
@@ -395,13 +395,15 @@ CALLBACK(shared_owners, bool,
{
if (streq(name, "owners"))
{
identification_t *id;
char buf[256];
if (!vici_stringify(value, buf, sizeof(buf)))
if (!vici_stringify(value, buf, sizeof(buf)) ||
!(id = identification_create_from_string_with_regex(buf)))
{
return FALSE;
}
owners->insert_last(owners, identification_create_from_string(buf));
owners->insert_last(owners, id);
}
return TRUE;
}