]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to print a parse error when config is read with no name for
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 21 May 2024 09:54:18 +0000 (11:54 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 21 May 2024 09:54:18 +0000 (11:54 +0200)
  a forward-zone, stub-zone or view.

doc/Changelog
util/configparser.y

index 39aa7f25bd2df0f64080eadc29dbf8f0103e72c2..ac5c03a137c13cb08f67bef8b080e3ddbdf70e77 100644 (file)
@@ -1,6 +1,8 @@
 21 May 2024: Wouter
        - Merge #1073: fix null pointer dereference issue in function
          ub_ctx_set_fwd.
+       - Fix to print a parse error when config is read with no name for
+         a forward-zone, stub-zone or view.
 
 17 May 2024: Yorgos
        - Merge #1069: Fix unbound-control stdin commands for multi-process
index 0feeb61b168b70d52e638fd402b8676fbffa3bf4..2e82da5d7ce516de98ecdf498c3995317c8aef08 100644 (file)
@@ -358,7 +358,13 @@ stubstart: VAR_STUB_ZONE
        }
        ;
 contents_stub: contents_stub content_stub
-       | ;
+       |
+       {
+               /* stub end */
+               if(cfg_parser->cfg->stubs &&
+                       !cfg_parser->cfg->stubs->name)
+                       yyerror("stub-zone without name");
+       };
 content_stub: stub_name | stub_host | stub_addr | stub_prime | stub_first |
        stub_no_cache | stub_ssl_upstream | stub_tcp_upstream
        ;
@@ -377,7 +383,13 @@ forwardstart: VAR_FORWARD_ZONE
        }
        ;
 contents_forward: contents_forward content_forward
-       | ;
+       |
+       {
+               /* forward end */
+               if(cfg_parser->cfg->forwards &&
+                       !cfg_parser->cfg->forwards->name)
+                       yyerror("forward-zone without name");
+       };
 content_forward: forward_name | forward_host | forward_addr | forward_first |
        forward_no_cache | forward_ssl_upstream | forward_tcp_upstream
        ;
@@ -389,8 +401,6 @@ viewstart: VAR_VIEW
                s = (struct config_view*)calloc(1, sizeof(struct config_view));
                if(s) {
                        s->next = cfg_parser->cfg->views;
-                       if(s->next && !s->next->name)
-                               yyerror("view without name");
                        cfg_parser->cfg->views = s;
                } else {
                        yyerror("out of memory");
@@ -398,7 +408,13 @@ viewstart: VAR_VIEW
        }
        ;
 contents_view: contents_view content_view
-       | ;
+       |
+       {
+               /* view end */
+               if(cfg_parser->cfg->views &&
+                       !cfg_parser->cfg->views->name)
+                       yyerror("view without name");
+       };
 content_view: view_name | view_local_zone | view_local_data | view_first |
                view_response_ip | view_response_ip_data | view_local_data_ptr
        ;