From: Francis Dupont Date: Wed, 27 Mar 2024 09:28:12 +0000 (+0100) Subject: [#3133] Extended syntax X-Git-Tag: Kea-2.5.8~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68679500a0a2eb89166317ee6ed9891f53195eb9;p=thirdparty%2Fkea.git [#3133] Extended syntax --- diff --git a/src/bin/d2/d2_lexer.ll b/src/bin/d2/d2_lexer.ll index f24d9ceb64..be169a904f 100644 --- a/src/bin/d2/d2_lexer.ll +++ b/src/bin/d2/d2_lexer.ll @@ -1,4 +1,4 @@ -/* Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC") +/* Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC") This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this @@ -398,6 +398,16 @@ ControlCharacterFill [^"\\]|\\["\\/bfnrtu] } } +\"secret-file\" { + switch(driver.ctx_) { + case isc::d2::D2ParserContext::TSIG_KEY: + case isc::d2::D2ParserContext::TSIG_KEYS: + return isc::d2::D2Parser::make_SECRET_FILE(driver.loc_); + default: + return isc::d2::D2Parser::make_STRING("secret-file", driver.loc_); + } +} + \"control-socket\" { switch(driver.ctx_) { case isc::d2::D2ParserContext::DHCPDDNS: diff --git a/src/bin/d2/d2_parser.yy b/src/bin/d2/d2_parser.yy index d3185de2d6..f42f498ab9 100644 --- a/src/bin/d2/d2_parser.yy +++ b/src/bin/d2/d2_parser.yy @@ -1,4 +1,4 @@ -/* Copyright (C) 2017-2023 Internet Systems Consortium, Inc. ("ISC") +/* Copyright (C) 2017-2024 Internet Systems Consortium, Inc. ("ISC") This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this @@ -75,6 +75,7 @@ using namespace std; ALGORITHM "algorithm" DIGEST_BITS "digest-bits" SECRET "secret" + SECRET_FILE "secret-file" CONTROL_SOCKET "control-socket" SOCKET_TYPE "socket-type" @@ -669,6 +670,7 @@ tsig_key_param: tsig_key_name | tsig_key_algorithm | tsig_key_digest_bits | tsig_key_secret + | tsig_key_secret_file | user_context | comment | unknown_map_entry @@ -710,6 +712,7 @@ tsig_key_digest_bits: DIGEST_BITS COLON INTEGER { tsig_key_secret: SECRET { ctx.unique("secret", ctx.loc2pos(@1)); + ctx.unique("secret-file", ctx.loc2pos(@1)); ctx.enter(ctx.NO_KEYWORD); } COLON STRING { if ($4 == "") { @@ -720,6 +723,19 @@ tsig_key_secret: SECRET { ctx.leave(); }; +tsig_key_secret_file: SECRET_FILE { + ctx.unique("secret", ctx.loc2pos(@1)); + ctx.unique("secret-file", ctx.loc2pos(@1)); + ctx.enter(ctx.NO_KEYWORD); +} COLON STRING { + if ($4 == "") { + error(@3, "TSIG key secret file name cannot be blank"); + } + ElementPtr elem(new StringElement($4, ctx.loc2pos(@4))); + ctx.stack_.back()->set("secret-file", elem); + ctx.leave(); +}; + // --- end of tsig-keys ---------------------------------