]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3133] Extended syntax
authorFrancis Dupont <fdupont@isc.org>
Wed, 27 Mar 2024 09:28:12 +0000 (10:28 +0100)
committerThomas Markwalder <tmark@isc.org>
Tue, 16 Apr 2024 19:00:57 +0000 (19:00 +0000)
src/bin/d2/d2_lexer.ll
src/bin/d2/d2_parser.yy

index f24d9ceb643c948843fd221f4316834d721da1c1..be169a904fa0e2e235b18ac7ff18db4558900413 100644 (file)
@@ -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:
index d3185de2d6d0645dcecf65c421a21613f0e30b2d..f42f498ab97002b81815f5682e173c13a325c35a 100644 (file)
@@ -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 ---------------------------------