mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-05 00:55:24 +00:00
Replace use of private config type user for server statement with new
dns_peer_t. Support two forms of server key statement: keys "blah"; keys { "foo" ; }; Non longer build confserv.c
This commit is contained in:
@@ -38,7 +38,7 @@ CONFOBJS = config/confacl.@O@ config/confcache.@O@ config/confcommon.@O@ \
|
||||
config/conflog.@O@ config/conflsn.@O@ \
|
||||
config/confparser.@O@ config/confresolv.@O@ \
|
||||
config/confrrset.@O@ \
|
||||
config/confserv.@O@ config/confview.@O@ config/confzone.@O@
|
||||
config/confview.@O@ config/confzone.@O@
|
||||
|
||||
DSTOBJS = sec/dst/bsafe_link.@O@ sec/dst/dst_api.@O@ \
|
||||
sec/dst/dst_parse.@O@ sec/dst/hmac_link.@O@ \
|
||||
@@ -119,7 +119,7 @@ OBJS = a6.@O@ acl.@O@ aclconf.@O@ adb.@O@ byaddr.@O@ \
|
||||
db.@O@ dbiterator.@O@ dbtable.@O@ dispatch.@O@ dnssec.@O@ \
|
||||
journal.@O@ keytable.@O@ lib.@O@ log.@O@ \
|
||||
master.@O@ masterdump.@O@ message.@O@ \
|
||||
name.@O@ ncache.@O@ nxt.@O@ \
|
||||
name.@O@ ncache.@O@ nxt.@O@ peer.@O@ \
|
||||
rbt.@O@ rbtdb.@O@ rbtdb64.@O@ rdata.@O@ rdatalist.@O@ \
|
||||
rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ resolver.@O@ \
|
||||
result.@O@ rootns.@O@ ssu.@O@ \
|
||||
@@ -134,7 +134,7 @@ SRCS = a6.c acl.c aclconf.c adb.c byaddr.c \
|
||||
db.c dbiterator.c dbtable.c dispatch.c dnssec.c \
|
||||
journal.c keytable.c lib.c log.c \
|
||||
master.c masterdump.c message.c \
|
||||
name.c ncache.c nxt.c \
|
||||
name.c ncache.c nxt.c peer.c \
|
||||
rbt.c rbtdb.c rbtdb64.c rdata.c rdatalist.c \
|
||||
rdataset.c rdatasetiter.c rdataslab.c resolver.c \
|
||||
result.c rootns.c ssu.c \
|
||||
|
@@ -34,12 +34,12 @@ LIBS = @LIBS@
|
||||
|
||||
OBJS = confparser.@O@ confcommon.@O@ confacl.@O@ confcache.@O@ \
|
||||
confctl.@O@ confctx.@O@ confip.@O@ confkeys.@O@ conflog.@O@ \
|
||||
conflsn.@O@ confresolv.@O@ confrrset.@O@ confserv.@O@ \
|
||||
conflsn.@O@ confresolv.@O@ confrrset.@O@ \
|
||||
confview.@O@ confzone.@O@
|
||||
|
||||
SRCS = confparser.c confcommon.c confacl.c confcache.c \
|
||||
confctl.c confctx.c confip.c confkeys.c conflog.c \
|
||||
conflsn.c confresolv.c confrrset.c confserv.c \
|
||||
conflsn.c confresolv.c confrrset.c \
|
||||
confview.c confzone.c
|
||||
|
||||
SUBDIRS =
|
||||
|
@@ -153,8 +153,7 @@ dns_c_acltable_getacl(dns_c_acltable_t *table,
|
||||
REQUIRE(DNS_C_CONFACLTABLE_VALID(table));
|
||||
REQUIRE(retval != NULL);
|
||||
REQUIRE(aclname != NULL);
|
||||
REQUIRE(strlen(aclname) > 0);
|
||||
|
||||
REQUIRE(*aclname != '\0');
|
||||
|
||||
elem = ISC_LIST_HEAD(table->acl_list);
|
||||
while (elem != NULL) {
|
||||
@@ -207,7 +206,7 @@ dns_c_acl_new(dns_c_acltable_t *table, const char *aclname,
|
||||
|
||||
REQUIRE(DNS_C_CONFACLTABLE_VALID(table));
|
||||
REQUIRE(aclname != NULL);
|
||||
REQUIRE(strlen(aclname) > 0);
|
||||
REQUIRE(*aclname != '\0');
|
||||
REQUIRE(newacl != NULL);
|
||||
|
||||
acl = isc_mem_get(table->mem, sizeof *acl);
|
||||
|
@@ -26,6 +26,10 @@
|
||||
|
||||
#include <isc/assertions.h>
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/magic.h>
|
||||
|
||||
#include <dns/name.h>
|
||||
#include <dns/peer.h>
|
||||
|
||||
/* XXX this next include is needed by <dns/rdataclass.h> */
|
||||
#include <dns/result.h>
|
||||
@@ -533,6 +537,58 @@ dns_c_print_ipaddr(FILE *fp, isc_sockaddr_t *inaddr)
|
||||
}
|
||||
|
||||
|
||||
isc_boolean_t
|
||||
dns_c_netaddrisanyaddr(isc_netaddr_t *inaddr)
|
||||
{
|
||||
isc_boolean_t result = ISC_FALSE;
|
||||
|
||||
if (inaddr->family == AF_INET) {
|
||||
if (inaddr->type.in.s_addr == htonl(INADDR_ANY)) {
|
||||
result = ISC_TRUE;
|
||||
}
|
||||
} else {
|
||||
if (memcmp(&inaddr->type.in6,
|
||||
&in6addr_any, sizeof in6addr_any) == 0) {
|
||||
result = ISC_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
dns_c_netaddrprint(FILE *fp, isc_netaddr_t *inaddr)
|
||||
{
|
||||
const char *p;
|
||||
char tmpaddrstr[64];
|
||||
int family = inaddr->family;
|
||||
void *addr;
|
||||
|
||||
if (dns_c_netaddrisanyaddr(inaddr)) {
|
||||
if (family == AF_INET) {
|
||||
fprintf(fp, "*");
|
||||
} else {
|
||||
fprintf(fp, "0::0");
|
||||
}
|
||||
} else {
|
||||
addr = (family == AF_INET ?
|
||||
(void *)&inaddr->type.in :
|
||||
(void *)&inaddr->type.in6);
|
||||
|
||||
p = inet_ntop(family, addr, tmpaddrstr, sizeof tmpaddrstr);
|
||||
if (p == NULL) {
|
||||
fprintf(fp, "BAD-IP-ADDRESS");
|
||||
} else {
|
||||
fprintf(fp, "%s", tmpaddrstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
isc_boolean_t
|
||||
dns_c_need_quote(const char *string)
|
||||
{
|
||||
@@ -551,3 +607,124 @@ dns_c_need_quote(const char *string)
|
||||
|
||||
|
||||
|
||||
void
|
||||
dns_peerlist_print(FILE *fp, int indent,
|
||||
dns_peerlist_t *servers)
|
||||
{
|
||||
dns_peer_t *server;
|
||||
|
||||
REQUIRE(fp != NULL);
|
||||
REQUIRE(DNS_PEERLIST_VALID(servers));
|
||||
|
||||
server = ISC_LIST_HEAD(servers->elements);
|
||||
while (server != NULL) {
|
||||
dns_peer_print(fp, indent, server);
|
||||
server = ISC_LIST_NEXT(server, next);
|
||||
if (server != NULL) {
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dns_peer_print(FILE *fp, int indent, dns_peer_t *peer)
|
||||
{
|
||||
isc_boolean_t bval;
|
||||
isc_result_t res;
|
||||
dns_transfer_format_t tval;
|
||||
isc_int32_t ival;
|
||||
dns_name_t *name = NULL;
|
||||
|
||||
REQUIRE(DNS_PEER_VALID(peer));
|
||||
REQUIRE(fp != NULL);
|
||||
|
||||
dns_c_printtabs(fp, indent);
|
||||
fprintf(fp, "server ");
|
||||
dns_c_netaddrprint(fp, &peer->address);
|
||||
fprintf(fp, " {\n");
|
||||
|
||||
res = dns_peer_getbogus(peer, &bval);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
dns_c_printtabs(fp, indent + 1);
|
||||
fprintf(fp, "bogus %s;\n", (bval ? "true" : "false"));
|
||||
}
|
||||
|
||||
res = dns_peer_gettransferformat(peer, &tval);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
dns_c_printtabs(fp, indent + 1);
|
||||
fprintf(fp, "transfer-format %s;\n",
|
||||
dns_c_transformat2string(tval, ISC_TRUE));
|
||||
}
|
||||
|
||||
res = dns_peer_gettransfers(peer, &ival);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
dns_c_printtabs(fp, indent + 1);
|
||||
fprintf(fp, "transfers %d;\n", ival);
|
||||
}
|
||||
|
||||
res = dns_peer_getsupportixfr(peer, &bval);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
dns_c_printtabs(fp, indent + 1);
|
||||
fprintf(fp, "support-ixfr %s;\n", (bval ? "true" : "false"));
|
||||
}
|
||||
|
||||
res = dns_peer_getkey(peer, &name);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
REQUIRE(name != NULL);
|
||||
dns_c_printtabs(fp, indent + 1);
|
||||
fprintf(fp, "key { \"");
|
||||
dns_name_print(peer->key, fp);
|
||||
fprintf(fp, "\"; };\n");
|
||||
}
|
||||
|
||||
dns_c_printtabs(fp, indent);
|
||||
fprintf(fp, "};\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
isc_result_t
|
||||
dns_c_charptoname(isc_mem_t *mem, const char *keyval, dns_name_t **name)
|
||||
{
|
||||
dns_name_t newkey;
|
||||
isc_buffer_t *b1 = NULL;
|
||||
isc_buffer_t b2;
|
||||
isc_result_t res;
|
||||
unsigned int len;
|
||||
|
||||
REQUIRE(keyval != NULL);
|
||||
REQUIRE(*keyval != '\0');
|
||||
REQUIRE(name != NULL);
|
||||
|
||||
len = strlen(keyval);
|
||||
|
||||
dns_name_init(&newkey, NULL);
|
||||
res = isc_buffer_allocate(mem, &b1, len + 2,
|
||||
ISC_BUFFERTYPE_BINARY);
|
||||
REQUIRE(res == ISC_R_SUCCESS);
|
||||
|
||||
dns_name_setbuffer(&newkey, b1);
|
||||
|
||||
isc_buffer_init(&b2, (char *)keyval, len, ISC_BUFFERTYPE_TEXT);
|
||||
isc_buffer_add(&b2, len);
|
||||
|
||||
res = dns_name_fromtext(&newkey, &b2, NULL, ISC_FALSE, NULL);
|
||||
if (res != ISC_R_SUCCESS) {
|
||||
return (res);
|
||||
}
|
||||
|
||||
*name = isc_mem_get(mem, sizeof (dns_name_t));
|
||||
REQUIRE(*name != NULL);
|
||||
dns_name_init(*name, NULL);
|
||||
|
||||
dns_name_dup(&newkey, mem, *name);
|
||||
dns_name_invalidate(&newkey);
|
||||
isc_buffer_free(&b1);
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
|
@@ -319,7 +319,7 @@ dns_c_ctx_new(isc_mem_t *mem, dns_c_ctx_t **ctx)
|
||||
cfg->acls = NULL;
|
||||
cfg->options = NULL;
|
||||
cfg->zlist = NULL;
|
||||
cfg->servers = NULL;
|
||||
cfg->peers = NULL;
|
||||
cfg->acls = NULL;
|
||||
cfg->keydefs = NULL;
|
||||
cfg->trusted_keys = NULL;
|
||||
@@ -377,8 +377,8 @@ dns_c_ctx_delete(dns_c_ctx_t **cfg)
|
||||
if (c->controls != NULL)
|
||||
dns_c_ctrllist_delete(&c->controls);
|
||||
|
||||
if (c->servers != NULL)
|
||||
dns_c_srvlist_delete(&c->servers);
|
||||
if (c->peers != NULL)
|
||||
dns_peerlist_detach(&c->peers);
|
||||
|
||||
if (c->acls != NULL)
|
||||
dns_c_acltable_delete(&c->acls);
|
||||
@@ -546,8 +546,8 @@ dns_c_ctx_print(FILE *fp, int indent, dns_c_ctx_t *cfg)
|
||||
}
|
||||
|
||||
|
||||
if (cfg->servers != NULL) {
|
||||
dns_c_srvlist_print(fp, indent, cfg->servers);
|
||||
if (cfg->peers != NULL) {
|
||||
dns_peerlist_print(fp, indent, cfg->peers);
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
}
|
||||
@@ -811,7 +811,7 @@ dns_c_ctx_channeldefinedp(dns_c_ctx_t *cfg, const char *name)
|
||||
|
||||
REQUIRE(DNS_C_CONFCTX_VALID(cfg));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
res = dns_c_logginglist_chanbyname(cfg->logging, name, &chan);
|
||||
|
||||
@@ -3797,7 +3797,7 @@ dns_c_ctx_keydefinedp(dns_c_ctx_t *ctx, const char *keyname)
|
||||
|
||||
REQUIRE(DNS_C_CONFCTX_VALID(ctx));
|
||||
REQUIRE(keyname != NULL);
|
||||
REQUIRE(strlen(keyname) > 0);
|
||||
REQUIRE(*keyname != '\0');
|
||||
|
||||
if (ctx->keydefs != NULL) {
|
||||
res = dns_c_kdeflist_find(ctx->keydefs, keyname, &keyid);
|
||||
|
@@ -421,7 +421,7 @@ dns_c_ipmatch_aclnew(isc_mem_t *mem,
|
||||
REQUIRE(result != NULL);
|
||||
REQUIRE(mem != NULL);
|
||||
REQUIRE(aclname != NULL);
|
||||
REQUIRE(strlen(aclname) > 0);
|
||||
REQUIRE(*aclname != '\0');
|
||||
|
||||
*result = NULL;
|
||||
|
||||
|
@@ -153,7 +153,7 @@ dns_c_kdeflist_undef(dns_c_kdeflist_t *list, const char *keyid)
|
||||
|
||||
REQUIRE(DNS_C_KDEFLIST_VALID(list));
|
||||
REQUIRE(keyid != NULL);
|
||||
REQUIRE(strlen(keyid) > 0);
|
||||
REQUIRE(*keyid != '\0');
|
||||
|
||||
kd = ISC_LIST_HEAD(list->keydefs);
|
||||
while (kd != NULL) {
|
||||
@@ -184,7 +184,7 @@ dns_c_kdeflist_find(dns_c_kdeflist_t *list, const char *keyid,
|
||||
|
||||
REQUIRE(DNS_C_KDEFLIST_VALID(list));
|
||||
REQUIRE(keyid != NULL);
|
||||
REQUIRE(strlen(keyid) > 0);
|
||||
REQUIRE(*keyid != '\0');
|
||||
|
||||
kd = ISC_LIST_HEAD(list->keydefs);
|
||||
while (kd != NULL) {
|
||||
@@ -237,7 +237,7 @@ dns_c_kdef_new(dns_c_kdeflist_t *list, const char *name,
|
||||
REQUIRE(DNS_C_KDEFLIST_VALID(list));
|
||||
REQUIRE(keyid != NULL);
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
kd = isc_mem_get(list->mem, sizeof *kd);
|
||||
if (kd == NULL) {
|
||||
@@ -372,7 +372,7 @@ dns_c_kdef_setalgorithm(dns_c_kdef_t *keydef, const char *algorithm)
|
||||
{
|
||||
REQUIRE(DNS_C_KDEF_VALID(keydef));
|
||||
REQUIRE(algorithm != NULL);
|
||||
REQUIRE(strlen(algorithm) > 0);
|
||||
REQUIRE(*algorithm != '\0');
|
||||
|
||||
if (keydef->algorithm != NULL) {
|
||||
isc_mem_free(keydef->mylist->mem, keydef->algorithm);
|
||||
@@ -393,7 +393,7 @@ dns_c_kdef_setsecret(dns_c_kdef_t *keydef, const char *secret)
|
||||
{
|
||||
REQUIRE(DNS_C_KDEF_VALID(keydef));
|
||||
REQUIRE(secret != NULL);
|
||||
REQUIRE(strlen(secret) > 0);
|
||||
REQUIRE(*secret != '\0');
|
||||
|
||||
if (keydef->secret != NULL) {
|
||||
isc_mem_free(keydef->mylist->mem, keydef->secret);
|
||||
@@ -490,7 +490,7 @@ dns_c_kidlist_undef(dns_c_kidlist_t *list, const char *keyid)
|
||||
|
||||
REQUIRE(DNS_C_KEYIDLIST_VALID(list));
|
||||
REQUIRE(keyid != NULL);
|
||||
REQUIRE(strlen(keyid) > 0);
|
||||
REQUIRE(*keyid != '\0');
|
||||
|
||||
dns_c_kidlist_find(list, keyid, &ki);
|
||||
|
||||
@@ -513,7 +513,7 @@ dns_c_kidlist_find(dns_c_kidlist_t *list, const char *keyid,
|
||||
|
||||
REQUIRE(DNS_C_KEYIDLIST_VALID(list));
|
||||
REQUIRE(keyid != NULL);
|
||||
REQUIRE(strlen(keyid) > 0);
|
||||
REQUIRE(*keyid != '\0');
|
||||
REQUIRE(retval != NULL);
|
||||
|
||||
iter = ISC_LIST_HEAD(list->keyids);
|
||||
@@ -576,7 +576,7 @@ dns_c_kid_new(dns_c_kidlist_t *list, const char *name, dns_c_kid_t **keyid)
|
||||
|
||||
REQUIRE(DNS_C_KEYIDLIST_VALID(list));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
REQUIRE(keyid != NULL);
|
||||
|
||||
ki = isc_mem_get(list->mem, sizeof *ki);
|
||||
@@ -743,7 +743,7 @@ dns_c_pklist_rmpubkey(dns_c_pklist_t *list,
|
||||
|
||||
REQUIRE(DNS_C_PKLIST_VALID(list));
|
||||
REQUIRE(key != NULL);
|
||||
REQUIRE(strlen(key) > 0);
|
||||
REQUIRE(*key != '\0');
|
||||
|
||||
r = dns_c_pklist_findpubkey(list, &pk, flags, protocol,
|
||||
algorithm, key);
|
||||
@@ -767,7 +767,7 @@ dns_c_pubkey_new(isc_mem_t *mem, isc_int32_t flags,
|
||||
|
||||
REQUIRE(pubkey != NULL);
|
||||
REQUIRE(key != NULL);
|
||||
REQUIRE(strlen(key) > 0);
|
||||
REQUIRE(*key != '\0');
|
||||
|
||||
pkey = isc_mem_get(mem, sizeof *pkey);
|
||||
if (pkey == NULL) {
|
||||
@@ -1014,9 +1014,9 @@ dns_c_tkey_new(isc_mem_t *mem, const char *domain, isc_int32_t flags,
|
||||
isc_result_t res;
|
||||
|
||||
REQUIRE(domain != NULL);
|
||||
REQUIRE(strlen(domain) > 0);
|
||||
REQUIRE(*domain != '\0');
|
||||
REQUIRE(key != NULL);
|
||||
REQUIRE(strlen(key) > 0);
|
||||
REQUIRE(*key != '\0');
|
||||
REQUIRE(newkey != NULL);
|
||||
|
||||
newk = isc_mem_get(mem, sizeof *newk);
|
||||
|
@@ -347,7 +347,7 @@ dns_c_logginglist_delchannel(dns_c_logginglist_t *list,
|
||||
|
||||
REQUIRE(DNS_C_LOGLIST_VALID(list));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
res = dns_c_logginglist_chanbyname(list, name, &logc);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
@@ -369,7 +369,7 @@ dns_c_logginglist_delcategory(dns_c_logginglist_t *list,
|
||||
|
||||
REQUIRE(DNS_C_LOGLIST_VALID(list));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
res = dns_c_logginglist_catbyname(list, name, &logc);
|
||||
if (res == ISC_R_SUCCESS) {
|
||||
@@ -391,7 +391,7 @@ dns_c_logginglist_chanbyname(dns_c_logginglist_t *list,
|
||||
|
||||
REQUIRE(DNS_C_LOGLIST_VALID(list));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
REQUIRE(chan != NULL);
|
||||
|
||||
logc = ISC_LIST_HEAD(list->channels);
|
||||
@@ -422,7 +422,7 @@ dns_c_logginglist_catbyname(dns_c_logginglist_t *list,
|
||||
|
||||
REQUIRE(DNS_C_LOGLIST_VALID(list));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
REQUIRE(cat != NULL);
|
||||
|
||||
res = dns_c_string2category(name, &cattype);
|
||||
@@ -474,7 +474,7 @@ dns_c_logchan_new(isc_mem_t *mem, const char *name,
|
||||
dns_c_logchan_t *newc;
|
||||
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
REQUIRE(newchan != NULL);
|
||||
|
||||
newc = isc_mem_get(mem, sizeof *newc);
|
||||
@@ -682,7 +682,7 @@ dns_c_logchan_setpath(dns_c_logchan_t *channel, const char *path)
|
||||
|
||||
REQUIRE(DNS_C_LOGCHAN_VALID(channel));
|
||||
REQUIRE(path != NULL);
|
||||
REQUIRE(strlen(path) > 0);
|
||||
REQUIRE(*path != '\0');
|
||||
|
||||
if (channel->ctype != dns_c_logchan_file) {
|
||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_CONFIG,
|
||||
@@ -1217,7 +1217,7 @@ dns_c_logcat_addname(dns_c_logcat_t *logcat, const char *name)
|
||||
|
||||
REQUIRE(DNS_C_LOGCAT_VALID(logcat));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
if (logcat->cnames_len == logcat->nextcname) {
|
||||
size_t newsize = logcat->cnames_len + 5;
|
||||
@@ -1263,7 +1263,7 @@ dns_c_logcat_delname(dns_c_logcat_t *logcat, const char *name)
|
||||
|
||||
REQUIRE(DNS_C_LOGCAT_VALID(logcat));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
for (i = 0 ; i < logcat->nextcname ; i++) {
|
||||
INSIST(logcat->channel_names[i] != NULL);
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SABER)
|
||||
static char rcsid[] = "$Id: confparser.y,v 1.43 2000/02/15 18:24:26 gson Exp $";
|
||||
static char rcsid[] = "$Id: confparser.y,v 1.44 2000/02/24 14:48:19 brister Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <config.h>
|
||||
@@ -328,9 +328,9 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
|
||||
%type <text> any_string
|
||||
%type <text> channel_name
|
||||
%type <text> domain_name
|
||||
%type <text> key_ref
|
||||
%type <text> ordering_name
|
||||
%type <text> secret
|
||||
%type <text> key_value
|
||||
|
||||
%type <tformat> transfer_format
|
||||
|
||||
@@ -2075,47 +2075,42 @@ category_name: any_string
|
||||
|
||||
server_stmt: L_SERVER ip_address
|
||||
{
|
||||
dns_c_srv_t *server;
|
||||
dns_c_srv_t *tmpserver;
|
||||
dns_c_srvlist_t *servers = currcfg->servers;
|
||||
dns_peer_t *peer;
|
||||
dns_peerlist_t *peers = currcfg->peers;
|
||||
isc_netaddr_t netaddr;
|
||||
|
||||
isc_netaddr_fromsockaddr(&netaddr, &$2);
|
||||
|
||||
if (servers == NULL) {
|
||||
tmpres = dns_c_srvlist_new(currcfg->mem,
|
||||
&currcfg->servers);
|
||||
if (peers == NULL) {
|
||||
tmpres = dns_peerlist_new(currcfg->mem,
|
||||
&currcfg->peers);
|
||||
if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"failed to create server list");
|
||||
"failed to create peer list");
|
||||
YYABORT;
|
||||
}
|
||||
servers = currcfg->servers;
|
||||
peers = currcfg->peers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that this IP hasn't already bee used and if it has
|
||||
* remove the old definition.
|
||||
* Check that this IP hasn't already been used.
|
||||
*/
|
||||
server = ISC_LIST_HEAD(servers->elements);
|
||||
while (server != NULL) {
|
||||
tmpserver = ISC_LIST_NEXT(server, next);
|
||||
if (memcmp(&server->address, &$2,
|
||||
sizeof(isc_sockaddr_t)) == 0) {
|
||||
parser_error(ISC_TRUE, "redefining server");
|
||||
ISC_LIST_UNLINK(servers->elements,
|
||||
server, next);
|
||||
dns_c_srv_delete(&server);
|
||||
break;
|
||||
}
|
||||
server = tmpserver;
|
||||
tmpres = dns_peerlist_peerbyaddr(peers, &netaddr, &peer);
|
||||
if (tmpres == ISC_R_SUCCESS) {
|
||||
dns_peer_detach(&peer);
|
||||
parser_error(ISC_TRUE, "redefining peer");
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
tmpres = dns_c_srv_new(currcfg->mem, $2, &server);
|
||||
tmpres = dns_peer_new(currcfg->mem, &netaddr, &peer);
|
||||
if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"failed to create server structure");
|
||||
"failed to create peer structure");
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
ISC_LIST_APPEND(currcfg->servers->elements, server, next);
|
||||
dns_peerlist_addpeer(currcfg->peers, peer);
|
||||
dns_peer_detach(&peer);
|
||||
}
|
||||
L_LBRACE server_info_list L_RBRACE
|
||||
;
|
||||
@@ -2126,97 +2121,123 @@ server_info_list: server_info L_EOS
|
||||
|
||||
server_info: L_BOGUS yea_or_nay
|
||||
{
|
||||
dns_c_srv_t *server;
|
||||
isc_boolean_t tv;
|
||||
|
||||
INSIST(currcfg->servers != NULL);
|
||||
server = ISC_LIST_TAIL(currcfg->servers->elements);
|
||||
dns_peer_t *peer = NULL;
|
||||
|
||||
INSIST(server != NULL);
|
||||
dns_peerlist_currpeer(currcfg->peers, &peer);
|
||||
INSIST(peer != NULL);
|
||||
|
||||
tmpres = dns_c_srv_getbogus(server, &tv);
|
||||
if (tmpres != ISC_R_NOTFOUND) {
|
||||
tmpres = dns_peer_setbogus(peer, $2);
|
||||
dns_peer_detach(&peer);
|
||||
if (tmpres == ISC_R_EXISTS) {
|
||||
parser_warning(ISC_FALSE,
|
||||
"redefining server bogus value");
|
||||
} else if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"error setting server bogus value");
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
dns_c_srv_setbogus(server, $2);
|
||||
}
|
||||
| L_SUPPORT_IXFR yea_or_nay
|
||||
{
|
||||
dns_c_srv_t *server;
|
||||
isc_boolean_t tv;
|
||||
dns_peer_t *peer = NULL;
|
||||
|
||||
INSIST(currcfg->servers != NULL);
|
||||
server = ISC_LIST_TAIL(currcfg->servers->elements);
|
||||
dns_peerlist_currpeer(currcfg->peers, &peer);
|
||||
INSIST(peer != NULL);
|
||||
|
||||
INSIST(server != NULL);
|
||||
|
||||
tmpres = dns_c_srv_getsupportixfr(server, &tv);
|
||||
if(tmpres != ISC_R_NOTFOUND) {
|
||||
tmpres = dns_peer_setsupportixfr(peer, $2);
|
||||
dns_peer_detach(&peer);
|
||||
if (tmpres == ISC_R_EXISTS) {
|
||||
parser_warning(ISC_FALSE,
|
||||
"redefining server support-ixfr value");
|
||||
"redefining peer support-ixfr value");
|
||||
} else if(tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"error setting peer "
|
||||
"support-ixfr value");
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
dns_c_srv_setsupportixfr(server, $2);
|
||||
}
|
||||
| L_TRANSFERS L_INTEGER
|
||||
{
|
||||
dns_c_srv_t *server;
|
||||
isc_int32_t tv;
|
||||
dns_peer_t *peer = NULL;
|
||||
|
||||
INSIST(currcfg->servers != NULL);
|
||||
server = ISC_LIST_TAIL(currcfg->servers->elements);
|
||||
dns_peerlist_currpeer(currcfg->peers, &peer);
|
||||
INSIST(peer != NULL);
|
||||
|
||||
INSIST(server != NULL);
|
||||
|
||||
tmpres = dns_c_srv_gettransfers(server, &tv);
|
||||
if (tmpres != ISC_R_NOTFOUND) {
|
||||
tmpres = dns_peer_settransfers(peer, $2);
|
||||
dns_peer_detach(&peer);
|
||||
if (tmpres == ISC_R_EXISTS) {
|
||||
parser_warning(ISC_FALSE,
|
||||
"redefining server transfers value");
|
||||
"redefining peer transfers value");
|
||||
} else if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"error setting peer transfers value");
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
dns_c_srv_settransfers(server, $2);
|
||||
}
|
||||
| L_TRANSFER_FORMAT transfer_format
|
||||
{
|
||||
dns_c_srv_t *server;
|
||||
dns_transfer_format_t tv;
|
||||
|
||||
INSIST(currcfg->servers != NULL);
|
||||
server = ISC_LIST_TAIL(currcfg->servers->elements);
|
||||
dns_peer_t *peer = NULL;
|
||||
|
||||
INSIST(server != NULL);
|
||||
dns_peerlist_currpeer(currcfg->peers, &peer);
|
||||
INSIST(peer != NULL);
|
||||
|
||||
tmpres = dns_c_srv_gettransferformat(server, &tv);
|
||||
if (tmpres != ISC_R_NOTFOUND) {
|
||||
tmpres = dns_peer_settransferformat(peer, $2);
|
||||
dns_peer_detach(&peer);
|
||||
if (tmpres == ISC_R_EXISTS) {
|
||||
parser_warning(ISC_FALSE,
|
||||
"redefining server transfer-format "
|
||||
"redefining peer transfer-format "
|
||||
"value");
|
||||
} else if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"error setting peer transfer-format "
|
||||
"value");
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| L_KEYS key_value {
|
||||
dns_peer_t *peer;
|
||||
dns_name_t *name = NULL;
|
||||
|
||||
/* XXX need to validate key exists */
|
||||
|
||||
dns_peerlist_currpeer(currcfg->peers, &peer);
|
||||
INSIST(peer != NULL);
|
||||
|
||||
tmpres = dns_c_charptoname(peer->mem, $2, &name);
|
||||
if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"error creating key name value");
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
|
||||
dns_c_srv_settransferformat(server, $2);
|
||||
}
|
||||
| L_KEYS L_LBRACE {
|
||||
dns_c_srv_t *server;
|
||||
|
||||
INSIST(currcfg->servers != NULL);
|
||||
server = ISC_LIST_TAIL(currcfg->servers->elements);
|
||||
INSIST(server != NULL);
|
||||
|
||||
if (server->keys == NULL) {
|
||||
tmpres = dns_c_kidlist_new(currcfg->mem,
|
||||
&server->keys);
|
||||
if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"failed to create keyid_list");
|
||||
YYABORT;
|
||||
}
|
||||
tmpres = dns_peer_setkey(peer, &name);
|
||||
isc_mem_free(memctx, $2);
|
||||
dns_peer_detach(&peer);
|
||||
|
||||
if (tmpres == ISC_R_EXISTS) {
|
||||
parser_warning(ISC_FALSE,
|
||||
"redefining peer key "
|
||||
"value");
|
||||
} else if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"error setting peer key value");
|
||||
YYABORT;
|
||||
}
|
||||
} key_list L_RBRACE
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
key_value: L_LBRACE any_string maybe_eos L_RBRACE
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
| any_string
|
||||
{
|
||||
$$ = $1;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Address Matching
|
||||
*/
|
||||
@@ -2503,49 +2524,6 @@ address_name: any_string
|
||||
* Keys
|
||||
*/
|
||||
|
||||
key_ref: any_string
|
||||
;
|
||||
|
||||
key_list_element: key_ref
|
||||
{
|
||||
dns_c_srv_t *currserver;
|
||||
dns_c_kid_t *keyid;
|
||||
|
||||
INSIST(currcfg->servers != NULL);
|
||||
currserver = ISC_LIST_TAIL(currcfg->servers->elements);
|
||||
INSIST(currserver != NULL);
|
||||
|
||||
INSIST(currserver->keys != NULL);
|
||||
|
||||
if (!dns_c_ctx_keydefinedp(currcfg, $1)) {
|
||||
parser_error(ISC_FALSE,
|
||||
"server keys key_id (%s) "
|
||||
"referenced before defined", $1);
|
||||
YYABORT;
|
||||
} else {
|
||||
tmpres = dns_c_kid_new(currserver->keys, $1, &keyid);
|
||||
if (tmpres != ISC_R_SUCCESS) {
|
||||
parser_error(ISC_FALSE,
|
||||
"failed to create keyid");
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
|
||||
isc_mem_free(memctx, $1);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/*
|
||||
* The grammer in the man page implies a semicolon is not required before
|
||||
* key_list_elements. We'll support either way.
|
||||
*/
|
||||
maybe_eos: | L_EOS
|
||||
;
|
||||
|
||||
key_list: key_list_element maybe_eos
|
||||
| key_list key_list_element maybe_eos
|
||||
;
|
||||
|
||||
key_stmt: L_SEC_KEY any_string
|
||||
{
|
||||
@@ -3689,6 +3667,8 @@ any_string: L_STRING
|
||||
| L_QSTRING
|
||||
;
|
||||
|
||||
maybe_eos: | L_EOS ;
|
||||
|
||||
%%
|
||||
|
||||
static int intuit_token(const char *string);
|
||||
@@ -3899,7 +3879,7 @@ dns_c_parse_namedconf(const char *filename, isc_mem_t *mem,
|
||||
|
||||
REQUIRE(currcfg == NULL);
|
||||
REQUIRE(filename != NULL);
|
||||
REQUIRE(strlen(filename) > 0);
|
||||
REQUIRE(*filename != '\0');
|
||||
REQUIRE(configctx != NULL);
|
||||
INSIST(mylexer == NULL);
|
||||
INSIST(memctx == NULL);
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#if 0 /* XXX FILE IS GONE. */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999, 2000 Internet Software Consortium.
|
||||
*
|
||||
@@ -412,3 +414,4 @@ dns_c_srv_setkeys(dns_c_srv_t *server, dns_c_kidlist_t *newval)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -171,7 +171,7 @@ dns_c_viewtable_viewbyname(dns_c_viewtable_t *viewtable,
|
||||
REQUIRE(DNS_C_VIEWTABLE_VALID(viewtable));
|
||||
REQUIRE(retval != NULL);
|
||||
REQUIRE(viewname != NULL);
|
||||
REQUIRE(strlen(viewname) > 0);
|
||||
REQUIRE(*viewname != '\0');
|
||||
|
||||
elem = ISC_LIST_HEAD(viewtable->views);
|
||||
while (elem != NULL) {
|
||||
@@ -219,7 +219,7 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_c_view_t **newview)
|
||||
|
||||
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
REQUIRE(newview != NULL);
|
||||
|
||||
view = isc_mem_get(mem, sizeof *view);
|
||||
|
@@ -220,7 +220,7 @@ dns_c_zonelist_find(dns_c_zonelist_t *zlist, const char *name,
|
||||
|
||||
REQUIRE(DNS_C_ZONELIST_VALID(zlist));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
REQUIRE(retval != NULL);
|
||||
|
||||
zoneelem = ISC_LIST_HEAD(zlist->zones);
|
||||
@@ -249,7 +249,7 @@ dns_c_zonelist_rmbyname(dns_c_zonelist_t *zlist,
|
||||
|
||||
REQUIRE(DNS_C_ZONELIST_VALID(zlist));
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
zoneelem = ISC_LIST_HEAD(zlist->zones);
|
||||
while (zoneelem != NULL) {
|
||||
@@ -383,7 +383,7 @@ dns_c_zone_new(isc_mem_t *mem,
|
||||
|
||||
REQUIRE(mem != NULL);
|
||||
REQUIRE(name != NULL);
|
||||
REQUIRE(strlen(name) > 0);
|
||||
REQUIRE(*name != '\0');
|
||||
|
||||
newzone = isc_mem_get(mem, sizeof *newzone);
|
||||
if (newzone == NULL) {
|
||||
@@ -527,7 +527,7 @@ dns_c_zone_setfile(dns_c_zone_t *zone, const char *newfile)
|
||||
|
||||
REQUIRE(DNS_C_ZONE_VALID(zone));
|
||||
REQUIRE(newfile != NULL);
|
||||
REQUIRE(strlen(newfile) > 0);
|
||||
REQUIRE(*newfile != '\0');
|
||||
|
||||
switch (zone->ztype) {
|
||||
case dns_c_zone_master:
|
||||
@@ -1029,7 +1029,7 @@ dns_c_zone_setixfrbase(dns_c_zone_t *zone, const char *newval)
|
||||
|
||||
REQUIRE(DNS_C_ZONE_VALID(zone));
|
||||
REQUIRE(newval != NULL);
|
||||
REQUIRE(strlen(newval) > 0);
|
||||
REQUIRE(*newval != '\0');
|
||||
|
||||
switch (zone->ztype) {
|
||||
case dns_c_zone_master:
|
||||
@@ -1083,7 +1083,7 @@ dns_c_zone_setixfrtmp(dns_c_zone_t *zone, const char *newval)
|
||||
|
||||
REQUIRE(DNS_C_ZONE_VALID(zone));
|
||||
REQUIRE(newval != NULL);
|
||||
REQUIRE(strlen(newval) > 0);
|
||||
REQUIRE(*newval != '\0');
|
||||
|
||||
switch (zone->ztype) {
|
||||
case dns_c_zone_master:
|
||||
|
@@ -309,4 +309,12 @@ void dns_c_dataclass_tostream(FILE *fp,
|
||||
void dns_c_datatype_tostream(FILE *fp,
|
||||
dns_rdatatype_t rtype);
|
||||
|
||||
|
||||
isc_boolean_t dns_c_netaddrisanyaddr(isc_netaddr_t *inaddr);
|
||||
void dns_c_netaddrprint(FILE *fp, isc_netaddr_t *inaddr);
|
||||
isc_result_t dns_c_charptoname(isc_mem_t *mem, const char *keyval,
|
||||
dns_name_t **name);
|
||||
|
||||
|
||||
|
||||
#endif /* DNS_CONFIG_CONFCOMMON_H */
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include <isc/int.h>
|
||||
#include <isc/list.h>
|
||||
|
||||
#include <dns/peer.h>
|
||||
#include <dns/confcommon.h>
|
||||
#include <dns/confip.h>
|
||||
#include <dns/confzone.h>
|
||||
@@ -64,7 +65,6 @@
|
||||
#include <dns/conflsn.h>
|
||||
#include <dns/confrrset.h>
|
||||
#include <dns/confctl.h>
|
||||
#include <dns/confserv.h>
|
||||
#include <dns/confview.h>
|
||||
#include <dns/confcache.h>
|
||||
#include <dns/confresolv.h>
|
||||
@@ -101,7 +101,7 @@ struct dns_c_ctx
|
||||
dns_c_cache_t *cache;
|
||||
dns_c_resolv_t *resolver;
|
||||
dns_c_ctrllist_t *controls;
|
||||
dns_c_srvlist_t *servers;
|
||||
dns_peerlist_t *peers;
|
||||
dns_c_acltable_t *acls;
|
||||
dns_c_kdeflist_t *keydefs;
|
||||
dns_c_zonelist_t *zlist;
|
||||
|
@@ -1,3 +1,7 @@
|
||||
#if 1
|
||||
#error "Shouldn't be using this file."
|
||||
#else
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999, 2000 Internet Software Consortium.
|
||||
*
|
||||
@@ -155,3 +159,5 @@ isc_result_t dns_c_srv_setkeys(dns_c_srv_t *server,
|
||||
|
||||
|
||||
#endif /* DNS_CONFIG_CONFSERV_H */
|
||||
|
||||
#endif
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include <dns/conflsn.h>
|
||||
#include <dns/confparser.h>
|
||||
#include <dns/confrrset.h>
|
||||
#include <dns/confserv.h>
|
||||
#include <dns/confzone.h>
|
||||
#include <dns/peer.h>
|
||||
|
||||
#endif
|
||||
|
@@ -56,6 +56,7 @@ typedef isc_uint16_t dns_rcode_t;
|
||||
typedef isc_uint16_t dns_opcode_t;
|
||||
typedef isc_uint16_t dns_cert_t;
|
||||
typedef isc_uint32_t dns_ttl_t;
|
||||
typedef isc_uint64_t dns_bitset_t;
|
||||
typedef struct dns_rdata dns_rdata_t;
|
||||
typedef struct dns_rdatalist dns_rdatalist_t;
|
||||
typedef struct dns_signature dns_signature_t;
|
||||
@@ -229,6 +230,20 @@ typedef isc_result_t
|
||||
typedef void
|
||||
(*dns_xfrindone_t)(dns_zone_t *, isc_result_t);
|
||||
|
||||
|
||||
#ifndef DNS_SETBIT
|
||||
|
||||
/* XXXJAB there must be a better file for these. */
|
||||
|
||||
#define DNS_SETBIT(bit, bitset) \
|
||||
(*(bitset) |= ((dns_bitset_t)1 << (bit)))
|
||||
#define DNS_CLEARBIT(bit, bitset) \
|
||||
(*(bitset) &= ~((dns_bitset_t)1 << (bit)))
|
||||
#define DNS_CHECKBIT(bit, bitset) \
|
||||
ISC_TF((*(bitset) & ((dns_bitset_t)1 << (bit))) == ((dns_bitset_t)1 << (bit)))
|
||||
|
||||
#endif
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* DNS_TYPES_H */
|
||||
|
Reference in New Issue
Block a user