- Fix to allow block_a and other local-zone types in a view.

This commit is contained in:
W.C.A. Wijngaards
2026-09-01 08:48:27 +02:00
parent 32ff948a5b
commit a6ccb2f74d
4 changed files with 52 additions and 48 deletions
+3
View File
@@ -1,3 +1,6 @@
1 September 2026: Wouter
- Fix to allow block_a and other local-zone types in a view.
26 August 2026: Wouter
- Fix notify for auth-zone during initial start up. It
performs the transfer and not only lookup.
+37
View File
@@ -3090,3 +3090,40 @@ file_get_mtime(const char* file, time_t* mtime, long* ns, int* nonexist)
#endif
return 1;
}
int cfg_local_zone_type_value_check(const char* str)
{
if(strcmp(str, "static")!=0 && strcmp(str, "deny")!=0 &&
strcmp(str, "refuse")!=0 && strcmp(str, "redirect")!=0 &&
strcmp(str, "transparent")!=0 && strcmp(str, "nodefault")!=0
&& strcmp(str, "typetransparent")!=0
&& strcmp(str, "always_transparent")!=0
&& strcmp(str, "block_a")!=0
&& strcmp(str, "block_aaaa")!=0
&& strcmp(str, "block_a_wdata")!=0
&& strcmp(str, "block_aaaa_wdata")!=0
&& strcmp(str, "always_refuse")!=0
&& strcmp(str, "always_nxdomain")!=0
&& strcmp(str, "always_nodata")!=0
&& strcmp(str, "always_deny")!=0
&& strcmp(str, "always_null")!=0
&& strcmp(str, "noview")!=0
&& strcmp(str, "inform")!=0 && strcmp(str, "inform_deny")!=0
&& strcmp(str, "inform_redirect") != 0
&& strcmp(str, "ipset") != 0)
return 0;
return 1;
}
const char* cfg_local_zone_type_list(void)
{
return "static, deny, "
"refuse, redirect, transparent, "
"typetransparent, inform, inform_deny, "
"inform_redirect, always_transparent, "
"block_a, block_aaaa, "
"block_a_wdata, block_aaaa_wdata, "
"always_refuse, always_nxdomain, "
"always_nodata, always_deny, always_null, "
"noview, nodefault or ipset";
}
+6
View File
@@ -1519,4 +1519,10 @@ void cfg_tls_protocols_allowed(const char* tls_protocols, int* allow12, int* all
/** get the file mtime stat (or error, with errno and nonexist) */
int file_get_mtime(const char* file, time_t* mtime, long* ns, int* nonexist);
/** check local-zone type for correctness */
int cfg_local_zone_type_value_check(const char* str);
/** the list of local-zone types, for error printout. */
const char* cfg_local_zone_type_list(void);
#endif /* UTIL_CONFIG_FILE_H */
+6 -48
View File
@@ -2401,33 +2401,9 @@ server_neg_cache_size: VAR_NEG_CACHE_SIZE STRING_ARG
server_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
{
OUTYY(("P(server_local_zone:%s %s)\n", $2, $3));
if(strcmp($3, "static")!=0 && strcmp($3, "deny")!=0 &&
strcmp($3, "refuse")!=0 && strcmp($3, "redirect")!=0 &&
strcmp($3, "transparent")!=0 && strcmp($3, "nodefault")!=0
&& strcmp($3, "typetransparent")!=0
&& strcmp($3, "always_transparent")!=0
&& strcmp($3, "block_a")!=0
&& strcmp($3, "block_aaaa")!=0
&& strcmp($3, "block_a_wdata")!=0
&& strcmp($3, "block_aaaa_wdata")!=0
&& strcmp($3, "always_refuse")!=0
&& strcmp($3, "always_nxdomain")!=0
&& strcmp($3, "always_nodata")!=0
&& strcmp($3, "always_deny")!=0
&& strcmp($3, "always_null")!=0
&& strcmp($3, "noview")!=0
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0
&& strcmp($3, "inform_redirect") != 0
&& strcmp($3, "ipset") != 0) {
yyerror("local-zone type: expected static, deny, "
"refuse, redirect, transparent, "
"typetransparent, inform, inform_deny, "
"inform_redirect, always_transparent, "
"block_a, block_aaaa, "
"block_a_wdata, block_aaaa_wdata, "
"always_refuse, always_nxdomain, "
"always_nodata, always_deny, always_null, "
"noview, nodefault or ipset");
if(!cfg_local_zone_type_value_check($3)) {
ub_c_error_msg("local-zone type: expected %s",
cfg_local_zone_type_list());
free($2);
free($3);
} else if(strcmp($3, "nodefault")==0) {
@@ -3393,27 +3369,9 @@ view_name: VAR_NAME STRING_ARG
view_local_zone: VAR_LOCAL_ZONE STRING_ARG STRING_ARG
{
OUTYY(("P(view_local_zone:%s %s)\n", $2, $3));
if(strcmp($3, "static")!=0 && strcmp($3, "deny")!=0 &&
strcmp($3, "refuse")!=0 && strcmp($3, "redirect")!=0 &&
strcmp($3, "transparent")!=0 && strcmp($3, "nodefault")!=0
&& strcmp($3, "typetransparent")!=0
&& strcmp($3, "always_transparent")!=0
&& strcmp($3, "always_refuse")!=0
&& strcmp($3, "always_nxdomain")!=0
&& strcmp($3, "always_nodata")!=0
&& strcmp($3, "always_deny")!=0
&& strcmp($3, "always_null")!=0
&& strcmp($3, "noview")!=0
&& strcmp($3, "inform")!=0 && strcmp($3, "inform_deny")!=0
&& strcmp($3, "inform_redirect") != 0
&& strcmp($3, "ipset") != 0) {
yyerror("local-zone type: expected static, deny, "
"refuse, redirect, transparent, "
"typetransparent, inform, inform_deny, "
"inform_redirect, always_transparent, "
"always_refuse, always_nxdomain, "
"always_nodata, always_deny, always_null, "
"noview, nodefault or ipset");
if(!cfg_local_zone_type_value_check($3)) {
ub_c_error_msg("local-zone type: expected %s",
cfg_local_zone_type_list());
free($2);
free($3);
} else if(strcmp($3, "nodefault")==0) {