void* nsec3_validate(struct rr *rrv) { RRCAST(nsec3); if (!first_nsec3) { first_nsec3 = rr; } if (latest_nsec3) { if (memcmp(latest_nsec3->next_hashed_owner.data, rr->this_hashed_name.data, 20) != 0) { char *expected_name = quickstrdup_temp(rr->rr.rr_set->named_rr->name); /* guaranteed to have same length, I think */ encode_base32hex(expected_name, 32, latest_nsec3->next_hashed_owner.data, 20); if (rr == first_nsec3) { moan(latest_nsec3->rr.file_name, latest_nsec3->rr.line, "broken NSEC3 chain, expected %s, but nothing found", expected_name); } else { moan(latest_nsec3->rr.file_name, latest_nsec3->rr.line, "broken NSEC3 chain, expected %s, but found %s", expected_name, rr->rr.rr_set->named_rr->name); } if (rr != first_nsec3) latest_nsec3->next_nsec3 = rr; latest_nsec3 = rr; return NULL; } if (rr != first_nsec3) latest_nsec3->next_nsec3 = rr; } latest_nsec3 = rr; return rr; }
static char* ipseckey_human(struct rr *rrv) { RRCAST(ipseckey); char s[1024], gw[1024]; switch (rr->gateway_type) { case 0: strcpy(gw, rr->gateway.gateway_none); break; case 1: inet_ntop(AF_INET, &rr->gateway.gateway_ipv4, gw, 1024); break; case 2: inet_ntop(AF_INET6, &rr->gateway.gateway_ipv6, gw, 1024); break; case 3: strcpy(gw, rr->gateway.gateway_name); break; default: strcpy(gw, "??"); } snprintf(s, 1024, "( %d %d %d %s ... )", rr->precedence, rr->gateway_type, rr->algorithm, gw); return quickstrdup_temp(s); }
static char* minfo_human(struct rr *rrv) { RRCAST(minfo); char s[1024]; snprintf(s, 1024, "%s %s", rr->rmailbx, rr->emailbx); return quickstrdup_temp(s); }
static char* aaaa_human(struct rr *rrv) { struct rr_aaaa *rr = (struct rr_aaaa *)rrv; char s[1024]; if (inet_ntop(AF_INET6, &rr->address, s, 1024)) return quickstrdup_temp(s); return "????"; }
static char* dnskey_human(struct rr *rrv) { RRCAST(dnskey); char s[1024]; snprintf(s, 1024, "%hu %d %d XXX ; key id = %hu", rr->flags, rr->protocol, rr->algorithm, rr->key_tag); return quickstrdup_temp(s); }
static char* afsdb_human(struct rr *rrv) { RRCAST(afsdb); char s[1024]; snprintf(s, 1024, "%d %s", rr->subtype, rr->hostname); return quickstrdup_temp(s); }
static char* mx_human(struct rr *rrv) { RRCAST(mx); char s[1024]; snprintf(s, 1024, "%d %s", rr->preference, rr->exchange); return quickstrdup_temp(s); }
static char* rt_human(struct rr *rrv) { RRCAST(rt); char s[1024]; snprintf(s, 1024, "%d %s", rr->preference, rr->intermediate_host); return quickstrdup_temp(s); }
static char* px_human(struct rr *rrv) { RRCAST(px); char s[1024]; snprintf(s, 1024, "%d %s %s", rr->preference, rr->map822, rr->mapx400); return quickstrdup_temp(s); }
static char* a_human(struct rr *rrv) { RRCAST(a); char s[1024]; if (inet_ntop(AF_INET, &rr->address, s, 1024)) return quickstrdup_temp(s); return "????"; }
static char* tlsa_smimea_human(struct rr *rrv) { RRCAST(tlsa_smimea); char s[1024]; snprintf(s, 1024, "%d %d %d ...", rr->cert_usage, rr->selector, rr->matching_type); return quickstrdup_temp(s); }
static char* cert_human(struct rr *rrv) { RRCAST(cert); char s[1024]; snprintf(s, 1024, "%d %d %d ...", rr->type, rr->key_tag, rr->algorithm); return quickstrdup_temp(s); }
static char* soa_human(struct rr *rrv) { RRCAST(soa); char s[1024]; snprintf(s, 1024, "%s %s %u %d %d %d %d", rr->mname, rr->rname, rr->serial, rr->refresh, rr->retry, rr->expire, rr->minimum); return quickstrdup_temp(s); }
static char* naptr_human(struct rr *rrv) { struct rr_naptr *rr = (struct rr_naptr *)rrv; char s[1024]; snprintf(s, 1024, "%hu %hu \"%s\" ...", rr->order, rr->preference, rr->flags.data); return quickstrdup_temp(s); }
static char* srv_human(struct rr *rrv) { RRCAST(srv); char s[1024]; snprintf(s, 1024, "%hu %hu %hu %s", rr->priority, rr->weight, rr->port, rr->target); return quickstrdup_temp(s); }
static char* nid_human(struct rr *rrv) { RRCAST(nid); char s[1024]; snprintf(s, 1024, "%d %x:%x:%x:%x", rr->preference, (unsigned)(rr->node_id >> 48) & 0xffff, (unsigned)(rr->node_id >> 32) & 0xffff, (unsigned)(rr->node_id >> 16) & 0xffff, (unsigned)(rr->node_id >> 0) & 0xffff); return quickstrdup_temp(s); }
static char* l32_human(struct rr *rrv) { RRCAST(l32); char s[1024]; snprintf(s, 1024, "%d %d.%d.%d.%d", rr->preference, (rr->locator32 >> 24) & 0xff, (rr->locator32 >> 16) & 0xff, (rr->locator32 >> 8) & 0xff, (rr->locator32 >> 0) & 0xff); return quickstrdup_temp(s); }
static char* l64_human(struct rr *rrv) { RRCAST(l64); char s[1024]; snprintf(s, 1024, "%d %x:%x:%x:%x", rr->preference, (unsigned)(rr->locator64 >> 48) & 0xffff, (unsigned)(rr->locator64 >> 32) & 0xffff, (unsigned)(rr->locator64 >> 16) & 0xffff, (unsigned)(rr->locator64 >> 0) & 0xffff); return quickstrdup_temp(s); }
static char* txt_human(struct rr *rrv) { RRCAST(txt); char ss[1024]; char *s = ss; int l; struct rr_txt_segment *seg = rr->txt; while (seg) { /* XXX would be nice to escape " with \ in strings */ l = snprintf(s, 1024-(s-ss), "\"%s\" ", seg->txt.data); s += l; seg = seg->next; } return quickstrdup_temp(ss); }
static char* dlv_human(struct rr *rrv) { RRCAST(dlv); char ss[4096]; char *s = ss; int l; int i; l = snprintf(s, 4096, "%u %u %u ", rr->key_tag, rr->algorithm, rr->digest_type); s += l; for (i = 0; i < rr->digest.length; i++) { l = snprintf(s, 4096-(s-ss), "%02X", (unsigned char)rr->digest.data[i]); s += l; } return quickstrdup_temp(ss); }
static char* nsec3_human(struct rr *rrv) { struct rr_nsec3 *rr = (struct rr_nsec3 *)rrv; char ss[1024]; char *s = ss; int l; int i; l = snprintf(s, 1024, "%u %u %u ", rr->hash_algorithm, rr->flags, rr->iterations); s += l; if (rr->salt.length) { for (i = 0; i < rr->salt.length; i++) { l = snprintf(s, 1024-(s-ss), "%02X", (unsigned char)rr->salt.data[i]); s += l; } } else { sprintf(s, "-"); } return quickstrdup_temp(ss); }