mirror of
http://thekelleys.org.uk/git/dnsmasq.git
synced 2026-11-03 13:38:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd6ad9e481 | ||
|
|
794fccca7f | ||
|
|
394ff492da | ||
|
|
1e153945de | ||
|
|
0b8a5a30a7 | ||
|
|
150162bc37 | ||
|
|
8805283088 |
No files matched your search
+439
-363
File diff suppressed because it is too large.
Load diff
+18
-2
@@ -1399,6 +1399,20 @@ int cache_make_stat(struct txt_record *t)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* There can be names in the cache containing control chars, don't
|
||||
mess up logging or open security holes. */
|
||||
static char *sanitise(char *name)
|
||||
{
|
||||
unsigned char *r;
|
||||
if (name)
|
||||
for (r = (unsigned char *)name; *r; r++)
|
||||
if (!isprint((int)*r))
|
||||
return "<name unprintable>";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
void dump_cache(time_t now)
|
||||
{
|
||||
struct server *serv, *serv1;
|
||||
@@ -1452,9 +1466,9 @@ void dump_cache(time_t now)
|
||||
*a = 0;
|
||||
if (strlen(n) == 0 && !(cache->flags & F_REVERSE))
|
||||
n = "<Root>";
|
||||
p += sprintf(p, "%-30.30s ", n);
|
||||
p += sprintf(p, "%-30.30s ", sanitise(n));
|
||||
if ((cache->flags & F_CNAME) && !is_outdated_cname_pointer(cache))
|
||||
a = cache_get_cname_target(cache);
|
||||
a = sanitise(cache_get_cname_target(cache));
|
||||
#ifdef HAVE_DNSSEC
|
||||
else if (cache->flags & F_DS)
|
||||
{
|
||||
@@ -1587,6 +1601,8 @@ void log_query(unsigned int flags, char *name, struct all_addr *addr, char *arg)
|
||||
if (!option_bool(OPT_LOG))
|
||||
return;
|
||||
|
||||
name = sanitise(name);
|
||||
|
||||
if (addr)
|
||||
{
|
||||
if (flags & F_KEYTAG)
|
||||
|
||||
+7
-3
@@ -1177,7 +1177,7 @@ int dnssec_validate_by_ds(time_t now, struct dns_header *header, size_t plen, ch
|
||||
STAT_NO_DS It's proved there's no DS here.
|
||||
STAT_NO_NS It's proved there's no DS _or_ NS here.
|
||||
STAT_BOGUS no DS in reply or not signed, fails validation, bad packet.
|
||||
STAT_NEED_DNSKEY DNSKEY records to validate a DS not found, name in keyname
|
||||
STAT_NEED_KEY DNSKEY records to validate a DS not found, name in keyname
|
||||
*/
|
||||
|
||||
int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char *name, char *keyname, int class)
|
||||
@@ -1208,7 +1208,10 @@ int dnssec_validate_ds(time_t now, struct dns_header *header, size_t plen, char
|
||||
if (!(p = skip_section(p, ntohs(header->ancount), header, plen)))
|
||||
val = STAT_BOGUS;
|
||||
|
||||
if (val == STAT_BOGUS)
|
||||
/* If the key needed to validate the DS is on the same domain as the DS, we'll
|
||||
loop getting nowhere. Stop that now. This can happen of the DS answer comes
|
||||
from the DS's zone, and not the parent zone. */
|
||||
if (val == STAT_BOGUS || (val == STAT_NEED_KEY && hostname_isequal(name, keyname)))
|
||||
{
|
||||
log_query(F_NOEXTRA | F_UPSTREAM, name, NULL, "BOGUS DS");
|
||||
return STAT_BOGUS;
|
||||
@@ -2032,7 +2035,8 @@ int dnssec_validate_reply(time_t now, struct dns_header *header, size_t plen, ch
|
||||
/* NXDOMAIN or NODATA reply, prove that (name, class1, type1) can't exist */
|
||||
/* First marshall the NSEC records, if we've not done it previously */
|
||||
if (!nsec_type && !(nsec_type = find_nsec_records(header, plen, &nsecs, &nsec_count, qclass)))
|
||||
return STAT_BOGUS; /* No NSECs */
|
||||
return STAT_NO_SIG; /* No NSECs, this is probably a dangling CNAME pointing into
|
||||
an unsigned zone. Return STAT_NO_SIG to cause this to be proved. */
|
||||
|
||||
/* Get name of missing answer */
|
||||
if (!extract_name(header, plen, &qname, name, 1, 0))
|
||||
|
||||
+9
-2
@@ -663,6 +663,7 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server
|
||||
header->ancount = htons(0);
|
||||
header->nscount = htons(0);
|
||||
header->arcount = htons(0);
|
||||
header->hb3 &= ~HB3_TC;
|
||||
}
|
||||
|
||||
/* the bogus-nxdomain stuff, doctor and NXDOMAIN->NODATA munging can all elide
|
||||
@@ -991,7 +992,10 @@ void reply_query(int fd, int family, time_t now)
|
||||
char *result;
|
||||
|
||||
if (forward->work_counter == 0)
|
||||
result = "ABANDONED";
|
||||
{
|
||||
result = "ABANDONED";
|
||||
status = STAT_BOGUS;
|
||||
}
|
||||
else
|
||||
result = (status == STAT_SECURE ? "SECURE" : (status == STAT_INSECURE ? "INSECURE" : "BOGUS"));
|
||||
|
||||
@@ -1938,7 +1942,10 @@ unsigned char *tcp_request(int confd, time_t now,
|
||||
char *result;
|
||||
|
||||
if (keycount == 0)
|
||||
result = "ABANDONED";
|
||||
{
|
||||
result = "ABANDONED";
|
||||
status = STAT_BOGUS;
|
||||
}
|
||||
else
|
||||
result = (status == STAT_SECURE ? "SECURE" : (status == STAT_INSECURE ? "INSECURE" : "BOGUS"));
|
||||
|
||||
|
||||
+2
-2
@@ -128,8 +128,8 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp,
|
||||
if (isExtract)
|
||||
{
|
||||
unsigned char c = *p;
|
||||
if (isascii(c) && !iscntrl(c) && c != '.')
|
||||
*cp++ = *p;
|
||||
if (c != 0 && c != '.')
|
||||
*cp++ = c;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user