summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-08-24 16:59:23 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-08-24 16:59:23 +0200
commitf411a19bb0467cfc421f8aa6f5ead49972bab058 (patch)
tree4852ae63fc2657934eadb877c467ab1b26fb2593 /nest
parent0dbcc927260c6da918fa1bd78c86800e41ab05a8 (diff)
Conf: Use nonterminal bytestring instead of BYTETEXT
Nonterminal bytestring allows to provide expressions to be evaluated in places where BYTETEXT is used now: passwords, radv custom option. Based on the patch from Alexander Zubkov <green@qrator.net>, thanks!
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y13
1 files changed, 9 insertions, 4 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 610b1c01..1c40ced6 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -546,10 +546,15 @@ password_item:
pass_key: PASSWORD | KEY;
-password_item_begin:
- pass_key text { init_password_list(); init_password($2, strlen($2), password_id++); }
- | pass_key BYTETEXT { init_password_list(); init_password($2->data, $2->length, password_id++); }
-;
+password_item_begin: pass_key bytestring_text
+{
+ init_password_list();
+ if ($2.type == T_BYTESTRING)
+ init_password($2.val.bs->data, $2.val.bs->length, password_id++);
+ else if ($2.type == T_STRING)
+ init_password($2.val.s, strlen($2.val.s), password_id++);
+ else bug("Bad bytestring_text");
+};
password_item_params:
/* empty */ { }