Skip to content

Commit 6867950

Browse files
fxduponttmarkwalder
authored andcommitted
[#3133] Extended syntax
1 parent c190c5c commit 6867950

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/bin/d2/d2_lexer.ll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC")
1+
/* Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
22

33
This Source Code Form is subject to the terms of the Mozilla Public
44
License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -398,6 +398,16 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu]
398398
}
399399
}
400400
401+
\"secret-file\" {
402+
switch(driver.ctx_) {
403+
case isc::d2::D2ParserContext::TSIG_KEY:
404+
case isc::d2::D2ParserContext::TSIG_KEYS:
405+
return isc::d2::D2Parser::make_SECRET_FILE(driver.loc_);
406+
default:
407+
return isc::d2::D2Parser::make_STRING("secret-file", driver.loc_);
408+
}
409+
}
410+
401411
\"control-socket\" {
402412
switch(driver.ctx_) {
403413
case isc::d2::D2ParserContext::DHCPDDNS:

src/bin/d2/d2_parser.yy

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC")
1+
/* Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC")
22
33
This Source Code Form is subject to the terms of the Mozilla Public
44
License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -75,6 +75,7 @@ using namespace std;
7575
ALGORITHM "algorithm"
7676
DIGEST_BITS "digest-bits"
7777
SECRET "secret"
78+
SECRET_FILE "secret-file"
7879

7980
CONTROL_SOCKET "control-socket"
8081
SOCKET_TYPE "socket-type"
@@ -669,6 +670,7 @@ tsig_key_param: tsig_key_name
669670
| tsig_key_algorithm
670671
| tsig_key_digest_bits
671672
| tsig_key_secret
673+
| tsig_key_secret_file
672674
| user_context
673675
| comment
674676
| unknown_map_entry
@@ -710,6 +712,7 @@ tsig_key_digest_bits: DIGEST_BITS COLON INTEGER {
710712

711713
tsig_key_secret: SECRET {
712714
ctx.unique("secret", ctx.loc2pos(@1));
715+
ctx.unique("secret-file", ctx.loc2pos(@1));
713716
ctx.enter(ctx.NO_KEYWORD);
714717
} COLON STRING {
715718
if ($4 == "") {
@@ -720,6 +723,19 @@ tsig_key_secret: SECRET {
720723
ctx.leave();
721724
};
722725

726+
tsig_key_secret_file: SECRET_FILE {
727+
ctx.unique("secret", ctx.loc2pos(@1));
728+
ctx.unique("secret-file", ctx.loc2pos(@1));
729+
ctx.enter(ctx.NO_KEYWORD);
730+
} COLON STRING {
731+
if ($4 == "") {
732+
error(@3, "TSIG key secret file name cannot be blank");
733+
}
734+
ElementPtr elem(new StringElement($4, ctx.loc2pos(@4)));
735+
ctx.stack_.back()->set("secret-file", elem);
736+
ctx.leave();
737+
};
738+
723739

724740
// --- end of tsig-keys ---------------------------------
725741

0 commit comments

Comments
 (0)