mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
apply the modified style
This commit is contained in:
@@ -67,20 +67,20 @@
|
||||
goto cleanup; \
|
||||
} while (0)
|
||||
|
||||
#define ERR_IS_CNAME 1
|
||||
#define ERR_NO_ADDRESSES 2
|
||||
#define ERR_IS_CNAME 1
|
||||
#define ERR_NO_ADDRESSES 2
|
||||
#define ERR_LOOKUP_FAILURE 3
|
||||
#define ERR_EXTRA_A 4
|
||||
#define ERR_EXTRA_AAAA 5
|
||||
#define ERR_MISSING_GLUE 5
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
#define ERR_EXTRA_A 4
|
||||
#define ERR_EXTRA_AAAA 5
|
||||
#define ERR_MISSING_GLUE 5
|
||||
#define ERR_IS_MXCNAME 6
|
||||
#define ERR_IS_SRVCNAME 7
|
||||
|
||||
static const char *dbtype[] = { "rbt" };
|
||||
|
||||
int debug = 0;
|
||||
int debug = 0;
|
||||
const char *journal = NULL;
|
||||
bool nomerge = true;
|
||||
bool nomerge = true;
|
||||
#if CHECK_LOCAL
|
||||
bool docheckmx = true;
|
||||
bool dochecksrv = true;
|
||||
@@ -107,20 +107,18 @@ static isc_logcategory_t categories[] = { { "", 0 },
|
||||
{ NULL, 0 } };
|
||||
|
||||
static isc_symtab_t *symtab = NULL;
|
||||
static isc_mem_t * sym_mctx;
|
||||
static isc_mem_t *sym_mctx;
|
||||
|
||||
static void
|
||||
freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg)
|
||||
{
|
||||
freekey(char *key, unsigned int type, isc_symvalue_t value, void *userarg) {
|
||||
UNUSED(type);
|
||||
UNUSED(value);
|
||||
isc_mem_free(userarg, key);
|
||||
}
|
||||
|
||||
static void
|
||||
add(char *key, int value)
|
||||
{
|
||||
isc_result_t result;
|
||||
add(char *key, int value) {
|
||||
isc_result_t result;
|
||||
isc_symvalue_t symvalue;
|
||||
|
||||
if (sym_mctx == NULL) {
|
||||
@@ -146,8 +144,7 @@ add(char *key, int value)
|
||||
}
|
||||
|
||||
static bool
|
||||
logged(char *key, int value)
|
||||
{
|
||||
logged(char *key, int value) {
|
||||
isc_result_t result;
|
||||
|
||||
if (symtab == NULL) {
|
||||
@@ -163,19 +160,18 @@ logged(char *key, int value)
|
||||
|
||||
static bool
|
||||
checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa)
|
||||
{
|
||||
dns_rdataset_t *a, dns_rdataset_t *aaaa) {
|
||||
dns_rdataset_t *rdataset;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
char addrbuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
|
||||
bool answer = true;
|
||||
bool match;
|
||||
const char *type;
|
||||
void * ptr = NULL;
|
||||
int result;
|
||||
void *ptr = NULL;
|
||||
int result;
|
||||
|
||||
REQUIRE(a == NULL || !dns_rdataset_isassociated(a) ||
|
||||
a->type == dns_rdatatype_a);
|
||||
@@ -216,7 +212,8 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0 &&
|
||||
!logged(namebuf, ERR_IS_CNAME)) {
|
||||
!logged(namebuf, ERR_IS_CNAME))
|
||||
{
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"%s/NS '%s' (out of zone) "
|
||||
"is a CNAME '%s' (illegal)",
|
||||
@@ -350,8 +347,8 @@ checkmissing:
|
||||
}
|
||||
while (result == ISC_R_SUCCESS && !match) {
|
||||
dns_rdataset_current(rdataset, &rdata);
|
||||
if (memcmp(ptr, rdata.data, rdata.length) ==
|
||||
0) {
|
||||
if (memcmp(ptr, rdata.data, rdata.length) == 0)
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
dns_rdata_reset(&rdata);
|
||||
@@ -379,14 +376,13 @@ checkmissing:
|
||||
}
|
||||
|
||||
static bool
|
||||
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner)
|
||||
{
|
||||
checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
int result;
|
||||
int level = ISC_LOG_ERROR;
|
||||
bool answer = true;
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
int result;
|
||||
int level = ISC_LOG_ERROR;
|
||||
bool answer = true;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
@@ -417,7 +413,8 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner)
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0) {
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0)
|
||||
{
|
||||
if ((zone_options & DNS_ZONEOPT_WARNMXCNAME) != 0) {
|
||||
level = ISC_LOG_WARNING;
|
||||
}
|
||||
@@ -465,14 +462,13 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner)
|
||||
}
|
||||
|
||||
static bool
|
||||
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner)
|
||||
{
|
||||
checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
|
||||
struct addrinfo hints, *ai, *cur;
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
int result;
|
||||
int level = ISC_LOG_ERROR;
|
||||
bool answer = true;
|
||||
char namebuf[DNS_NAME_FORMATSIZE + 1];
|
||||
char ownerbuf[DNS_NAME_FORMATSIZE];
|
||||
int result;
|
||||
int level = ISC_LOG_ERROR;
|
||||
bool answer = true;
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
@@ -503,7 +499,8 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner)
|
||||
cur = cur->ai_next;
|
||||
}
|
||||
if (cur != NULL && cur->ai_canonname != NULL &&
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0) {
|
||||
strcasecmp(cur->ai_canonname, namebuf) != 0)
|
||||
{
|
||||
if ((zone_options & DNS_ZONEOPT_WARNSRVCNAME) != 0) {
|
||||
level = ISC_LOG_WARNING;
|
||||
}
|
||||
@@ -551,11 +548,10 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner)
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp)
|
||||
{
|
||||
setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp) {
|
||||
isc_logdestination_t destination;
|
||||
isc_logconfig_t * logconfig = NULL;
|
||||
isc_log_t * log = NULL;
|
||||
isc_logconfig_t *logconfig = NULL;
|
||||
isc_log_t *log = NULL;
|
||||
|
||||
RUNTIME_CHECK(isc_log_create(mctx, &log, &logconfig) == ISC_R_SUCCESS);
|
||||
isc_log_registercategories(log, categories);
|
||||
@@ -581,17 +577,16 @@ setup_logging(isc_mem_t *mctx, FILE *errout, isc_log_t **logp)
|
||||
|
||||
/*% scan the zone for oversize TTLs */
|
||||
static isc_result_t
|
||||
check_ttls(dns_zone_t *zone, dns_ttl_t maxttl)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_db_t * db = NULL;
|
||||
dns_dbversion_t * version = NULL;
|
||||
dns_dbnode_t * node = NULL;
|
||||
dns_dbiterator_t * dbiter = NULL;
|
||||
check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
|
||||
isc_result_t result;
|
||||
dns_db_t *db = NULL;
|
||||
dns_dbversion_t *version = NULL;
|
||||
dns_dbnode_t *node = NULL;
|
||||
dns_dbiterator_t *dbiter = NULL;
|
||||
dns_rdatasetiter_t *rdsiter = NULL;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t * name;
|
||||
dns_rdataset_t rdataset;
|
||||
dns_fixedname_t fname;
|
||||
dns_name_t *name;
|
||||
name = dns_fixedname_initname(&fname);
|
||||
dns_rdataset_init(&rdataset);
|
||||
|
||||
@@ -602,7 +597,8 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl)
|
||||
CHECK(dns_db_createiterator(db, 0, &dbiter));
|
||||
|
||||
for (result = dns_dbiterator_first(dbiter); result == ISC_R_SUCCESS;
|
||||
result = dns_dbiterator_next(dbiter)) {
|
||||
result = dns_dbiterator_next(dbiter))
|
||||
{
|
||||
result = dns_dbiterator_current(dbiter, &node, name);
|
||||
if (result == DNS_R_NEWORIGIN) {
|
||||
result = ISC_R_SUCCESS;
|
||||
@@ -612,11 +608,12 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl)
|
||||
CHECK(dns_db_allrdatasets(db, node, version, 0, &rdsiter));
|
||||
for (result = dns_rdatasetiter_first(rdsiter);
|
||||
result == ISC_R_SUCCESS;
|
||||
result = dns_rdatasetiter_next(rdsiter)) {
|
||||
result = dns_rdatasetiter_next(rdsiter))
|
||||
{
|
||||
dns_rdatasetiter_current(rdsiter, &rdataset);
|
||||
if (rdataset.ttl > maxttl) {
|
||||
char nbuf[DNS_NAME_FORMATSIZE];
|
||||
char tbuf[255];
|
||||
char nbuf[DNS_NAME_FORMATSIZE];
|
||||
char tbuf[255];
|
||||
isc_buffer_t b;
|
||||
isc_region_t r;
|
||||
|
||||
@@ -672,15 +669,14 @@ cleanup:
|
||||
isc_result_t
|
||||
load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
|
||||
dns_masterformat_t fileformat, const char *classname,
|
||||
dns_ttl_t maxttl, dns_zone_t **zonep)
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_ttl_t maxttl, dns_zone_t **zonep) {
|
||||
isc_result_t result;
|
||||
dns_rdataclass_t rdclass;
|
||||
isc_textregion_t region;
|
||||
isc_buffer_t buffer;
|
||||
dns_fixedname_t fixorigin;
|
||||
dns_name_t * origin;
|
||||
dns_zone_t * zone = NULL;
|
||||
isc_buffer_t buffer;
|
||||
dns_fixedname_t fixorigin;
|
||||
dns_name_t *origin;
|
||||
dns_zone_t *zone = NULL;
|
||||
|
||||
REQUIRE(zonep == NULL || *zonep == NULL);
|
||||
|
||||
@@ -751,11 +747,10 @@ cleanup:
|
||||
isc_result_t
|
||||
dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
dns_masterformat_t fileformat, const dns_master_style_t *style,
|
||||
const uint32_t rawversion)
|
||||
{
|
||||
const uint32_t rawversion) {
|
||||
isc_result_t result;
|
||||
FILE * output = stdout;
|
||||
const char * flags;
|
||||
FILE *output = stdout;
|
||||
const char *flags;
|
||||
|
||||
flags = (fileformat == dns_masterformat_text) ? "w" : "wb";
|
||||
|
||||
@@ -791,11 +786,10 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
|
||||
|
||||
#ifdef _WIN32
|
||||
void
|
||||
InitSockets(void)
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
InitSockets(void) {
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
int err;
|
||||
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
|
||||
@@ -807,8 +801,7 @@ InitSockets(void)
|
||||
}
|
||||
|
||||
void
|
||||
DestroySockets(void)
|
||||
{
|
||||
DestroySockets(void) {
|
||||
WSACleanup();
|
||||
}
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
Reference in New Issue
Block a user