Commit e2cf9c2d authored by James Brister's avatar James Brister
Browse files

support 'disabled' statement in zone config (causes

zone to be parsed and then ignored). Currently must
come after the 'type' clause.

support optional ports in masters and also-notify
statements:

	masters [ port xxx ] { y.y.y.y [ port zzz ] ; }

removed some unused arguments.

stop issuing some warnings about some features that
were not implemented, but now are.
parent 6ba0a8a5
148. [func + cleanup] support 'disabled' statement in zone config (causes
zone to be parsed and then ignored). Currently must
come after the 'type' clause.
support optional ports in masters and also-notify
statements:
masters [ port xxx ] { y.y.y.y [ port zzz ] ; }
removed some unused arguments.
stop issuing some warnings about some features that
were not implemented, but now are.
147. [bug] Changed yacc union size to be smaller for yaccs that
put yacc-stack on the real stack.
......
......@@ -182,7 +182,7 @@ zone "master.demo.zone" {
// zone? The global option is used
// if "notify" is not specified
// here.
also-notify { }; // don't notify any nameservers other
also-notify { 1.0.0.1; }; // don't notify any nameservers other
// than those on the NS list for this
// zone
forward first;
......@@ -207,9 +207,7 @@ zone "slave.demo.zone" {
max-transfer-time-out 1; // if not set, global option is used.
max-transfer-idle-in 2; // if not set, global option is used.
max-transfer-idle-out 3; // if not set, global option is used.
also-notify { }; // don't notify any nameservers other
// than those on the NS list for this
// zone
also-notify { 1.0.0.2; };
forward only;
forwarders { 10.45.45.45; 10.0.0.3; 1:2:3:4:5:6:7:8; };
};
......@@ -264,8 +262,8 @@ zone "stub.demo.zone" {
// are transferred.
file "stub.demo.zone";
masters {
1.2.3.4; // where to zone transfer from
5.6.7.8;
1.2.3.4 ; // where to zone transfer from
5.6.7.8 port 999;
};
check-names warn;
allow-update { none; };
......@@ -294,6 +292,7 @@ acl can_axfr { 1.2.3.4; can_query; }; // host 1.2.3.4 and any host allowed
zone "non-default-acl.demo.zone" {
type master;
disabled;
file "foo";
allow-query { can_query; };
allow-transfer { can_axfr; };
......
......@@ -74,7 +74,7 @@ optscbk(dns_c_ctx_t *ctx, void *uap)
return (ISC_R_SUCCESS);
}
extern int dns__yydebug;
int main (int argc, char **argv) {
dns_c_ctx_t *configctx = NULL;
......@@ -100,7 +100,8 @@ int main (int argc, char **argv) {
if (argc > 1 && strcmp(argv[1],"-d") == 0) {
argv++;
argc--;
debug_mem_print = ISC_TRUE;
/* debug_mem_print = ISC_TRUE; */
dns__yydebug = 1;
}
conffile = getenv("NAMED_CONF");
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confctx.c,v 1.53 2000/04/28 01:23:54 gson Exp $ */
/* $Id: confctx.c,v 1.54 2000/05/03 19:29:35 brister Exp $ */
#include <config.h>
......@@ -230,7 +230,6 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
isc_int32_t intval;
isc_uint32_t uintval;
dns_c_ipmatchlist_t *ipml;
dns_c_iplist_t *iplist;
isc_result_t result = ISC_R_SUCCESS;
isc_result_t tmpres;
dns_c_rrsolist_t *olist;
......@@ -316,13 +315,6 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
}
if (dns_c_ctx_getnotify(cfg, &bval) != ISC_R_NOTFOUND) {
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"option 'notify' is not yet implemented.");
}
if (dns_c_ctx_getrfc2308type1(cfg, &bval) != ISC_R_NOTFOUND) {
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
......@@ -344,15 +336,6 @@ dns_c_checkconfig(dns_c_ctx_t *cfg)
}
if (dns_c_ctx_getalsonotify(cfg, &iplist) != ISC_R_NOTFOUND) {
dns_c_iplist_detach(&iplist);
isc_log_write(dns_lctx,DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG, ISC_LOG_WARNING,
"option 'also-notify' is not yet implemented.");
}
if ((dns_c_ctx_getchecknames(cfg, dns_trans_primary,
&severity) != ISC_R_NOTFOUND) ||
(dns_c_ctx_getchecknames(cfg, dns_trans_secondary,
......@@ -1010,7 +993,8 @@ dns_c_ctx_optionsprint(FILE *fp, int indent, dns_c_options_t *options)
if (options->also_notify != NULL) {
dns_c_printtabs(fp, indent + 1);
fprintf(fp, "also-notify ") ;
dns_c_iplist_print(fp, indent + 2, options->also_notify);
dns_c_iplist_printfully(fp, indent + 2, ISC_TRUE,
options->also_notify);
fprintf(fp, ";\n");
}
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confip.c,v 1.22 2000/04/28 01:10:30 halley Exp $ */
/* $Id: confip.c,v 1.23 2000/05/03 19:29:37 brister Exp $ */
#include <config.h>
......@@ -885,27 +885,63 @@ dns_c_iplist_equal(dns_c_iplist_t *list1, dns_c_iplist_t *list2) {
void
dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list)
dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo,
dns_c_iplist_t *list)
{
isc_uint32_t i;
in_port_t port;
in_port_t tmpport;
isc_boolean_t athead = ISC_TRUE;
REQUIRE(DNS_C_IPLIST_VALID(list));
fprintf(fp, "{\n");
if (list->nextidx == 0) {
fputc('{', fp);
fputc('\n', fp);
dns_c_printtabs(fp, indent);
fprintf(fp, "/* no ip addresses defined */\n");
dns_c_printtabs(fp, indent - 1);
fputc('}', fp);
} else {
if (porttoo) {
port = isc_sockaddr_getport(&list->ips[0]);
for (i = 0 ; i < list->nextidx ; i++) {
tmpport = isc_sockaddr_getport(&list->ips[i]);
if (tmpport != port) {
athead = ISC_FALSE;
}
}
if (athead) {
fprintf(fp, "port %d ", port);
}
}
fputc('{', fp);
fputc('\n', fp);
for (i = 0 ; i < list->nextidx ; i++) {
dns_c_printtabs(fp, indent);
dns_c_print_ipaddr(fp, &list->ips[i]);
if (!athead) {
fprintf(fp, " port %d",
isc_sockaddr_getport(&list->ips[i]));
}
fprintf(fp, ";\n");
}
dns_c_printtabs(fp, indent - 1);
fputc('}', fp);
}
dns_c_printtabs(fp, indent - 1);
fprintf(fp, "}");
fputc('\n', fp);
}
void
dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list)
{
dns_c_iplist_printfully(fp, indent, ISC_FALSE, list);
}
......
......@@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.70 2000/05/02 17:56:39 brister Exp $ */
/* $Id: confparser.y,v 1.71 2000/05/03 19:29:38 brister Exp $ */
#include <config.h>
......@@ -116,6 +116,7 @@ static isc_lexspecials_t specials;
static isc_result_t tmpres;
static isc_boolean_t disabled; /* if "disabled" keyword was in zone */
static int debug_lexer;
static int yylex(void);
......@@ -255,6 +256,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%token L_DENY
%token L_DIALUP
%token L_DIRECTORY
%token L_DISABLED
%token L_DUMP_FILE
%token L_DYNAMIC
%token L_END_INCLUDE
......@@ -926,10 +928,10 @@ option: /* Empty */
YYABORT;
}
}
| L_ALSO_NOTIFY L_LBRACE notify_in_addr_list L_RBRACE
| L_ALSO_NOTIFY port_ip_list
{
tmpres = dns_c_ctx_setalsonotify(currcfg, $3);
dns_c_iplist_detach(&$3);
tmpres = dns_c_ctx_setalsonotify(currcfg, $2);
dns_c_iplist_detach(&$2);
if (tmpres == ISC_R_EXISTS) {
parser_warning(ISC_FALSE, "redefining also-notify.");
......@@ -3730,6 +3732,8 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
{
dns_c_zone_t *zone;
disabled = ISC_FALSE;
if (currcfg->zlist == NULL) {
tmpres = dns_c_zonelist_new(currcfg->mem,
&currcfg->zlist);
......@@ -3774,19 +3778,29 @@ zone_stmt: L_ZONE domain_name optional_class L_LBRACE L_TYPE zone_type L_EOS
} optional_zone_options_list L_RBRACE {
dns_c_zone_t *zone;
dns_c_view_t *view;
zone = dns_c_ctx_getcurrzone(currcfg);
view = dns_c_ctx_getcurrview(currcfg);
zone->view = view;
if (disabled) {
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
DNS_LOGMODULE_CONFIG,
ISC_LOG_WARNING, "zone '%s' is disabled",
zone->name);
dns_c_zonelist_rmzone(currcfg->zlist, zone);
zone = NULL;
} else {
zone->view = view;
if (view != NULL) {
dns_c_view_addzone(view, zone);
if (view != NULL) {
dns_c_view_addzone(view, zone);
}
}
dns_c_ctx_setcurrzone(currcfg, NULL);
if (callbacks != NULL && callbacks->zonecbk != NULL) {
if (zone != NULL &&
callbacks != NULL && callbacks->zonecbk != NULL) {
tmpres = callbacks->zonecbk(currcfg,
zone,
view,
......@@ -3910,7 +3924,8 @@ zone_non_type_keywords: L_FILE | L_FILE_IXFR | L_IXFR_TMP | L_MASTERS |
L_TCP_CLIENTS | L_RECURSIVE_CLIENTS | L_UPDATE_POLICY | L_DENY |
L_MAX_TRANSFER_TIME_OUT | L_MAX_TRANSFER_IDLE_IN |
L_MAX_TRANSFER_IDLE_OUT | L_MAX_LOG_SIZE_IXFR | L_NOTIFY |
L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP
L_MAINTAIN_IXFR_BASE | L_PUBKEY | L_ALSO_NOTIFY | L_DIALUP |
L_DISABLED
;
......@@ -4316,14 +4331,13 @@ zone_option: L_FILE L_QSTRING
isc_mem_free(memctx, $5);
}
| L_ALSO_NOTIFY L_LBRACE notify_in_addr_list L_RBRACE
| L_ALSO_NOTIFY port_ip_list
{
dns_c_zone_t *zone = dns_c_ctx_getcurrzone(currcfg);
INSIST(zone != NULL);
tmpres = dns_c_zone_setalsonotify(zone, $3,
ISC_FALSE);
tmpres = dns_c_zone_setalsonotify(zone, $2, ISC_FALSE);
if (tmpres == ISC_R_EXISTS) {
parser_warning(ISC_FALSE,
"redefining zone also-notify.");
......@@ -4349,6 +4363,10 @@ zone_option: L_FILE L_QSTRING
YYABORT;
}
}
| L_DISABLED
{
disabled = ISC_TRUE;
}
| zone_update_policy
;
......@@ -4600,6 +4618,7 @@ static struct token keyword_tokens [] = {
{ "default", L_DEFAULT },
{ "dialup", L_DIALUP },
{ "directory", L_DIRECTORY },
{ "disabled", L_DISABLED },
{ "dump-file", L_DUMP_FILE },
{ "dynamic", L_DYNAMIC },
{ "expert-mode", L_EXPERT_MODE },
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confview.c,v 1.24 2000/04/28 01:10:38 halley Exp $ */
/* $Id: confview.c,v 1.25 2000/05/03 19:29:39 brister Exp $ */
#include <config.h>
......@@ -1040,11 +1040,9 @@ dns_c_view_getordering(dns_c_view_t *view,
isc_result_t
dns_c_view_unsetordering(dns_c_view_t *view,
dns_c_rrsolist_t **olist)
dns_c_view_unsetordering(dns_c_view_t *view)
{
REQUIRE(DNS_C_VIEW_VALID(view));
REQUIRE(olist != NULL);
if (view->ordering != NULL) {
dns_c_rrsolist_delete(&view->ordering);
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confzone.c,v 1.37 2000/04/28 01:10:40 halley Exp $ */
/* $Id: confzone.c,v 1.38 2000/05/03 19:29:41 brister Exp $ */
#include <config.h>
......@@ -340,6 +340,8 @@ dns_c_zonelist_rmzone(dns_c_zonelist_t *zlist,
if (zone == zoneelem->thezone) {
break;
}
zoneelem = ISC_LIST_NEXT(zoneelem, next);
}
if (zoneelem != NULL) {
......@@ -3365,7 +3367,8 @@ master_zone_print(FILE *fp, int indent,
if (mzone->also_notify != NULL) {
dns_c_printtabs(fp, indent);
fprintf(fp, "also-notify ");
dns_c_iplist_print(fp, indent + 1, mzone->also_notify);
dns_c_iplist_printfully(fp, indent + 1, ISC_TRUE,
mzone->also_notify);
fprintf(fp, ";\n");
}
......@@ -3452,7 +3455,8 @@ slave_zone_print(FILE *fp, int indent,
szone->master_ips->nextidx == 0) {
fprintf(fp, "{ /* none defined */ }");
} else {
dns_c_iplist_print(fp, indent + 1, szone->master_ips);
dns_c_iplist_printfully(fp, indent + 1,
ISC_TRUE, szone->master_ips);
}
fprintf(fp, ";\n");
}
......@@ -3568,7 +3572,8 @@ slave_zone_print(FILE *fp, int indent,
if (szone->also_notify != NULL) {
dns_c_printtabs(fp, indent);
fprintf(fp, "also-notify ");
dns_c_iplist_print(fp, indent + 1, szone->also_notify);
dns_c_iplist_printfully(fp, indent + 1,
ISC_TRUE, szone->also_notify);
fprintf(fp, ";\n");
}
......@@ -3603,7 +3608,8 @@ stub_zone_print(FILE *fp, int indent, dns_c_stubzone_t *tzone)
tzone->master_ips->nextidx == 0) {
fprintf(fp, "{ /* none defined */ }");
} else {
dns_c_iplist_print(fp, indent + 1, tzone->master_ips);
dns_c_iplist_printfully(fp, indent + 1,
ISC_TRUE, tzone->master_ips);
}
fprintf(fp, ";\n");
}
......
......@@ -246,6 +246,10 @@ dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr);
void
dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list);
void
dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo,
dns_c_iplist_t *list);
isc_boolean_t
dns_c_iplist_equal(dns_c_iplist_t *list1, dns_c_iplist_t *list2);
......
......@@ -323,7 +323,7 @@ dns_c_view_setordering(dns_c_view_t *view, isc_boolean_t copy,
dns_c_rrsolist_t *olist);
isc_result_t
dns_c_view_unsetordering(dns_c_view_t *view, dns_c_rrsolist_t **olist);
dns_c_view_unsetordering(dns_c_view_t *view);
isc_result_t
dns_c_view_setchecknames(dns_c_view_t *view, dns_c_trans_t transtype,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment